Intra-bar Price Movement Assumptions
Strategy Backtesting on historical data often requires making assumptions about price movement within bars.
In real-time trading, a strategy will monitor and respond to a data feed on tick-by-tick basis. However, the historical data available for backtesting will, in most cases, be in the form of bars based on a group of ticks, with only Open, High, Low, and Close prices available.
While it is not possible from these four values to infer the actual price movement within each bar, the Backtesting Engine improves the backtesting accuracy by incorporating intra-bar price movement assumption logic:
- An order could be executed at every valid price level throughout the entire range of the bar.
- If the opening price is closer to the high of the bar than to the low, the intra-bar price movement is assumed to be in the order of Open-High-Low-Close.
- If the opening price is closer to the low of the bar than to the high, or if the opening price is exactly in between the high and the low of the bar, the intra-bar price movement is assumed to be in the order of Open-Low-High-Close.
The first assumption implies that a Stop or a Limit order will execute at the Stop or the Limit price.
The second and third assumptions are significant when there are multiple orders active at the same time. If both a Stop Loss and a Profit Target prices are reached within the same bar, the order of price movement within the bar will determine which one of these orders will be executed.
- In a bar with an Open of 1355, a High of 1360, a Low of 1340, and a Close of 1345, the Profit Target will be assumed to have executed first (Assumption 2).
- In a bar with an Open of 1345, a High of 1360, a Low of 1340, and a Close of 1355, the Stop Loss will be assumed to have executed first (Assumption 3).