A backtest can assume the same spread at every entry and exit, or price each order from the Bid and Ask available at that moment. We replay the same scheduled EUR/USD positions both ways. The charts show how the spread varies around the chosen trade times and which quotes enter the calculation.
In simple terms
Keep the entry and exit timestamps identical when you compare spread models. Use Ask to buy and Bid to sell. Measure the spread at both endpoints and check how much the result changes across plausible assumptions.
On this page01
Start with a two-sided quote
Bid is the quoted price for selling and Ask is the quoted price for buying. The spread is Ask minus Bid at the same quote. For EUR/USD, 1 pip equals 0.0001 USD per EUR. A fifth decimal place represents a tenth of a pip.
02
Set up a paired test
We use the HistData.com EUR/USD tick archive from 8 to 11 July 2024. We schedule two positions per day, at 14:00–14:05 UTC and 20:58–21:03 UTC. Both are long on 8 and 10 July and short on 9 and 11 July. The direction and times are set in advance for the comparison.
03
Separate the decision time from the quote time
Normalize the archive's time convention, UTC−5, to UTC. Use the first valid quote at or after each scheduled time, with a maximum wait of 60 seconds. Preserve the archive order if multiple quotes share a timestamp. If either endpoint is unavailable within the limit, drop that position from both calculations. Store the actual quote time and the wait.
04
Price the same position twice
For a long, enter at Ask and exit at Bid. For a short, enter at Bid and exit at Ask. For the fixed case, keep each observed midpoint and place the Bid and Ask 0.5 pip on either side. The resulting spread is 1 pip at each endpoint.
05
Read the midpoint charts
A midpoint is the average of Bid and Ask. Each M1 candle is built from the midpoints of the archived quotes within that UTC minute. A midpoint shows price movement on a common reference. The modeled buy and sell prices are selected separately. Empty minutes remain empty.
EUR/USD midpoint candles at both times
EUR/USD · 2024-07-08 UTC · HistData.com
1 Entry2 Exit
14:00–14:05 UTC
Open
1.084340
High
1.084340
Low
1.084285
Close
1.084300
Quotes
72
Status
Archived quotes
20:58–21:03 UTC
Open
1.082460
High
1.082460
Low
1.082445
Close
1.082450
Quotes
7
Status
Archived quotes
Each candle uses the midpoints of the quotes in one UTC minute. Entry and exit refer to the selected quote times.06
Measure the spread within each minute
Compute Ask minus Bid for every quote before grouping those values into M1 candles. The spread charts share a vertical scale and show the fixed 1-pip reference as a dashed line. The largest spread in a candle describes one observed quote. The spread cost of a position comes from the quotes used for its entry and exit.
Observed spread compared with a fixed 1 pip
EUR/USD · 2024-07-08 UTC · HistData.com
1 Entry2 Exit
Fixed 1 pip
14:00–14:05 UTC
Open
0.20
High
0.30
Low
0.10
Close
0.20
Quotes
72
Status
Archived quotes
20:58–21:03 UTC
Open
0.20
High
0.20
Low
0.10
Close
0.20
Quotes
7
Status
Archived quotes
Both charts use the same pip scale. The dashed line marks the fixed comparator. A gap in the candles means there was no quote in that minute.07
Inspect the quotes used at exit
The quote charts show the surrounding Bid and Ask observations in archive order. The highlighted dots identify the recorded exit Bid and Ask. The fixed model derives its exit prices from their midpoint using its fixed spread. Tick spacing in these charts follows sequence order. Read the timestamp to measure elapsed time.
Bid and Ask around the selected exit
EUR/USD · 2024-07-08 UTC · HistData.com
BidAsk
14:00–14:05 UTC
Bid
1.084330
Ask
1.084350
Midpoint
1.084340
20:58–21:03 UTC
Bid
1.082450
Ask
1.082470
Midpoint
1.082460
The horizontal positions follow quote order. The highlighted Bid and Ask belong to the same timestamp.08
Split price movement from spread cost
Measure the midpoint change in pips in the position's direction. Subtract half of the entry spread and half of the exit spread. The quoted result is the same as calculating directly from the appropriate Bid and Ask. With a 1-pip spread at each end the total spread cost is 1 pip.
m = (Bid + Ask) ÷ 2 s = (Ask − Bid) ÷ 0.0001 P = q × (m₂ − m₁) ÷ 0.0001 − (s₁ + s₂) ÷ 2
q = +1 Long · q = −1 Short
09
Walk through two positions
The examples use both scheduled positions from the first date, 8 July 2024. Each card gives the entry and exit quote times, the two observed spreads and the modeled results. A wider observed spread at either endpoint increases its half-spread charge.
Two matched positions on the first date
EUR/USD · 2024-07-08 UTC · HistData.com
14:00–14:05 UTC · Long
Entry
Scheduled time (UTC)
14:00:00
Quote time (UTC)
14:00:00.091
Wait (ms)
91
Entry spread (pips)
0.10
Exit
Scheduled time (UTC)
14:05:00
Quote time (UTC)
14:05:01.181
Wait (ms)
1,181
Exit spread (pips)
0.20
Midpoint move (pips)
−0.45
Observed spread cost (pips)
0.15
Fixed-spread result (pips)
−1.45
Observed-spread result (pips)
−0.60
Observed minus fixed (pips)
+0.85
20:58–21:03 UTC · Long
Entry
Scheduled time (UTC)
20:58:00
Quote time (UTC)
20:58:00.982
Wait (ms)
982
Entry spread (pips)
0.20
Exit
Scheduled time (UTC)
21:03:00
Quote time (UTC)
21:03:19.308
Wait (ms)
19,308
Exit spread (pips)
0.20
Midpoint move (pips)
−0.50
Observed spread cost (pips)
0.20
Fixed-spread result (pips)
−1.50
Observed-spread result (pips)
−0.70
Observed minus fixed (pips)
+0.80
Both models use the same quote timestamps and direction. The observed model takes spread costs from the archived Bid and Ask. The fixed model uses a 1-pip spread.10
Compare the full sample
We priced 8 of 8 scheduled positions in both models. The fixed-spread total was −14.55 pips and the total using observed Bid and Ask was −7.90 pips. Observed minus fixed was +6.65 pips. The results isolate quoted spread and midpoint movement. Commissions, slippage and overnight adjustments are outside this calculation.
Paired results by time window
14:00–14:05 UTC
Matched positions
4
Fixed-spread result (pips)
−9.90
Observed-spread result (pips)
−6.50
Observed minus fixed (pips)
+3.40
20:58–21:03 UTC
Matched positions
4
Fixed-spread result (pips)
−4.65
Observed-spread result (pips)
−1.40
Observed minus fixed (pips)
+3.25
All matched positions
Matched positions
8
Fixed-spread result (pips)
−14.55
Observed-spread result (pips)
−7.90
Observed minus fixed (pips)
+6.65
The figures show summed pips across equal-size modeled positions. The observed model uses the recorded Bid and Ask at both endpoints.11
Test other fixed assumptions
The sensitivity cards repeat the same positions at 0.5, 1.0, 1.5 and 2.0 pips of fixed spread. A change of 0.5 pip changes each priced position's result by 0.5 pip. The observed-spread case uses the recorded endpoint spreads and stays tied to their quote times.
Sensitivity to a fixed spread
Fixed spread (pips) · 0.5
Fixed-spread result (pips)
−10.55
Fixed spread (pips) · 1.0
Fixed-spread result (pips)
−14.55
Fixed spread (pips) · 1.5
Fixed-spread result (pips)
−18.55
Fixed spread (pips) · 2.0
Fixed-spread result (pips)
−22.55
Only the fixed spread changes across these scenarios. The positions and midpoint moves stay the same.12
Interpret the rollover window
Dukascopy documents daily settlement at 21:00 or 22:00 GMT depending on the season. The July window from 20:58 to 21:03 UTC spans Dukascopy’s summer reference time. Its quotes come from the HistData.com archive. Review the actual quote timestamps and spreads within it. A broker's trading hours and swap terms can differ from this feed.
13
Check your tester settings
Record which feed and tick mode your platform uses. MetaTrader 5 documents how its tester obtains spread from historical data. If a backtest starts from one-sided bars, specify how you modeled the other side. Write down the assumptions for market orders, stops and gaps.
14
Keep other execution costs separate
A quote is the price used by the model. Actual fills can depend on order size, latency, depth and available liquidity. Include commission, slippage and any applicable financing as separate inputs when they belong in your test.
15
Reproduce the arithmetic from the data
The JSON records the source archive URLs and checksums, the selected quotes and the calculation inputs. Replay the quote selection, compute the two half-spreads and use full input precision. Round results for display after summing the positions.
16
Review the assumptions before comparing strategies
Show which positions matched both scenarios and how the quotes were timed. Check spread by window, record any skipped positions, and compare fixed sensitivity with the observed spread. Treat these four dates as one documented sample.
Frequently asked questions
What is the difference between fixed and variable spread in a backtest?
A fixed model assigns one spread across the positions. A variable model can use the Bid and Ask recorded at each matched entry and exit.
Does a 1-pip spread charge 2 pips for entry and exit?
Against the midpoint it charges 0.5 pip at entry and 0.5 pip at exit. With 1 pip at both endpoints that adds up to 1 pip.
Can I calculate a spread candle from separate Bid and Ask candle highs?
Calculate the spread from each simultaneous quote and aggregate it. Separate candle highs can come from different times.
Why might the observed model do better than the fixed one?
If the two observed half-spreads sum to less than the fixed spread, the modeled spread cost is lower for that position.
Why use the same quote times in both cases?
Matching times and direction holds the midpoint move constant, so differences in the modeled result come from the spread assumption.
Can these results tell me what my broker will fill?
The calculation uses archived quotes from one feed. Check your broker's quotes, execution conditions and costs for your own test.