What is executed first, "On Tick" code or "On Trade" code when trade happens?
-
Hi Guys,
What is executed first, "On Tick" code or "On Trade" code when trade happens?
For example, if the same variable is changed by some code in the "On Tick" tab and also in the "On Trade" tab and some trade happened in the market;
So, 2 things has happened in one market tick, "On Tick" has triggered by market tick and "On Trade" has triggered by trade.
In that situation, both tabs ("On Tick" and "On Trade") will change variable, which one will be first?
-
@prot82 said in What is executed first, "On Tick" code or "On Trade" code when trade happens?:
Hi Guys,
What is executed first, "On Tick" code or "On Trade" code when trade happens?
For example, if the same variable is changed by some code in the "On Tick" tab and also in the "On Trade" tab and some trade happened in the market;
So, 2 things has happened in one market tick, "On Tick" has triggered by market tick and "On Trade" has triggered by trade.
In that situation, both tabs ("On Tick" and "On Trade") will change variable, which one will be first?
Why dont you tell us?
-
one way to do it, modify something with a "Current time" timestamp.
-
@prot82 I asked that same question to the admin some years ago and he replied in a very technical way. He's a programer and tried to make understand how it works. However, I wasn't and I'm not a progarmmer so I requested a white/black answer instead. He replied that it depends. Some times 'on tick' execution will happen first whereas other times 'on trade' will instead. Certainly not the answer that I needed, but at least it was hones. If you are a programmer you can ask him directly. Maybe you will understand the technical answer.
-
The number of each block might determine what goes first.
(At least that's how it works under the same tab)
You can edit those.
-
Although that is true the number of the first block in a tree affects which tree works first, meaning if the tree starts with 1 and the following connected blocks are a high number they will activate before the tree that starts with 2 is. I think on every tick these numbers are checked and activated, so as @Bogdaiki has said the tab matters less than the numbers.