BACKTESTMARKET
Mid Price vs Bid and Ask: What Each One Means
backtesting·

Mid Price vs Bid and Ask: What Each One Means

Mid price vs bid and ask explained with worked examples: how to calculate the midpoint, why you can't count on a fill there, and what it means for backtests.

By BacktestMarket Team
mid price vs bid ask

Analyst reviewing bid and ask quotes

The bid is the highest price a buyer will pay right now. The ask is the lowest price a seller will accept. The mid price is the average of the two, a reference point that sits exactly halfway between them. You can buy at the ask and sell at the bid. The mid price is usually a number you measure against, not one you trade at.

That difference sounds small. It decides how you read a quote, how you judge an execution, and how honest a backtest is. This guide covers the formulas, worked examples, the cases where the midpoint can be traded, and what it means for historical data.

TL;DR

  • Bid is what you receive when you sell. Ask (also called the offer) is what you pay when you buy. The ask is almost always higher than the bid.
  • Mid price = (bid + ask) ÷ 2. It is a benchmark for fair value and execution quality, not a standard fill price.
  • Spread = ask − bid. It is the cost of crossing the market, and the mid price sits half a spread from each side.
  • A backtest that fills at the mid price removes the spread from every trade, so results look better than live trading will deliver.
  • Know which price your historical data records (bid, ask or mid) before you trust any result built on it.

Table of Contents

Bid, ask and mid price in one table

TermWhat it isWho uses itCan you trade at it?
BidHighest price a buyer will currently paySellers, who hit itYes, when you sell with a market order
Ask (offer)Lowest price a seller will currently acceptBuyers, who lift itYes, when you buy with a market order
Mid priceAverage of best bid and best askAnalysts, execution desks, model buildersOnly through specific midpoint order types
SpreadAsk minus bidEveryone who pays transaction costsNot a price, it is a cost

The SEC's investor education site defines the bid and ask prices in exactly these terms: the bid is the highest price a buyer will pay for a stated number of shares, and the ask is the lowest price at which a seller will sell. The SEC also notes that the ask, also called the offer, will almost always be higher than the bid.

How bid and ask work

Every liquid market is a continuous negotiation. Buyers post the prices they will pay. Sellers post the prices they will accept. The best of each, the highest bid and the lowest ask, forms the top of the order book.

If you send a market order to buy, you take the ask. If you send a market order to sell, you take the bid. If you want a better price, you place a limit order and wait for someone to come to you.

The gap between the two sides exists because buyers and sellers value the asset differently at any given moment. A tight gap usually signals an active, liquid market. Investopedia's explanation of bid and ask prices notes that tighter spreads typically reflect high trading activity and liquidity, while wider spreads suggest volatility.

Quick example with a stock

Suppose a stock shows a bid of $49.98 and an ask of $50.02.

  • You buy 100 shares at market: you pay $50.02 each.
  • You sell 100 shares at market: you receive $49.98 each.
  • Buying and immediately selling costs you $0.04 per share, or $4 on 100 shares, before commissions.

That $0.04 is the spread. It is the price of immediacy.

How to calculate the mid price

The formula is simple:

Mid price = (bid + ask) ÷ 2

Using the stock above: (49.98 + 50.02) ÷ 2 = $50.00.

The spread is the other half of the picture:

Spread = ask − bid, so 50.02 − 49.98 = $0.04.

The mid price is exactly one half-spread ($0.02) from each side. That relationship is why the mid price is so useful as a yardstick: it is the point from which buyers and sellers each pay the same cost.

Bid, ask, midpoint, and spread comparison

A forex example

In currency markets, the same number is often called the middle rate or mid-market rate. Investopedia's page on the middle rate in FX trading gives this example: if EUR/USD has a bid of 1.1920 and an offer of 1.1930, the middle rate is 1.1925.

The spread there is 0.0010, or 10 pips on a five-decimal quote. If you buy at 1.1930 and sell back at 1.1920 with no market move, you lose those 10 pips. Anyone who quotes you the 1.1925 mid-market rate and then trades you at one of the sides is charging you half the spread.

A spread in percentage terms

Spreads are often compared as percentages. Investopedia's guide to how the bid-ask spread works shows a stock with a $19 bid and a $20 ask: a $1 spread, or 5% when divided by the ask. Percentages let you compare a $5 stock with a $500 stock on equal terms.

Edge cases when the spread is tiny

The mid price does not always land on a tradable price increment. If a stock bids $10.00 and asks $10.01, the spread is one cent and the mid price is $10.005, a half-cent that no ordinary order can sit on. Trading venues handle this differently, and some round the midpoint to the nearest tick. If you compute mid prices in code, keep the half-tick rather than rounding it away, because rounding quietly shifts your results.

A few other cases need care:

  • One-sided quotes: if there is a bid but no ask, there is no meaningful mid price.
  • Locked or crossed markets: when bid equals ask the market is locked, and when the bid is above the ask it is crossed. Both are brief anomalies, and a mid price computed from them says little.
  • Stale quotes: a mid price from a quote that has not updated is just an old number.

Mid price vs bid and ask: the real differences

Tradability

Bid and ask are prices where someone has actually committed to transact. The mid price is a calculation. In an ordinary book, nobody is posting an order at the midpoint, so a market order cannot fill there. Your market buy fills at the ask or higher, and your market sell fills at the bid or lower.

What each one tells you

  • Bid and ask tell you what trading right now costs in each direction.
  • Mid price estimates the market's central view of value before transaction costs.
  • Spread tells you how much of that cost you pay for crossing.

Where the mid price is used

The midpoint is the standard benchmark for judging execution. The effective spread, as Investopedia describes it in its bid-ask spread guide, is the difference between a market order's execution price and the midpoint of the bid-ask spread. It can be a more accurate picture of the true cost of trading than the quoted spread, especially in liquid markets.

Price improvement is measured the same way. A buy that fills below the offer, or a sell that fills above the bid, has received improvement relative to the quote.

Can you actually trade at the mid price?

Sometimes, but only through specific mechanisms, and never with a guarantee.

Midpoint orders

Some venues offer order types pegged to the midpoint of the best bid and offer. In U.S. equities that reference is the National Best Bid and Offer (NBBO). Nasdaq's factsheet on its Midpoint Peg Post-Only order describes a non-displayed order priced at the NBBO midpoint that generally adds liquidity. For prices above one dollar, the factsheet says a cross by $0.0050 will execute, because the realized price improvement exceeds the fees involved.

The key words are non-displayed and pegged. Nobody sees your order, and it fills only when a counterparty arrives who is willing to trade at that midpoint. If nobody does, it sits unfilled while the market moves away.

A worked example: the NBBO is $19.80 bid and $20.20 offer, so the midpoint is $20.00. A buyer with a midpoint order saves $0.20 versus lifting the offer. A seller with a midpoint order receives $0.20 more than hitting the bid. Both sides split the spread, which is why midpoint matching appeals to them. The catch is the fill: it may come late, partially, or not at all.

Midpoint orders

Midpoint trading on exchanges

This is not only a U.S. feature. The Vienna Stock Exchange, for instance, offers midpoint trading during continuous trading for eligible instruments, executing midpoint orders at the midpoint of the central order book's best bid and ask, with a separate unpublished midpoint order book.

Working a limit order between the bid and ask

Retail traders, especially in options, often place a limit order between the bid and ask hoping to get filled. This does sometimes work, because market makers can accept a price inside their own quote, particularly in wide-spread contracts. It works less often when the spread is already one tick wide, since there is no price inside it to offer.

A few practical points:

  • Wide spreads leave room for a limit order inside the market. One-tick spreads leave none.
  • A thin book with little size at the best price can move quickly against you if your order is larger than that size.
  • If you are not in a hurry, working an order toward the mid costs little to try. If you need the fill, crossing the spread is the price of certainty.

Is it better to sell at the bid or the ask?

This question shows up often, and it mixes up two things. You do not choose between them freely. A seller who wants an immediate fill takes the bid. A seller who is willing to wait can post a limit order at the ask or somewhere between, and a buyer may come to them. The same is true in reverse for buyers.

So the choice is really speed against price. Taking the bid buys speed. Posting at the ask buys a better price and the risk of no fill.

Why the mid price matters for backtesting

This is where the difference stops being theoretical. Every backtest assumes a fill price for each entry and exit. If the historical data records only one price per bar, the test has to decide what that price means.

If both entry and exit are filled at the mid price, the strategy never pays the spread. In live trading it pays roughly a full spread on every round trip, because you buy at the ask and sell at the bid. The error is small on one trade and large on thousands.

The arithmetic

Take EUR/USD with a 1.2-pip spread. One pip is 0.0001, so the spread is 0.00012. On a standard lot of 100,000 units that is $12 per round trip, before commission and slippage. A scalping strategy that makes 3,000 round trips a year carries about $36,000 of spread cost that a mid-price test never charges. A strategy with a small edge per trade can show a healthy equity curve in the test and a flat or negative one live.

The effect is largest for:

  • High-turnover and intraday strategies
  • Strategies with small average profit per trade
  • Instruments with wide or variable spreads, especially around news, rollover and illiquid sessions

What to check in your data

Before running a serious test, answer these questions:

  1. Which price is stored? Bid, ask, mid or last trade. Different platforms and data sources build bars from different sides.
  2. Is the spread recorded or assumed? A fixed assumed spread understates costs in volatile periods.
  3. Does the spread vary through the day? Spreads typically widen at rollover and during low-liquidity hours, so one number is a blunt tool.
  4. Are there gaps or bad ticks? A single corrupted bar can create a phantom trade that wins or loses unrealistically.
  5. Do you add commission and slippage separately? Spread is only one part of transaction costs.

Our own guides go deeper on these costs. See our article on transaction costs in backtesting for testing under different cost regimes, and the one on spread modeling for backtests for estimating spreads when your data does not record them.

Our perspective

We collect and maintain historical minute-bar data every day, so we see how often a small question about prices turns into a large error in results. The mid price is a good example. It is a clean, useful number for measuring things. It becomes a problem only when a test treats it as a price you could have traded.

Our position is simple. A backtest is only as honest as its inputs. That is why we put so much weight on clean bars, careful bar-by-bar verification, and documenting any adjustments, so you know what each number represents before you build a strategy on it. Whether you are checking a rule-based system by hand or running an AI-driven search across thousands of variants, a strict data standard matters more, because automated search finds and exploits every quirk in the data.

When you backtest, decide on purpose which side of the market your fills use, add a spread assumption that fits the instrument and the time of day, and stress the result with higher costs than you expect. If the edge survives that, it is far more likely to be real.

Start

Using clean data to test with realistic fills

Once you know which price your fills should use, the data has to support it. We sell one-time downloads of clean minute-bar historical data since 2014 across forex, metals, stock indices, bonds and commodities, built to import straight into MT4 and MT5. You can browse the full range on our historical data page.

If you prefer a subscription, the Annual Plan is €119 per year.

BTCUSD 1m

For the testing workflow itself, our guides on MT5 backtesting data and preparing MQL4 data with a gap audit walk through the steps. If you are weighing what to buy, see our overview of historical market data costs.

Common mistakes with mid price, bid and ask

  • Treating the mid price as an execution price. It is a benchmark. Your market orders fill at the bid or ask.
  • Comparing spreads in absolute terms across instruments. Use percentages or pips so a cheap and an expensive instrument are comparable.
  • Ignoring size. The quoted bid and ask apply to a limited quantity. A larger order can walk through several price levels and fill at worse prices.
  • Using a stale quote. A mid price from an old quote does not describe the market now.
  • Assuming one fixed spread. Spreads change with volatility, time of day and liquidity.
  • Ignoring the cost of waiting. A limit order at the mid price may save half a spread, but if the market runs away you pay far more.

FAQ

What is the difference between mid price and bid-ask spread?

The mid price is a price level, the average of the best bid and best ask. The bid-ask spread is a distance, the ask minus the bid. Both come from the same two quotes, and the mid price sits exactly half a spread from each side. For bid 1.4426 and ask 1.4430, the mid is 1.4428 and the spread is 0.0004.

Can you buy or sell at the mid price?

Not with an ordinary market order, which fills at the ask for buys and the bid for sells. Some venues offer midpoint peg orders that are priced at the midpoint of the best bid and offer. They are non-displayed and fill only if a counterparty trades at that price, so a fill is never guaranteed.

Is the mid price the same as the last traded price?

No. The last traded price is where the most recent trade happened, and it can sit at the bid, the ask or somewhere between. The mid price is calculated from current quotes and can change even when no trade occurs. In a fast market the two can differ noticeably.

Should a backtest use bid, ask or mid prices?

The most realistic approach is to buy at the ask and sell at the bid, or to use mid prices and subtract a realistic spread on every trade. Using the mid price for both sides with no cost removes the spread entirely and flatters the results. Add commission and slippage on top, and test with costs higher than you expect.

Why is the ask always higher than the bid?

If a buyer were willing to pay more than a seller asked, the two orders would match and trade immediately. So in a working market the best bid stays below the best ask. When the two are equal the market is locked, and when the bid is higher it is crossed. Both are brief, abnormal states.

Sources

Recommended

Related resources

Explore BacktestMarket's historical data packs to put the ideas in this article into practice.

Newsletter

Stay updated

New datasets, expert advisors, discounts, and trading insights — straight to your inbox.

Cart

Your cart is empty

Add some products to get started.