Bollinger BandsŪ Message Board
BollingerBands - BollingerOnBollingerBands - BBForex - EquityTrader - FundsTrader - GroupPower - MarketTechnician - PatternPower - BBScript
 
 RegisterRegister   SupportSupport   ProfileProfile   SearchSearch   Log inLog in 

personalizing indicators

 
Post new topic   Reply to topic    Bollinger BandsŪ Message Board Forum Index -> BBScript General
View previous topic :: View next topic  
Author Message
blue_barry_hill72
Guest





PostPosted: Wed Nov 23, 2011 9:47 am    Post subject: personalizing indicators Reply with quote

Hi, I am testing an indicator with bbscript. I have 2 simple moving averages. I want to test for flags whenever the difference between the moving averages is greater than a percentage of the current price. Can you point me in the right direction?
Back to top
bassam@bollingerbands.com
Site Admin


Joined: 26 May 2009
Posts: 14

PostPosted: Wed Nov 23, 2011 9:53 am    Post subject: Diff of 2 moving averages Reply with quote

Hey blue_barry_hill72,
If i understand correctly, i think this should help:

ma1=sma(close(x),20)//first ma
ma2=sma(close(x),50)//second ma

diff = abs(ma1-ma2)//absolute diff

percent = 0.1
signal = greater(diff,percent *close(x))//contains 1s for anytime the diff is greater than the 10% of price
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Bollinger BandsŪ Message Board Forum Index -> BBScript General All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group