How to properly backtest your own forex scalping strategy?
Posted: Mon Aug 03, 2026 2:46 pm
Hi all,
the most sophisticated way to simulate high-frequency trading (HFT) and scalping strategies in Forex is using a Discrete Event Simulation (DES) with a Limit Order Book (LOB) reconstruction.
Standard backtesting tools (like MetaTrader or simple Python libraries using OHLCV bars) fail for scalping because they cannot accurately model the three biggest realities of micro-trading: latency, slippage, and queue position.
Here is a breakdown of what makes an advanced simulation, followed by a Python framework to get you started.
The Anatomy of an Advanced Simulation
To realistically simulate forex scalping, your engine must model:
Market-By-Order (MBO) Data: You need Level 3 (or at least tick-by-tick Level 2) order book data, not just bid/ask spreads.
Order Queue Position: If you place a limit order at the bid, you don't get filled just because a market sell order hits that price. You get filled when all the orders ahead of you in the queue are filled or canceled.
Network Latency: The delay between your algorithm seeing an event and your order reaching the exchange.
Market Impact: When your algorithm hits the market with size, it consumes liquidity, widening the spread and moving the price against you (slippage).
the most sophisticated way to simulate high-frequency trading (HFT) and scalping strategies in Forex is using a Discrete Event Simulation (DES) with a Limit Order Book (LOB) reconstruction.
Standard backtesting tools (like MetaTrader or simple Python libraries using OHLCV bars) fail for scalping because they cannot accurately model the three biggest realities of micro-trading: latency, slippage, and queue position.
Here is a breakdown of what makes an advanced simulation, followed by a Python framework to get you started.
The Anatomy of an Advanced Simulation
To realistically simulate forex scalping, your engine must model:
Market-By-Order (MBO) Data: You need Level 3 (or at least tick-by-tick Level 2) order book data, not just bid/ask spreads.
Order Queue Position: If you place a limit order at the bid, you don't get filled just because a market sell order hits that price. You get filled when all the orders ahead of you in the queue are filled or canceled.
Network Latency: The delay between your algorithm seeing an event and your order reaching the exchange.
Market Impact: When your algorithm hits the market with size, it consumes liquidity, widening the spread and moving the price against you (slippage).