Hi does anyone know how to change the moving average types for the default built in MACD in mql5 to all EMAs, I am having difficulty changing it, thank you in advance.
I’m not sure where are you trying to change them? If you’re changing the code of MACD – as was mentioned Slow and Fast MAs are EMAs in the MACD already.
If you want to changes signal calculation to EMA – you need to change MACD code (available on the platform) and change SimpleMAonBuffer function into ExponentialMAOnBuffer.
Is this what you were looking for?
Hey thanks not completely it uses SMA as part of the default calculation. Here is some information from the mt5 website of the default MACD script. Thus I would like to change the signal to EMA as well. Thanks.
Calculation
The MACD is calculated by subtracting the value of a 26-period exponential moving average from a 12-period exponential moving average. A 9-period dotted simple moving average of the MACD (the signal line) is then plotted on top of the MACD.
MACD = EMA(CLOSE, 12) - EMA(CLOSE, 26)
SIGNAL = SMA(MACD, 9)
Where:
EMA — Exponential Moving Average;
SMA — Simple Moving Average;
SIGNAL — the signal line of the indicator.
https://www.metatrader5.com/en/terminal/help/indicators/oscillators/macd
- www.metatrader5.com
I’m not sure where are you trying to change them? If you’re changing the code of MACD – as was mentioned Slow and Fast MAs are EMAs in the MACD already.
If you want to changes signal calculation to EMA – you need to change MACD code (available on the platform) and change SimpleMAonBuffer function into ExponentialMAOnBuffer.
Is this what you were looking for?
You can't change the calculation methods of the built-in MACD on MetaTrader.
Instead, use a custom indicator that implements the MACD as purely EMA based, as defined originally by its author Gerald Appel.
I believe, that there should be such implementations in the CodeBase, but if not then just use one of them as base code and adapt it to be purely EMA based.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi does anyone know how to change the moving average types for the default built in MACD in mql5 to all EMAs, I am having difficulty changing it, thank you in advance.