IndicatorParameters Bug

 

For some reason when I use IndicatorParameters(); on the ROC I get an extra input parameter when there is only 1 input parameter. It seems like a bug since all other indicators I have tested work.

https://www.mql5.com/en/code/46

Price Rate of Change (ROC)
Price Rate of Change (ROC)
  • www.mql5.com
As you know, prices drop and grow in ondulatory way, in cycles. This cyclic movement is a result of change in investors' expectations and the price control fight between bulls and bears. Price Rate of Change (ROC) reflects this ondulatory movement like an oscillator, measuring the difference in prices in a certain period. ROC grows if prices...
 
kbtech:

For some reason when I use IndicatorParameters(); on the ROC I get an extra input parameter when there is only 1 input parameter. It seems like a bug since all other indicators I have tested work.

https://www.mql5.com/en/code/46

It's not a bug. When the OnCalculate() is declared this way:

int  OnCalculate( 
   const int        rates_total,       // price[] array size 
   const int        prev_calculated,   // number of handled bars at the previous call 
   const int        begin,             // index number in the price[] array meaningful data starts from 
   const double&    price[]            // array of values for calculation 
   );

The price array is considered an input.

But when OnCalculate() is declared this way:

int  OnCalculate( 
   const int        rates_total,       // size of input time series 
   const int        prev_calculated,   // number of handled bars at the previous call 
   const datetime&  time{},            // Time array 
   const double&    open[],            // Open array 
   const double&    high[],            // High array 
   const double&    low[],             // Low array 
   const double&    close[],           // Close array 
   const long&      tick_volume[],     // Tick Volume array 
   const long&      volume[],          // Real Volume array 
   const int&       spread[]           // Spread array 
   );

It's not an input. 

So you can verify by checking back those indicators you've tested and see which OnCalculate() do they use...

 
Seng Joo Thio:

It's not a bug. When the OnCalculate() is declared this way:

The price array is considered an input.

But when OnCalculate() is declared this way:

It's not an input. 

So you can verify by checking back those indicators you've tested and see which OnCalculate() do they use...

Thanks, is there a way I can detect which version of OnCalculate() an indicator uses; so I don't have to manually go through all the code of the indicators I have already tested?
 
kbtech:
Thanks, is there a way I can detect which version of OnCalculate() an indicator uses; so I don't have to manually go through all the code of the indicators I have already tested?

I'm not aware of any way.

Reason: