Commissions, slippage & fills: making Pine backtests realistic
A backtest with zero costs and instant fills is a fantasy. The default TradingView settings flatter your strategy in three places, and most traders never change them. Here's what each one does and what to actually set.
Pine's Strategy Tester results depend more on the Properties tab than people realise. Two strategies with identical logic can show wildly different equity curves depending on what you set for costs and fills. Here's the audit.
1. Commission
By default, many Pine strategies are tested with zero commission. Real futures cost roughly $0.50–$5 per side per contract (round trip $1–$10) depending on broker and instrument. For micros that's a non-trivial drag on a small-edge scalp strategy.
- Set commission as “USD per contract” for futures, or as a percentage for forex/stocks.
- Use the actual round-trip cost your prop firm broker charges — for retail futures props, often $4–$8 round trip per micro contract.
2. Slippage
The price you backtest against is rarely the price you fill at. Pine lets you set slippage in ticks — the default is often zero, which is generous.
- For micros on liquid hours, 1–2 ticks per side is a realistic floor.
- For off-hours or high-volatility entries (news, opens), 3–5 ticks is more honest.
- For market orders during slow conditions, lean to the higher end.
Slippage compounds with trade frequency — a high-frequency strategy that looked great at zero slippage often dies at 2 ticks.
3. Order fill assumptions
The Properties tab includes a setting for how orders are filled within a bar — the default can be misleading. The cleanest, most conservative choice is “Fill orders on bar close” rather than “Fill orders at the next tick after signal”, because the latter quietly assumes you could have transacted at any price within the bar, which you couldn't live. See why backtests don't match live.
4. Initial capital & order size
Set initial capital to the actual account you'll trade. Set order size to a fixed quantity (e.g. 1 contract) rather than “% of equity” for cleaner per-trade analysis. Variable sizing makes the equity curve look smoother than it really is.
The honest test
After fixing all four, re-run the backtest. If the strategy was marginal before, it's probably dead now — that's the test working. A real edge survives realistic costs; a curve-fit one doesn't. For deeper validation, run the surviving system through the Monte Carlo Simulator and check it against an out-of-sample window.
FAQ
What commission should I set in TradingView's strategy tester?
For futures, set commission as USD per contract matching your real broker's round-trip cost — often $4–$8 per micro contract round trip on a retail prop futures account. For forex/stocks, set it as a percentage of trade value.
How much slippage should I add in Pine backtests?
On liquid hours, 1–2 ticks per side is a realistic floor for micros. For off-hours, news, or high-volatility entries, 3–5 ticks is more honest. The default of zero is unrealistic for nearly all strategies.
Which fill mode is most realistic in TradingView?
“Fill orders on bar close” is the cleanest, most conservative choice for swing or higher-timeframe strategies. The next-tick-after-signal option can flatter intra-bar strategies because it implicitly assumes execution at prices you couldn't actually have transacted at live.
Not financial advice. Performance figures referenced are hypothetical, modeled outputs (1,500-path Monte Carlo on a 12-month sample). Past performance does not guarantee future results. Tool names are referenced for education; verify current features and prop-firm rules directly.