Nicolas

Moving Average Distribution

Category: Indicators By: Nicolas Created: March 5, 2019, 3:30 PM
March 5, 2019, 3:30 PM
Indicators
5 Comments
Moving Average Distribution

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.

  • Buy Signal=  Trend Direction is Up (6 to 9 month Mov Ave) and the MA Distribution registers a significant Pullback, i.e, negative value.
  • Sell Signal=  Trend Direction is Down and the MA Distribution registers a significant Pullback, i.e, positive value.”

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"

 

Download
Filename: PRC_MovingAverage-Distribution.itf
Downloads: 113
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

xpe74
1 year ago
#

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

luxrun
8 years ago
#

thanks Nicolas

luxrun
8 years ago
#

I found this solution, thanks

luxrun
8 years ago
#

Nicolas, I detected a problem with this indicator when I want to change the medium short period; you can do this only by varying the code while it is impossible to do it directly on the indicator chart settings. Thank you

Nicolas
8 years ago
#

It may be possible that the variables are still present in the code while they are also in the settings. In this case, delete the variables in the code (lines 7 and 8).

ProRealCode ProRealCode
Loading...