CiMomentum return DBL_MAX

 

Hello,

within an indicator i tried to use CiMomentum.

 

 

#include <Indicators\Oscilators.mqh>

CiMomentum cMomentum;
void OnInit()
{
    
    cMomentum.Create(Symbol(),Period(),my_period,PRICE_MEDIAN);
}

int OnCalculate (const int rates_total,      // size of input timeseries
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[]         // Spread
   )

{
 
    int begin=0;
  
     
    if(rates_total<my_period-1+begin)
    {
        
        return(0);// not enough bars for calculation
    }
    double mom=cMomentum.Main(0);
    return(rates_total);
}

 

unfortunately, Main(0) return always DBL_MAX.

Anyone knows why ?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Named Constants / Numerical Type Constants
Documentation on MQL5: Standard Constants, Enumerations and Structures / Named Constants / Numerical Type Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Named Constants / Numerical Type Constants - Documentation on MQL5