MKT Market Microstructure
The hidden costs that make or break strategies
Learning Objectives
- •Understand bid-ask spreads, order books, and how prices form
- •See how slippage and market impact eat into real performance
- •Quantify execution costs and figure out if they kill your edge
- •Know which timeframe-asset combos actually work for systematic trading
Explain Like I'm 5
When you buy something at a store, there's one price tag. In financial markets, there are always two prices: what buyers will pay (bid) and what sellers want (ask). The gap between them is a cost you pay on every trade. Understanding this cost tells you which strategies work in practice versus only on paper.
Think of It This Way
The order book is like a farmers' market. Sellers display their asking prices on one side, buyers show what they'll pay on the other. The "market price" is where the last deal happened. A busy market has tight spreads (lots of competition). A quiet market has wide spreads and higher costs.
1Bid, Ask, and the Spread
Typical Spread Cost by Asset Class (% of ATR)
2Slippage and Market Impact
3Timeframe Selection and Strategy Viability
Edge vs Cost by Trading Frequency
Key Formulas
Spread Cost in R-Multiples
Converts spread from pips to R-multiples. A 1-pip spread with a 50-pip stop = 0.02R per trade. Over thousands of trades, that adds up fast.
Net Edge After Costs
Your true edge is gross expected value minus all execution costs. If E_net ≤ 0, the strategy is a backtest artifact that will lose money live.
Hands-On Code
Quantifying Execution Cost Impact
import numpy as np
# --- Execution Cost Analysis ---
gross_edge_r = 0.25 # Gross edge per trade (R)
spread_pips = 0.3 # Typical EUR/USD spread
avg_stop_pips = 45 # Average stop-loss distance
slippage_pips = 0.2 # Conservative estimate
commission_r = 0.005 # Commission as fraction of R
# Convert to R-multiples
spread_r = spread_pips / avg_stop_pips
slippage_r = slippage_pips / avg_stop_pips
total_cost = spread_r + slippage_r + commission_r
net_edge = gross_edge_r - total_cost
print("=== Execution Cost Breakdown ===")
print(f"Gross E[R]: {gross_edge_r:+.4f}R")
print(f"Spread: -{spread_r:.4f}R")
print(f"Slippage: -{slippage_r:.4f}R")
print(f"Commission: -{commission_r:.4f}R")
print(f"Total cost: -{total_cost:.4f}R")
print(f"Net E[R]: {net_edge:+.4f}R")
print(f"Cost / Edge: {total_cost/gross_edge_r*100:.1f}%")
# Annual impact
n_trades = 600
print(f"\nAnnual cost drag: {total_cost * n_trades:.1f}R")This converts all execution costs into R-multiples and shows how much they eat into your edge. Many strategies that look great in frictionless backtests become losers with realistic costs. Always compute net edge.
Knowledge Check
Q1.When you place a market buy order, at which price are you filled?
Q2.Why is M15–H1 considered the sweet spot for ML-based trading?
Assignment
Research current spreads for 5 instruments across different asset classes. For each, compute the spread cost in R assuming a stop loss of 1.5× ATR(14). Rank instruments by cost efficiency. Which ones offer the best structure for systematic trading? Document your methodology and findings.