Download MetaTrader 5

Modifying MACD to Adaptive MACD

To add comments, please log in or register
Launch your trading signal and add account monitoring!
Armand 2012.02.23 07:16 

(Mql 5)

Hi I was modifying the MACD source code to make an adaptive MACD.

The idea was to replace the conventional moving averages with Adaptive Moving Averages.

All I did was the following:

       The Adaptive Moving Averages required 2 more parameters each, so I added two more input variables for each MA used in the MACD.

       The functions iMA(parameters...) were replaced by iAMA(parameters...including the two new variables).

       That's it.

When I tested the indicator, it did not display anything, and the maximum and minimum values on the chart was "...#inf...-something".

At the moment I am at university, and don't have the code with me. I will post the rest of the information later today. If anyone can already see something wrong with this, please let me know.

Thank you

Rashid Umarov
Rashid Umarov 2012.02.23 07:26  
Armand 2012.02.23 23:46  
No, not previously, this article was very impressive. It was exactly what I was looking for; eliminating optimisation. I will definitely start coding in this new way. I recommend everyone to explore this kind of indicator development. Thank you very much.
Armand 2012.02.24 00:01  

Here is the rest of the information mentioned earlier:

I am discontinuing the development of this indicator, but I still want to know what went wrong.

I have edited a copy of the MACD.mq5 file in the program dir: "...Indicators\Examples\MACD.mq5"

I have created these extra variables:
input int                FastEMA_F=3;    // Fast EMA's fast var
input int                FastEMA_S=31;   // Fast EMA's slow var
input int                SlowEMA_F=2;    // Slow EMA's fast var
input int                SlowEMA_S=30;   // Slow EMA's slow var

I have replaced the iMA(...) function calls with iAMA(...) calls:


This is the result:

To add comments, please log in or register