How would you create a Mov Ave Distribution Histogram?
Forums › ProRealTime English forum › ProBuilder support › How would you create a Mov Ave Distribution Histogram?
- This topic has 5 replies, 2 voices, and was last updated 5 years ago by Nicolas.
Tagged: ADR, distribution
-
-
03/03/2019 at 4:09 PM #92759
Hi
I was reading Shay Campbells’ E-Mini Swing Trading System: http://timingcharts.com/articles/2017/10/20/e-mini-sp-500-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: Pls see image.“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.”
I was attempting to re-create that indicator but wondered how as I’m not a coder. My attempt based on other indicators is not working but I hope I’m thinking along the right lines.. unless I have over complicated it?
Cheers
Moving Average Distribution1234567891011121314151617181920212223242526DEFPARAM CalculateOnLastBars = 100Period = 20MAPeriod = 20ATRPeriod = 20r = 0g =0Ave = Average[MAPeriod](MedianPrice)ATR = AverageTrueRange[ATRPeriod](Close)S = 0FOR i = 1 TO PeriodTP = TotalPrice[i]Dist = (TP - Ave)/ATR > 0 // 1 = TP > AveIF Dist = 0 THENDist = (TP - Ave)/ATR < 0 * -1 // -1 = TP < AveENDIFS = S + Dist //Sum up all Dist’sNEXTDist = Dist*(s) //HistogramAve = Average[MAPeriod](MedianPrice) //Signal LineReturn Dist coloured(r,g,0) style(histogram) as "Moving Average Distribution", Ave AS "Signal Line", 0 AS "Zero"03/04/2019 at 9:49 AM #92798this result is then divided by the recent daily range of price.
daily range is not the ATR, it is called the ADR (an average of the last X days range). “Recent” would mean how many period?
03/04/2019 at 6:47 PM #92840Oh, right, thanks. In the article Shay doesn’t specify exactly other than to say recent. It would make sense to keep the ADR in relation to the moving average for the distribution, no? He writes:
The MA Distribution tells us what’s happening in the very short term using just a couple weeks of data.
So I guess 20 days?
03/05/2019 at 10:10 AM #92863Ok, I took this value in the below code, you can change it of course. The indicator makes sense since it finds easily the pullbacks when you are in a well established trend.
1234567891011121314151617181920212223//PRC_MovingAverage Distribution | indicator//05.03.2019//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge// --- settingsShortMAPeriod = 20ADRperiod = 20// --- end of settings//compute ADRsum=0for i = 0 to ADRperiod-1 dosum=sum+(dhigh(i)-dlow(i))nextadr=sum/ADRperiodshortMA=average[ShortMAPeriod](medianprice)diff=medianprice-shortMAMAD=(diff*100)/adrreturn MAD style(histogram)If you find it correct according to the original description, I will put it into the library for everyone to benefit from this concept.
1 user thanked author for this post.
03/05/2019 at 2:37 PM #92887https://www.youtube.com/watch?v=eZDiG2jynNs
Yes, please do.
03/05/2019 at 3:31 PM #92891😆
The indicator is now available in the library: Moving Average Distribution
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on