sleep function

 

hi all

currently i am using ontick

when a trade is closed, i want to wait a certain interval before evaluating to open a new trade

googling around, i found sleep can do the trick

is this the best method?

thanks 

 
bobo1974:

hi all

currently i am using ontick

when a trade is closed, i want to wait a certain interval before evaluating to open a new trade

googling around, i found sleep can do the trick

is this the best method?

thanks 

No.

Register the datetime when a trade is closed, and check that enough time elapsed to open a new one.

 
Alain Verleyen:

No.

Register the datetime when a trade is closed, and check that enough time elapsed to open a new one.

any sample script i can refer to?
 
datetime TimeStampLastTrade;

if(TimeLocal() > (TimeStampLastTrade + 60)){ // 1 minute
    OrderSend(...);
}

if(OrderClose(...)){
    TimeStampLastTrade = TimeLocal();
}
 
Top-SecreT:
thank you