Strategy fills are built from an assumed path through the bar
The Strategy Tester can only infer historical order fills from available bar data and broker-emulator rules.
Strategy fills look precise in the report. There is an entry price, an exit price, a profit, a loss, and a trade list. That precision can hide the fact that historical bars are aggregated. Unless the script has lower-timeframe data or realtime execution, the tester is working from an assumed path through the bar, not a saved record of every tick.
This one matters because many strategy disagreements are really fill-model disagreements. The logic may be correct, but the user is reading the report as if it were a broker statement.
Why this catches people
The bad assumption is to see a stop and target both inside the same candle and assume the tester knew which one happened first. On a historical OHLC bar, the exact sequence may not be available. The broker emulator has rules for how it treats orders, prices, and intrabar assumptions. Those rules are necessary, but they are not the market’s memory.
The issue becomes sharper with synthetic charts, intrabar calculation, and order-fill recalculation. A strategy can appear to react after a fill while still having access to OHLC information from the bar. That does not mean the script had a realistic tick-by-tick trading environment.
The Pine bit
The useful habit is to read the Strategy Tester as a model. A good model can still be useful. It just should not be confused with proof that every fill happened the way the report suggests. Limit orders, stop orders, partial exits, pyramiding, and same-bar reversals all deserve extra review because they depend heavily on sequencing.
If the strategy’s edge depends on the exact order of high and low inside a candle, the script needs either a lower-timeframe test, a bar magnifier style setup where available, or a much more conservative assumption. Otherwise the backtest may be measuring a path that was convenient rather than tradable.
//@version=6
strategy("Same bar caution", overlay = true)
strategy.entry("L", strategy.long)
strategy.exit("L exit", "L", stop = close * 0.99, limit = close * 1.01)
Why it can survive a quick review
This can slip through review because the Strategy Tester has a professional presentation. Tables and equity curves imply accounting certainty. The script author has to remember that the accounting is downstream of the emulator’s assumptions. A clean equity curve can still be built from optimistic same-bar fills.
There is also a psychological reason. Users want a single answer: did the strategy work? Fill ambiguity forces a more uncomfortable answer: it worked under this model. That is still useful, but it is not the same claim.
How I handle it in builds
When I build or review a strategy, I mark the parts of the logic that are fill-sensitive. If an entry and stop can happen on the same bar, I test conservative variants. If partial exits reserve quantity, I check that the order IDs and quantities match the intended trade plan. If the strategy runs on a synthetic chart, I compare it with standard prices.
For nontechnical users, I explain this without turning the project into a lecture. The practical version is: the report is a simulation, and some simulations are more fragile than others. If the fragile part is where the profit comes from, the script needs more work.
Where this shows up
A good strategy review includes intentionally ugly candles. I test bars where both target and stop are inside the range, bars where entry and exit can occur together, and bars where the market gaps through a level. If the strategy only looks good when those cases are rare, that is a clue that the edge may be fill-sensitive.
I separate visual stop lines from executable stop assumptions. A line on the chart can mark a risk level. A strategy exit tests an order model. They should agree when possible, but they are not the same object. Confusing them is how a neat chart turns into a misleading performance report.
For automation, this matters even more. A live broker or bridge will not fill orders because the Strategy Tester found a plausible path through a candle. The external system has its own rules, latency, and order handling.
I look for strategies where the average trade is smaller than the spread, fee, or slippage that would be realistic for the market. Fill ambiguity is not the only issue in those cases, but it usually compounds the problem. A strategy that depends on tiny perfect fills inside historical candles is fragile even before commissions are considered.
Conservative testing does not make the script less useful. It tells the user where the idea still works after the easy assumptions are removed. That is the version of a strategy report I would rather build around.
How I test it
I test strategy behaviour by separating signal, order, fill, and report. A marker proves the signal condition. An order ID proves the strategy instruction. A fill proves the emulator accepted a path. A report proves only the model’s accounting. Those are related, but they are not interchangeable.
When the strategy report is doing real work, I run a conservative variant beside the intended one. If the strategy collapses when same-bar optimism, synthetic prices, or ambiguous fills are reduced, the report is telling me the edge depends on assumptions. That does not automatically kill the idea, but it changes how I would present it.
I review whether slippage settings are doing enough work. Slippage cannot repair an impossible fill model, but it can reveal strategies that only survive under frictionless assumptions. If a small realistic cost destroys the result, the fill logic deserves another look.
Checks before I trust it
- Review any trade where stop and target can both be inside the same bar.
- Test fill-sensitive logic on lower timeframes when possible.
- Do not read Strategy Tester fills as broker-confirmed fills.
- Be cautious with synthetic charts and same-bar reversals.
- Identify whether the edge depends on optimistic intrabar sequencing.
The point I keep coming back to is that fills are not just outputs. They are assumptions. Once the assumptions are visible, the strategy report becomes useful without pretending to be more certain than it is.