Early access is open. Free sample datasets are live now. Download a sample

Learn

Using Forex Tick Data for Backtesting

8 min read · Updated 19 November 2026 · By the marketdata.co data team

Bar data hides the order of events inside each bar. For a strategy with tight stops or targets, that order decides whether a trade won or lost. Tick data with bid and ask restores it, and lets you fill longs at the ask and shorts at the bid the way a real account does.

Details

What tick data fixes

An FX tick in our FX-TICK schema is one quote update:

symbol, timestamp, bid, ask, mid, bid_size, ask_size, source, received_timestamp

There is no exchange in spot FX, so a "tick" is a quote from a liquidity provider or aggregator, not a trade. That has two consequences. Prices differ a little between sources, and there is no true volume. What you do get is the real spread at every moment, which is what bar backtests guess at.

The stop-and-target problem (illustrative numbers)

Say you are long EURUSD from 1.08500 with a stop at 1.08420 and a target at 1.08600. One 1-minute bar prints:

open high low close
1.08510 1.08605 1.08415 1.08560

Both the stop and the target sit inside the bar's range. A bar backtest has to guess which came first. Most engines either assume the best case (target hit, +10 pips) or the worst case (stopped, -8 pips). That one guess is an 18-pip swing on a single trade.

Ticks remove the guess. They also show that your stop is a sell order, so it triggers when the bid reaches 1.08420, not when the mid does. If the bar high of 1.08605 was a mid price with a 0.4 pip spread, the bid only reached about 1.08603. The target still fills, but by a smaller margin than the bar suggests.

Code

Replay ticks in Python

The loop below walks ticks in time order and checks the stop and target against the correct side of the quote. It is slow on large files but easy to read and hard to get wrong.

"""Example: tick replay for one long trade with stop and target."""
import pandas as pd

ticks = pd.read_csv("eurusd_ticks.csv", parse_dates=["timestamp"])
ticks = ticks.sort_values("timestamp")

entry_time = pd.Timestamp("2026-10-14T13:30:05Z")  # illustrative
stop, target = 1.08420, 1.08600

after = ticks[ticks["timestamp"] >= entry_time]
entry_price = after.iloc[0]["ask"]  # a long buys at the ask

for row in after.itertuples():
    if row.bid <= stop:  # a long exits by selling at the bid
        result = ("stop", row.timestamp, row.bid)
        break
    if row.bid >= target:
        result = ("target", row.timestamp, row.bid)
        break
else:
    result = ("open", None, None)

pips = (result[2] - entry_price) / 0.0001 if result[2] else None
print(result, "pips:", round(pips, 1) if pips is not None else None)

Read the result as the exit reason, the exit time and the exit price on the bid. Compare it with what your bar backtest reported for the same trade. If the two disagree on more than a small share of trades, your bar results are not reliable for this strategy. To speed things up on months of data, vectorise the search with numpy.argmax on boolean arrays, or convert to Parquet first.

Watch out

Common mistakes

Using mid ticks for fills. Mid is useful for signals, but you can't trade at it. Fill longs at the ask, shorts at the bid, and exits on the opposite side.

Ignoring latency. A signal computed on a tick can't be filled on that same tick. Add at least one tick, or a fixed delay like 50 to 200 milliseconds, between signal and fill. received_timestamp helps you model it.

Mixing tick sources. Two providers quote slightly different prices and spreads. A backtest built on one and traded through another will drift. Test with data close to where you execute.

Running on too short a sample. Tick files are large, so people test one month. One month can be a single volatility regime. Cover at least a quiet period, a trending period and several major data releases.

Skipping rollover and weekend gaps. Spreads blow out around 17:00 New York time and at the Sunday open. Make sure the replay sees those spreads instead of filtering them out as bad ticks.

Details

Get the data

FX ticks with bid and ask. What you'll get: one row per quote update, UTC timestamps, bid, ask, mid, sizes where the source provides them, and received_timestamp for latency work.

  • Forex tick data, available in early access. Suggested price: $3 per pair per month; a full year of the 28 majors for $599.
  • Pro ($79/mo) is planned to include one year of tick history by API.
  • A free FX tick sample is available on request.

FAQ

Frequently asked questions

Do I need tick data to backtest forex strategies?

You need it when stops and targets are close together or when a strategy trades often enough that spread costs matter. For swing strategies with wide stops held for days, 1-minute bars with bid and ask are usually enough.

Is forex tick data the same as trade data?

No. Spot FX has no central exchange, so FX ticks are quote updates from liquidity providers. You get bid and ask prices but no true trade volume.

Which side of the quote should a backtest fill on?

Buy orders fill at the ask and sell orders fill at the bid. A stop on a long position is a sell, so it triggers on the bid.

How large are forex tick files?

They are large. A busy major pair can produce millions of quote updates a month. Store them as Parquet or compressed CSV and load one month at a time.

Keep reading