I have a strategy I have been running live that has been coded to work using CalculateonBar =True and things work fine. I recently began modifying a version that would run on each incoming tick to judge the difference between the performance between the two strategies.
The problem I am having with CalculateOnBar = false is when my strategy hits the condition to enter a trade, it submits the order but before the order can even be filled (and i'm using market orders) the next TICK is coming through and triggering the order condition again because the first order has not yet been filled. So my strategy is duplicating each order because it does not have the time to finish processing its instructions before the next OnUpdate() method gets triggered.
Is there anyway to pause / delay the strategy just a few seconds to complete instructions before the next tick comes in? I suppose I could try and immediately set a variable that says PROCESSING = TRUE and just check that flag before doing anything onBarUpdate but let me know if there is anything more robust for this issue.
(editing this as I don't think the processing flag would even work due to no straightforward way to break out of it)
Thanks!

Comment