Download MetaTrader 5

How to count Bars in expert mql4 mql5 ?

To add comments, please log in or register
forexparvenu
905
forexparvenu 2015.11.01 14:43 
   int Bar = Bars(_Symbol,_Period);
   
   for (i = 0; i < Bar + 1; i++)
   {
   // my condition
   }
   int Bar = Bars(_Symbol,_Period);
   
   for (i = Bar - 1; i > 0; i--)
   {
   // my condition
   }

it's does'nt work, showed critical error in journal.

 

need's help, please and thanks you. 

Marco vd Heijden
Moderator
4727
Marco vd Heijden 2015.11.01 14:51  
         for(i=iBars(symbol_string,time_frame)-1;i>-1;i--)
           {
    
           }


so

   int Bar = Bars(_Symbol,_Period);
   
   for (i = Bar - 1; i > -1; i--)
   {
   // my condition
   }

but it might be some other problem somewhere in your code.

check the line number.

Marco vd Heijden
Moderator
4727
Marco vd Heijden 2015.11.01 14:56  
   int Bar = Bars;
   
   for (i = Bar - 1; i > -1; i--)
   {
   // my condition
   }

or

   for (i = Bars - 1; i > -1; i--)
   {
   // my condition
   }
forexparvenu
905
forexparvenu 2015.11.03 11:39  
Marco vd Heijden:

or

thanks you so much
To add comments, please log in or register