I'm testing a strategy and I'm noticing I'm entering market twice when my indicators are triggered.
I have a control on the code that if I just submitted an order, then OnBarUpdate code won't attempt to submit new orders for the next x minutes. This is to prevent duplicated orders, since to check just MarketPosition could lead to mistakes as orders could take a few seconds to be filled.
I'm running on tick by tick basis (CalculateOnBarClose = false), that is why I have this concern.
My question goes: could OnBarUpdate method be triggered at the same time if 2 ticks are received at the same time? Or one OmBarUpdate Thread will always wait for the other to finish before it is executed.
On a tick by tick basis, this is a kind of concern one has to have while coding.
What would be typically used to prevent this?
Appreciate any support.
Thanks,
Rodrigo
Comment