Indicator based on Shay Campbells’ E-Mini Swing Trading System where he uses a technique to enter the market based on pull backs of the price based upon a Moving Average Distribution indicator.
“Using a very short moving average of median price does a good job of defining a usable equilibrium point. A distribution can then be calculated around that equilibrium by subtracting the equilibrium point from the market price.
To normalize these readings for volatility, this result is then divided by the recent daily range of price.
The code calculate the Average Daily Range, so in order to make it possible, please extend the units displayed on your chart to have at least the ADRperiod number of days. Should not be a problem on a daily timeframe though.
Coded following a request in this topic: How would you create a Mov Ave Distribution Histogram?
//PRC_MovingAverage Distribution | indicator
//05.03.2019
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
// --- settings
ShortMAPeriod = 20
ADRperiod = 20
// --- end of settings
//compute ADR
sum=0
for i = 0 to ADRperiod-1 do
sum=sum+(dhigh(i)-dlow(i))
next
adr=sum/ADRperiod
shortMA=average[ShortMAPeriod](medianprice)
diff=medianprice-shortMA
r=176
g=23
b=31
MAD=(diff*100)/adr
if MAD>0 then
r=30
g=144
b=255
endif
return MAD coloured(r,g,b) style(histogram) as "Moving Average Distribution"
Hi Nicolas, very useful tool, as usual. I replaced ''histogram'' at line 32 by ''line''. As result, i get a line ( wanted result) , in blue when price is up, and red when price is down. Question, how can we detect any change of value ( ie any change of color / red becoming blue and vice versa) and apply to that change of value a specific tag/code allowing to generate buy or sell trades when the value /color is changing. I ve found easier to work with a line rather that with the histogram (less precise signal) but i'm blocked now to materialize a specific tag thanks for your help