Code: Select all
If BarStatus(1) = 2 then begin
BuyPrice = (some calculation) // This only happens on the closing tick of the bar
end;
Buy next bar at BuyPrice limit; // This happens on every tick of the bar
Then, on the closing tick, my strategy calculates a new BuyPrice value of 1190. It should then transmit a "Buy limit 1190" order to my broker for the next bar.
Unfortunately, MultiCharts does not seem to transmit the new order to my broker until the opening ticks of the next bar. If there's an older order still pending (like the Buy Limit 1200 order), then that order will remain active until the opening ticks of the next bar. That means that my broker might inadvertently fill my order at the old price of 1200, rather than the new price of 1190.
Is there any way around this? I.e., for my new order to be transmitted on the close of the bar, rather than on the open of the next bar?
Thanks.