View Full Version : Distance from Moving Average
Prov1322
06-20-2011, 12:23 PM
Is there an existing indicator that will monitor the distance between the current price and a Moving Average?
I have completed several search variations but without success.
Any suggestions on this?
Thanks!
JJ
NinjaTrader_RyanM
06-20-2011, 01:30 PM
Hi JJ,
I'm not aware of this but you can create easily enough. The following line sets a plot using the absolute value of the difference between close and a SMA.
Value.Set(Math.Abs(Close[0] - SMA(Close, 14)[0]));
koganam
06-20-2011, 01:45 PM
Is there an existing indicator that will monitor the distance between the current price and a Moving Average?
I have completed several search variations but without success.
Any suggestions on this?
Thanks!
JJ
And if you want to see it as an oscillator, just yank the "Math.Abs" from Ryan's post thusly:
Value.Set(Close[0] - SMA(Close, 14)[0]);
Prov1322
06-20-2011, 02:11 PM
Thanks to both RyanM and koganam for the code lines...now just have to figure out how to cut/paste/create from a built-in, system indicator...(and I will...!)
JJ