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"