Which code block will execute first ?.
-
Case -:
there is a EA for scalping. Every 30s it checks order count to ensure there is no additional orders have been placed. which means OnTimer event triggers for every 30s.
Time - 01:23:00
If a OnTick event has some series of blocks to execute right at 01:23:00 and If OnTimer event also triggered at the same time, which event will execute at first place ?.
is it OnTimer event or OnTick event ?.
-
This is an interesting question I'm also interested in. My guess is that 'on timer' goes first, but I'm not a programmer, so I cannot be sure. Any help here would definitely be appreciated.
-
yup brother.
-
@l-andorrà
I also guess onTimer(), because onClick() need a first tick after the specific time. -
Thank chat GPT: OnTimer Event This event is triggered at regular intervals based on the timer set by the EventSetTimer function. It allows you to perform tasks at specified time intervals, regardless of market activity. If the timer interval matches with the time of an incoming tick, the OnTimer event will still execute based on its own interval.
OnTick Event: This event is triggered every time a new tick (price change) occurs in the market for the selected symbol. It's directly tied to market activity. If there's a match between the time of a new tick and the time set for the OnTimer event, the OnTick event will take precedence because it's triggered by the arrival of market data.
-
So, the winner is OnTick....
-
looks like it, but the chance of it happening at the same time is small
-
@jstap true...
-
@jstap Very interesting. Thank you.