Imigration artical

 

Hi,

 

At the article -  https://www.mql5.com/en/articles/81 - the is a part:

 

at MQL4 is      int IndicatorCounted(),

so at MQL5 it should be:  

 int IndicatorCountedMQL4()
  {
   if(int IndicatorCountedMQL4()
  {
   if(prev_calculated>0) return(prev_calculated-1);
   if(prev_calculated==0) return(0);
   return(0);
  }

What is:  prev_calculated

 

Thanks. 

Migrating from MQL4 to MQL5
  • 2010.05.17
  • Sergey Pavlov
  • www.mql5.com
This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.
 
crossy:

What is:  prev_calculated

 

int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[])

 it is a parameter of  OnCalculate,  generally, code used in below  OnCalculate...

 
DxdCn:

int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[])

 it is a parameter of  OnCalculate,  generally, code used in below  OnCalculate...

Thanks DxdCN,

But the compiler tells me:

'prev_calculated' - undeclared identifier 

.......? 

 
crossy:

'prev_calculated' - undeclared identifier 

.......? 

 you should move this function  int IndicatorCountedMQL4()
 to inside you EA file , not in lib file, since  prev_calculated in you EA file ! but  .mqh file complie before EA file,  so you need cut this function and copy to your EA file.
Reason: