Modifying MACD to Adaptive MACD

 

(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

 
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.
 

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:

   
ExtFastMaHandle=iAMA(NULL,0,InpFastEMA,FastEMA_F,FastEMA_S,0,InpAppliedPrice);
ExtSlowMaHandle=iAMA(NULL,0,InpSlowEMA,SlowEMA_F,SlowEMA_S,0,InpAppliedPrice);

This is the result:

Reason: