Download MetaTrader 5

sleep function

To add comments, please log in or register
bobo1974
216
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 

Alain Verleyen
Moderator
33486
Alain Verleyen  
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.

bobo1974
216
bobo1974  
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?
Daniela Bluemel
744
Daniela Bluemel  
datetime TimeStampLastTrade;

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

if(OrderClose(...)){
    TimeStampLastTrade = TimeLocal();
}
bobo1974
216
bobo1974  
Top-SecreT:
thank you
To add comments, please log in or register