Use of Timer Object to Delay Execution of Code in EasyLanguage
The Timer Object can be used to delay the execution of Easylanguage code. This may be useful when issuing orders from a strategy to , to ensure each step is received by the trade server and acknowledged before proceeding to the next step. Failure to do so can create out-of-sync conditions with strategies that use OrderTickets to generate or cancel orders, or when restarting the strategy to re-sync the real-world position and strategy position.
The following example of code shows how a series of code steps within a strategy or indicator may be delayed a user-specified number of seconds by reusing a single Timer Object:
Fig. 1. Code Creating a Series of Execution Delays Between Code Segments Using the Timer Object