problem with MACD in EA (error 5039 - ERR_TOO_MANY_PARAMETERS)

 

i`m having some trouble with a piece of code for an EA after changing the original code generated by MetaEditor

the tester kept giving error on the periods, so i changed the code to:

//--- Creating filter CSignalMACD
   CSignalMACD *filter1=new CSignalMACD;
   if(filter1==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating filter11");
      ExtExpert.Deinit();
      return(14);
     }
   signal.AddFilter(filter1);
//--- Set filter parameters
   if(Signal_MACD_PeriodSlow > Signal_MACD_PeriodFast)
     {
      filter1.PeriodFast(Signal_MACD_PeriodFast);
      filter1.PeriodSlow(Signal_MACD_PeriodSlow);
     }
   else
      if(Signal_MACD_PeriodSlow < Signal_MACD_PeriodFast)
        {
         filter1.PeriodFast(Signal_MACD_PeriodSlow);
         filter1.PeriodSlow(Signal_MACD_PeriodFast);
        }
      else
        {
         filter1.PeriodFast(Signal_MACD_PeriodFast);
         filter1.PeriodSlow((Signal_MACD_PeriodSlow+1));
        }
   filter1.PeriodSignal(Signal_MACD_PeriodSignal);
   filter1.Applied(Signal_MACD_Applied);
   filter1.Weight(Signal_MACD_Weight);

the validation part stop giving error, but the InitIndicators() part is giving error 5039 (ERR_TOO_MANY_PARAMETERS)

i`ve tried to understand which part is wrong, to no avail


can anyone help me with this?

 

never mind, found the source of the problem

the problem was that i was, unintentionally, zeroing the signal period, causing the possibility of getting a divide by zero error in the indicator

another thing i`ve realized is that the changes where not necessary, works flawlessly without them
Reason: