disallowing trade after orders are opened

 

Any help!? I am looking to suspend trade for say two hours once my orders are opened. I DO NOT want to stop the EA from working as I have a loop to close trades once profit target or max loss is reached. I know I can set a global variable in the ordersend function so that I can stop new orders from being placed. How would I write a piece of code to wait, for example, two hours before allowing new orders? I thought of using OrderOpenTime and then using currenttime to see if that is OrderOpenTime + Something(variable amount of time) and then deleting global variable?


Any help/code would be greatly appreciated!!!! Thank you. Daniel

 
forexman05:

Any help!? I am looking to suspend trade for say two hours once my orders are opened. I DO NOT want to stop the EA from working as I have a loop to close trades once profit target or max loss is reached. I know I can set a global variable in the ordersend function so that I can stop new orders from being placed. How would I write a piece of code to wait, for example, two hours before allowing new orders? I thought of using OrderOpenTime and then using currenttime to see if that is OrderOpenTime + Something(variable amount of time) and then deleting global variable?


Any help/code would be greatly appreciated!!!! Thank you. Daniel

That's exactly how I'd do it. Just remember to compare server time with server time and don't get any local times in the mix.

 
cloudbreaker:

That's exactly how I'd do it. Just remember to compare server time with server time and don't get any local times in the mix.

Ok, thanks for the affirmation.....could you help me with the code? I know enough to be dangerous and that is about all! :) Any help would be truly appreciated! D

Reason: