Delaying trades

 
Could anyone help me here.....I have an EA on the 4hr timeframe. I have built in a globalvariable so once I set my orders and they are finally closed, no more orders can be placed. What I would like to do is to modify my code so that it waits one bar (four hours) and then deletes the global variable which is preventing further orders from being placed. I can only figure it has to do with orderopentime and currenttime. Any help would be greatly appreciated!! thanks........
 
forexman05:
Could anyone help me here.....I have an EA on the 4hr timeframe. I have built in a globalvariable so once I set my orders and they are finally closed, no more orders can be placed. What I would like to do is to modify my code so that it waits one bar (four hours) and then deletes the global variable which is preventing further orders from being placed. I can only figure it has to do with orderopentime and currenttime. Any help would be greatly appreciated!! thanks........

Option 1: Sleep(14400000)

Option 2: Get current time, add four hours, and check for new time to arrive

 
cloudbreaker wrote >>

Option 1: Sleep(14400000)

Option 2: Get current time, add four hours, and check for new time to arrive

Sleep....never had any success with that-not for that long. Current time...would I set something in the nested portion where the order send function is located to get currenttime and set it to some arbitrary variable like "CT" or something, then later look for currentime to be greater than "CT" + 4hrs? Just not sure on the logistics of what it would look like. Thank you for the ideas! Dan

 
Use Time() or iTime() function.