All posts
Strategy testing
Market data
MT5

· 4 min read

OHLC Backtest Problem: What If Stop and Target Hit in the Same Candle?

See why candle OHLC data cannot always identify which exit came first. Compare two intrabar paths and document conservative assumptions before trusting a backtest.

By TickerAI

An OHLC candle records the open, high, low, and close for an interval. It does not normally record the order of every price movement inside that interval. If both a trade's stop and target lie within the candle's range, a candle-only backtest may not know which was reached first.

That is a data limitation, not a reason to select the exit that makes the strategy look best. Identify the ambiguity and document how the simulation handles it.

Two paths can produce the same candle

Assume a hypothetical long is already open at 100 before the candle begins. Its stop is 99 and target 102. The next candle has open 100, high 103, low 98, and close 101.

Both of these simplified paths produce those same OHLC values:

Hypothetical pathFirst protective exit encountered
100 → 103 → 98 → 101Target at 102 before stop at 99
100 → 98 → 103 → 101Stop at 99 before target at 102

The candle alone cannot choose between them. An entry occurring during the same candle creates additional questions about whether it happened before either exit level was visited.

Volume does not resolve the sequence by itself. A total quantity or tick count summarizes activity without necessarily providing the complete timestamped path needed for the trade.

The difference can change reported profitability

Suppose the hypothetical position earns or loses $10 per one-unit price move. Exiting at 102 produces +$20 before costs, while exiting at 99 produces −$10.

With an assumed $2 total cost applied consistently, the outcomes are +$18 and −$12. The difference between choosing the two paths is $30 for that one trade.

A strategy with many such candles can therefore show very different results under different intrabar assumptions. Report how many outcomes depend on the rule instead of hiding the choice inside a simulation setting.

Inspect the data and modeling mode

MetaTrader's real and generated tick guide explains that testing modes can use different information and tick-generation methods. A mode's name is not enough; read what prices are actually available to the test.

Real tick data can improve ordering evidence, but it still belongs to a particular feed and recording process. It does not perfectly recreate every historical order acknowledgement, queue position, spread, or broker decision.

If using a different execution venue from the data source, record that mismatch. A public exchange candle is not a historical broker bid-and-ask stream for a CFD automatically.

Choose and disclose an ambiguity policy

One approach is to classify unresolved trades as ambiguous and report a result range. Another is to apply a conservative stop-first assumption when the data cannot decide. A third is to retrieve finer information when available.

Each policy changes what the reported result means. A conservative assumption is not a reconstruction of what actually happened. Excluding ambiguous trades can also bias the sample if those trades systematically occur in more volatile conditions.

Preserve both the headline result and a sensitivity analysis showing how alternate admissible outcomes change it. Decide the policy before optimizing parameters around it.

Include bid and ask when relevant

A forex chart may show one price side, while entries and exits depend on the relevant executable side. Even a visible candle range can be insufficient to confirm a fill at the displayed line.

Record the price-side convention, spread model, order type, and rounding. A stop at a chart level also does not guarantee execution at that exact price during a gap.

Use MT5 order-type examples and trading costs to keep those assumptions explicit.

What TickerAI's candles can establish

TickerAI's market tools return OHLCV bars and render charts. Those bars support indicator calculations and market discussion, but they do not by themselves establish the complete intrabar order path for a historical execution study.

The current app does not provide a dedicated backtesting engine for replaying its Auto Trading agent. Ask the assistant to label unresolved historical execution rather than inventing a winning sequence from a candle.

Continue with backtesting versus forward testing. A reproducible study reports the information it lacked as carefully as the trades it counted.

Try it on a demo account

Free to start. Crypto needs no broker at all.

Create your account