Realistic backtesting
Realistic backtesting with historical bid & ask data.
A chart shows one price. A trade never gets it: buying pays the ask, selling receives the bid, and the gap between them moves all day. Most backtests paper over that with one fixed spread chosen for the whole test. Sage can charge the spread that was actually quoted in each minute of the historical data, and trigger every stop and target on the side of the book it would really have traded on — so the tight-stop, short-timeframe results that look best are no longer the ones flattered most.
In the app: Replay & Backtest · Real spread
What it is
Realistic Backtesting, concretely.
Both sides
Bid and ask, not one line
The candles on the chart are the bid. A buy fills at the ask, a sell at the bid, and closing does the opposite — Sage prices every fill on the side of the book it would have traded on, instead of at the line you are looking at.
Historical spread
The spread that was quoted that minute
For instruments whose data provider publishes ask prices — forex, gold, silver, oil and major indices — Sage stores the spread for every 1-minute candle and charges that minute's figure, not one number chosen for the whole test.
Stops & targets
Levels trigger on the right side
A long's stop and target trigger on the bid, the candle as drawn. A short's trigger on the ask, one spread above it — so a short can be stopped out by the ask while the drawn candle never touched the line, and the close notice says so.
Orders
Market and limit orders priced honestly
A market buy fills at the ask of the last candle you have seen; a buy limit fills when the ask reaches your price, which is the bid reaching it minus the spread. Sells mirror both.
Visible
You can see which spread was charged
Each session is set to Real spread or a custom fixed spread. The workspace shows REAL or FIXED as you trade, and says so when a minute had no stored spread and fell back to your fixed number — never to zero.
Your broker
Or match your own broker
Historical quotes from a data provider are not your broker's quotes. If your broker's spread runs wider, or you want a stress test, set a custom spread per instrument and replay the same dates again.
Explained
What realistic backtesting means
A backtest is a claim about what a set of rules would have done. It is only as honest as the prices it fills at. Realistic backtesting means pricing each historical fill the way the market would actually have priced it — on the right side of the book, at a spread that existed at that moment — rather than at the midpoint of a chart or at a cost that was guessed once and applied to every trade.
It does not mean a backtest becomes a forecast, or that it matches a live account to the cent. It means one large, systematic source of optimism is measured instead of assumed. How much that matters depends on the strategy: for a swing trade with a wide stop, very little; for a scalp with a stop a few points away, it can be the difference between an edge and a loss.
Bid, ask and spread
At any moment a market has two prices. The bid is the best price someone will pay you, so it is what you receive when you sell. The ask is the best price someone will sell to you, so it is what you pay when you buy. The spread is the ask minus the bid — the cost of crossing from one side to the other, paid once on every round trip.
Most charts, including Sage's, draw the bid. That is why a long trade shows a small loss the moment it opens: it was bought at the ask and is valued at the bid. The spread is not a fee printed on a statement, so it is easy to forget — and a backtest that forgets it quietly hands every trade a discount it would never get live.
How spread affects entries, exits, stops and targets
Every order is either a buy or a sell, so every order trades on one side of the book. A long position is opened with a buy and closed with a sell; a short is the reverse. That decides which price each level is judged against:
| Order | Long position | Short position |
|---|---|---|
| Market entry | Fills at the ask (bid + spread) | Fills at the bid |
| Limit entry | Fills when the ask reaches it | Fills when the bid reaches it |
| Stop loss | A sell — triggers on the bid | A buy — triggers on the ask |
| Take profit | A sell — triggers on the bid | A buy — triggers on the ask |
| Close at market | Receives the bid | Pays the ask |
The consequence is lopsided in a way that matters. On a bid chart, a short's stop can be hit while the drawn candle stops short of the line, because the ask above it reached the level. A short's target needs the drawn candle to travel a spread past the line before the ask gets there. A long pays the spread up front, at entry. None of this is visible if the backtest treats the chart line as the price.
Fixed spread vs historical spread
The usual fix is one fixed spread for the whole test. It is far better than none, and it is still wrong in a specific way: the quoted spread is not a constant. It changes through the day, it widens sharply around the daily rollover and around news, and it drifts over months and years as conditions change.
In Sage's stored gold (XAUUSD) data for 12 March 2025, the quoted spread had a median of 0.53, and eight minutes in ten sat between 0.45 and 0.64. At 20:59 UTC, around the daily rollover, it reached 2.00 — nearly four times the median. On 7 February 2024 the same instrument's median was 0.31. A single fixed number chosen for a test covering both days would be too generous on one and too harsh on the other, and wrong by the most at exactly the minutes when spread is widest.
| Fixed spread | Historical spread | |
|---|---|---|
| Where the number comes from | Chosen once for the whole test | The quote recorded for each minute |
| Rollover and news widening | Missed | Charged when it was quoted |
| Changes across months and years | Missed | Follows the data |
| Your broker's markup | Can be matched deliberately | Not included — it is the data provider's quote |
| Best used for | Matching a known broker cost, stress tests | Seeing costs as they varied in the data |
The two are not rivals. Historical spread shows how cost varied; a fixed spread lets you model a particular broker or ask "what if it were always this bad?". Sage lets a session use either, and replaying the same dates both ways is a quick way to see how sensitive a result is to cost.
A worked example
Take a short on gold, sold at a bid of 2,912.00, with a stop 3.00 above and a target 6.00 below — 2R on the chart. Both exits are buy orders, so both trigger on the ask:
Spread charged 0.20 fixed 0.53 median 2.00 at rollover Stop fires at bid 2,914.80 2,914.47 2,913.00 Bid rise to stop 2.80 2.47 1.00 Target fills at bid 2,905.80 2,905.47 2,904.00 Bid fall to target 6.20 6.53 8.00 Illustrative trade. Spreads: Sage's stored XAUUSD data, 12 March 2025.
The trade is still 1R lost or 2R won — the levels did not move. What moved is how far the drawn price has to travel to reach them. With the day's median spread the stop is about 18% closer and the target about 9% further away than the chart suggests; in the minutes around rollover, a 1.00 rise in the bid is enough to stop the trade out. A long is the mirror image: it pays the spread at entry, so its stop is effectively nearer and its target further away by the same amount.
Why it matters most for short-term strategies
Spread is a fixed cost per trade, but risk is not. The tighter the stop, the larger the share of it the spread consumes — which is why lower-timeframe and scalping strategies are the most exposed to an unrealistic cost model, and why they can look best in a backtest that ignores it:
| Stop distance (XAUUSD) | Spread 0.20 | Spread 0.53 | Spread 2.00 |
|---|---|---|---|
| 1.00 | 20% of risk | 53% of risk | 200% of risk |
| 3.00 | 7% of risk | 18% of risk | 67% of risk |
| 10.00 | 2% of risk | 5% of risk | 20% of risk |
A strategy that trades around the open, the close or scheduled releases is doubly exposed, because those are the hours when spread moves most. Measuring your results by hour and by session — which Edge Lab does on backtest sessions and on your live journal alike — is how you find out whether an attractive hour is still attractive after costs.
How Sage handles historical execution
- Bid candles, a stored spread per minute. Sage stores bid candles and, for each 1-minute candle, the ask price at that minute's close. The difference is that minute's spread, and the ask side of the candle is taken as the bid plus it.
- Fills inside the bar. Orders, stops and targets are judged on bars finer than the candle you are viewing — 1-minute bars when you replay on 1 minute, and never coarser than 5 minutes for any step up to 4 hours. Each of those bars carries the spread quoted at its close.
- Touch means filled. A level fills when its side of the book trades at it. If price gaps straight past a level between bars, it fills at the first price that existed after the gap, so a gapped stop can lose more than 1R, as it can live.
- Conservative when unsure. When one bar spans both the stop and the target, the stop is taken first.
- A fallback that is never free. Where no spread was stored for a minute, the session's fixed spread is charged and the workspace shows it — a minute with no data is not treated as a minute with no cost.
- Real spread is the default for a new session, and the session form shows which dates have spread history for the instrument. Crypto history in Sage has no ask side, so crypto sessions use a fixed spread.
What it does not model
Historical bid/ask data removes one assumption. It does not reproduce live trading, and it is worth being exact about what is still missing:
- Slippage beyond the spread. Fills happen at your level (or at the first price after a gap); there is no extra slippage on fast markets.
- Commissions, swaps and financing. Not charged in a replay. If your account pays commission per lot, results are optimistic by that amount.
- Latency, liquidity and market impact. Every order is filled in full at the quoted price, with no queue, no partial fills and no effect on the market.
- Spread inside a minute. The spread is recorded once per minute, at its close; a spike that came and went within a minute is not seen.
- Your broker's quotes. The spread is the data provider's, not your broker's. Brokers add markups or charge commission instead, so use a custom spread when you know yours.
How it works
How a trader actually uses it.
- 01
Create a session with Real spread
Pick the instrument and dates. Real spread is selected by default and the form shows which dates have spread history; choose Custom to enter your broker's number instead.
- 02
Replay and trade as you normally would
Step candle by candle and place market or limit orders with a stop and target. The ask line moves with the quoted spread, and fills, stops and targets resolve on the side of the book they trade on.
- 03
Read the result with the cost inside it
Every trade is journaled in R with the spread already paid, so the equity curve, win rate and expectancy are the after-spread numbers — nothing to subtract later.
- 04
Check how much the cost mattered
Replay the same dates with a fixed or wider spread, or add spread and slippage in the R:R simulator, and see how much of the result survives. An edge that disappears at a slightly worse cost was never much of one.
What it is, and isn't
Straight about the limits.
It does
- ✓Charge the spread recorded for each minute, on forex, gold, silver, oil and major indices where history exists
- ✓Fill buys at the ask and sells at the bid, and trigger each stop and target on its own side of the book
- ✓Resolve fills inside the bar on 1- to 5-minute data for steps up to 4 hours, with gaps filled at the first price after the gap
- ✓Show whether each fill paid the real spread or your fixed fallback
It doesn't
- ✕Guarantee that a backtest will match live results — it is still a model of the past
- ✕Model slippage beyond the spread, latency, liquidity, partial fills or market impact
- ✕Charge commissions, swaps or financing in a replay
- ✕Reproduce your broker's own quotes — the spread is the data provider's, so set a custom one to match yours
Realistic Backtesting, answered.
- What is realistic backtesting?
- Backtesting in which historical trades are priced the way the market would have priced them: buys at the ask, sells at the bid, with the spread that was quoted at the time rather than one assumed figure. It makes results more representative of the conditions in the data. It does not make a backtest identical to live trading.
- What are bid and ask prices?
- The bid is the best price a buyer will pay, so it is what you receive when you sell. The ask is the best price a seller will accept, so it is what you pay when you buy. The spread is the ask minus the bid. Most charts, including Sage's, draw the bid.
- Why does spread matter in backtesting?
- Because every round trip pays it, and it is a larger share of risk the tighter the stop. On gold, a 0.53 spread is 5% of a 10.00 stop but 53% of a 1.00 stop. A backtest that ignores spread flatters tight-stop and short-timeframe strategies the most.
- Does Sage use historical bid/ask data?
- Yes, for instruments whose data provider publishes ask prices — forex, gold, silver, oil and major indices. Sage stores bid candles and the spread for every 1-minute candle, taken at that minute's close. Crypto history has no ask side in Sage, so crypto sessions use a fixed spread.
- Does realistic spread affect stop losses and take profits?
- Yes. A long's stop and target trigger on the bid. A short's trigger on the ask, one spread above the chart, so a short can be stopped out by the ask while the drawn candle never touched the line, and its target needs price to travel a spread beyond it.
- Is historical bid/ask backtesting better than using a fixed spread?
- It captures what a fixed spread cannot: widening around the daily rollover and news, and drift over months and years. A fixed spread is still useful for matching a particular broker or for stress tests, which is why Sage offers both. Replaying the same dates both ways shows how sensitive a result is to cost.
- Does realistic backtesting guarantee live trading results?
- No. It removes one optimistic assumption; others remain. Sage does not model slippage beyond the spread, commissions, latency, liquidity or market impact, and the spread is the data provider's, not your broker's. A backtest is evidence about the past, not a forecast.
Keep going
- FeatureBacktesting & Market ReplayBacktest a discretionary strategy the honest way: a full TradingView workspace paused at your cursor, no lookahead on any of 16 timeframes, intrabar fills on the historical bid/ask spread, trades you place in the moment, and an exact R:R simulator. Free.
- FeatureTrading Analytics & Edge AnalysisTrading performance analytics that read what your journal recorded: expectancy by setup, session and tag with confidence intervals, an exact R:R simulator on real 1-minute price paths, Sharpe, Sortino, SQN, Kelly, drawdown and Monte Carlo ruin probability. Free.
- FeatureProp Firm TrackerTrack a prop-firm challenge against the rules as firms measure them: daily loss with the firm's day reset, static or trailing max loss, profit target and minimum trading days. Distance to every limit before the next trade, every attempt kept with its cause. Free.
- GuideHow to backtest a trading strategy without fooling yourselfA step-by-step method for manual backtesting: write the rules first, replay candle by candle with no lookahead, keep an out-of-sample stretch, measure in R and know when the sample is big enough.
- GuidePosition sizing: size the trade from the risk, never the other way roundThe one formula that decides your survival: units = money at risk ÷ stop distance. Worked examples for forex, gold and indices, why fixed-fractional beats fixed lots, and how sizing interacts with prop-firm limits.
- GuideRisk/reward ratio and R-multiples, explainedWhat a risk-to-reward ratio really tells you, how R-multiples make every trade comparable, the break-even win rate for any ratio, and why 'would 3R have paid?' needs the real price path to answer.
- ConceptTrading sessionForex trades around the clock, but not evenly. What the London, New York and Asian sessions are, what the overlap changes, why session times are a timezone problem before they are a trading one, and how to check which hours your own record actually rewards.
See every module on the features overview.
Try realistic backtesting on your own trades.
Create your workspace in ten seconds. Everything on this page is free, with no card and no paid tier.
Free · no card · your data stays yours