Modeling Slippage and Liquidity in Realistic Backtesting
Slippage quietly breaks a strategy idea. Most backtest engines make a simple assumption: the order fills exactly at the bar close price. It does not work that way in reality. By the time you send an order, the price has already moved. The gap between them is slippage. It looks small, but spread across hundreds of trades it changes the result.
Slippage is not constant. When the market is calm it stays small. When volatility rises it grows. On a news event or a fast reversal, the order fills far from where you expected. A backtest that passes these moments at a fixed price shows a profit that never existed.
Liquidity is the second factor. Sending a market order on a pair with a thin order book consumes the depth of the book. The first lot fills at a good price, the rest get steadily worse. Your average entry price drifts from what you expected. High leverage widens this gap, because a small price deviation lands hard on your account.
Commission must be counted too. Every entry and exit takes a fee. On a single trade it seems trivial. On a strategy that trades often, the total cost becomes a serious line item. A backtest that ignores commission can show a losing strategy as profitable.
Leverage sharpens this picture. On an unleveraged trade a small slippage stays small. On high leverage the same slippage lands hard on your account, because the real size of the position multiplies. A half-percent deviation in price, multiplied by leverage, produces a serious difference. So ignoring slippage when testing a leveraged strategy is the most dangerous mistake. A small move that stops you out in reality can still show you in position inside the backtest.
The Beyin Finance backtest engine adds these costs from the start. Pair-specific commission tiers are applied to each test. Realistic slippage buffers are counted in. The goal is not to prettify the result but to keep it honest. A strategy that looks flawless on paper shows its real face once the costs are added. If a strategy still stands under these conditions, you have a reason to trust it. The job of a backtest is not to produce a pleasant number but to protect you from surprises.