bassam@bollingerbands.com Site Admin
Joined: 26 May 2009 Posts: 14
|
Posted: Wed Nov 23, 2011 9:53 am Post subject: Diff of 2 moving averages |
|
|
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 |
|