How to control a number of order placement?

Fabio Cavalloni  

If you need to open one order for each new candle you need a function to check if the new incoming tick generate a new candle or not.

// Global variables
datetime lastBar = 0;

// OnTick
   bool IsNewBar = iTime(NULL,0,0) > lastBar;
   if( IsNewBar ) {
      lastBar = iTime(NULL,0,0);
      // Code for each new bar
   }
mygreensun  

Thank you Fabio. I will try with it. 

Best regards, 

MyGreen

Reason: