Support Board
Date/Time: Fri, 31 Jan 2025 03:02:20 +0000
Post From: bar backtest: is there a way to adjust the line-delay/time-to-order-in-force delay?
[2019-03-26 22:45:20] |
uM8137 - Posts: 183 |
Say I'm doing a bar-based backtest, with 1 minute bars. Suppose in my ACSIL trading code at sc.Index = 100, I decide to buy based on the the sc.Index = 100 values for the high, low, open, and close prices to place a market trade. Now I note that the 1min bar simulator can award me the open price (from 60 seconds back in time), also from the sc.Index = 100 bar. Effectively this makes the simulation very overly optimistic because I'm computing "in the future" and getting awarded a past price, which is (usually) no longer available --in particular if the market is moving. So to my question: is the a line-delay simulation parameter that would allow me to say how long between the start (or end) of the bar that is issuing the order and when the market price for the order is determined? While commonly needed for sub-second modeling, I could use it here to correct the minute sim (by setting it to +60 seconds from the open of the current 1 minute bar, or +100 microseconds from the close if the time-from-close instead) to get more realistic fills on my market orders during the 1min bar-based sim. Or are there other alternatives for correcting this problem? I tried to think if I could ask for a limit order at the closing price of the bar, but I don't think that solves the problem because the system could still fill me below (for a buy) the stated limit on the order, doing so legally. |