25 Mar 2024, 20:43

I have a curious question...

The OnTick event triggers each time it receives a new tick.

Let's say we have a set of blocks to execute on OnTick. What would happen if OnTick received multiple ticks within a second?

For example, indices like NAS100 and US30 are so volatile sometimes; the price moves at lightning speed, resulting in multiple ticks within a second.

Let's assume our EA was executing code, and if half of the code has executed while the other half remains to be executed, what happens if a new tick is received before the other half is executed?

There are two possible answers:

1. The EA abandons the execution of the other half and starts execution from the beginning (top).

2. The EA omits the new ticks until the current execution process has ended.

I don't know which is the correct answer.

I'm curious because if the answer "1" is correct, I should move my main code blocks to the OnTimer event and adjust the time interval to 10 seconds.