MACD two lines
- This topic has 3 replies, 2 voices, and was last updated 5 years ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › MACD two lines
Tagged: Macd, smoothed, smoothed macd
Standard MACD is calculated using exponential averages.
To disable the hystogram just make it INVISIBLE in the indicators’properties.
This is the code for the MACD, if you want to customize it with different averages, you just need to change the variable MAtype:
|
1 2 3 4 5 6 7 8 |
FastMA = 12 //12 Fast average SlowMA = 26 //26 Slow average Periods = 9 //9 periods for the Signal MAtype = 1 //1=ema average type(see available types https://www.prorealcode.com/documentation/average/) MyMACD = Average[FastMA,MAtype](close) - Average[SlowMA,MAtype](close) //difference of the two averages MySignalLine = Average[Periods,MAtype](MyMACD) //average of the MACD MyHisto = MyMACD - MySignalLine //hystogram RETURN MyMacd AS "Macd",MySignalLine AS "Signal",MyHisto as "histo" |
This is not smoothed since it’s the standard one, to smooth the Signal line we need to add a smoothing average:
|
1 2 3 4 5 6 7 8 9 10 11 12 |
FastMA = 12 //12 Fast average SlowMA = 26 //26 Slow average Periods = 9 //9 periods for the Signal MAtype = 1 //1=ema average type(see available types https://www.prorealcode.com/documentation/average/) SmoothPeriods= 20 //20 smppthing periods SmoothType = 1 //1=ema smoothing average type MyMACD = Average[FastMA,MAtype](close) - Average[SlowMA,MAtype](close) //difference of the two averages MySignalLine = Average[Periods,MAtype](MyMACD) //average of the MACD MySignalLineS= Average[SmoothPeriods,SmoothType](MySignalLine) //average of the SIGNAL line (smoothing) //MyHisto = MyMACD - MySignalLine //hystogram MyHisto = MyMACD - MySignalLineS //hystogram (smoothed) RETURN MyMacd AS "Macd",MySignalLineS AS "Signal",MyHisto as "histo" |
you will set the periods and type of any average as best suits your needs. Expnential averages are used by default.
As you can see from the attached pic, the MACD has the same value as the original, while the Signal line has a smoothed value.
Find exclusive trading pro-tools on