Easiest way to halt trading on stop loss being hit? - page 2

 

Yea I see. 

 Using this:

if(ClosedBySL) NextOrder = OrderCloseTime()+3600;


 How can I round UP "OrderCloseTime()" to the nearest hour in the example above?

 
Just for clarification, why the round up? Though I kinda knew the answer already.
 
DomGilberto:

Yea I see. 

 Using this:


 How can I round UP "OrderCloseTime()" to the nearest hour in the example above?

There are many different ways, here is one:

#define HOUR 3600
...

if(ClosedBySL)
  {
   datetime ClosedAt = OrderCloseTime();
   NextOrder = ClosedAt - (ClosedAt % HOUR) + HOUR;
  }

 
honest_knave: There are many different ways, here is one:
round number - MQL4 forum
Reason: