Change MACD to all EMAs in MQL5

sarahfoxwell  

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. 

Anton Ohurtsov  
sarahfoxwell:

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. 

Hi!
MACD has EMA for calculations, hasn't it?
GumarSafin  
Have you tried to apply them as a template?
sarahfoxwell  
Anton Ohurtsov #:
Hi!
MACD has EMA for calculations, hasn't it?

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

MACD - Oscillators - Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
  • www.metatrader5.com
Moving Average Convergence/Divergence (MACD) is a trend-following dynamic indicator. It indicates the correlation between two Moving Averages of a...
sarahfoxwell  
Marzena Maria Szmit #:

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?

Yes that would be it I have provided some information above. I think I have tried that already but I can try again thanks for the input. 
Fernando Carreiro  
sarahfoxwell: 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. 
sarahfoxwell #: Yes that would be it I have provided some information above. I think I have tried that already but I can try again thanks for the input. 

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.