ATR Trailing Stop Backtest in Crypto: Fees, Slippage and Break-Even Costs
An ATR trailing stop exits when price falls a multiple of ATR from its high. In a backtest, how the stop is triggered and filled inside each bar decides the result.
Short answer
An ATR trailing stop sets an exit at highest price since entry minus k × ATR (for longs). Backtests must decide whether the stop uses intrabar highs and lows or closes, and how the stop fills: in fast drops, a stop-market order fills below the trigger. Using closes delays exits; using intrabar extremes with no slippage flatters results. Model stop fills with slippage, update the trail only on closed bars and report how results change with k.
Trigger and fill models
| Model | Effect |
|---|---|
| Trail on closes, exit at next open | Conservative, later exits |
| Trail on highs, exit at stop level | Optimistic |
| Trail on highs, exit at stop − slippage | Realistic |
See ATR Trailing Stop Backtest in Crypto on live data in the free ChartsPod terminal.
Open the ChartsPod terminalChoosing k
Same-bar ambiguity (stop and target in one bar) also applies; see When Stop and Target Hit in One Candle: Backtest Fill Ambiguity.
Conclusion
Related: Stop-Loss Trigger vs Fill Price: Plan for Slippage in Fast Markets, Stop-Loss Slippage: A Worked Crypto Example With Fees Included.
Trail on closed bars, fill stops with slippage and report results across ATR multiples.
Test ATR Trailing Stop Backtest in Crypto on a perpetual chart; no account is needed to chart.
Launch ChartsPodQuestions readers ask
Should the trail use highs or closes?
Either, consistently; update on closed bars.
Why model slippage on stops?
Stop-market orders fill below the trigger in fast drops.
What k is typical?
2–3 is common; test a range.
Sources and methodology
Backtest cost logic follows TradingView's Pine Script strategy documentation; indicator definitions are standard. All performance numbers are illustrative examples of the method, not results of real tests.
- TradingView Pine Script: Strategies — simulated fills and assumptions.
- TradingView Pine Script: Repainting — live vs historical calculation.
- ChartsPod documentation — guides for order flow, derivatives, alerts, backtests, journal and workspaces.
This article explains research tools and workflows. It is not financial advice, does not recommend buying or selling any asset and does not predict prices. Crypto derivatives carry a risk of rapid and total loss of margin.
CHARTSPOD EDITORIAL EDITION · RESEARCH AND EDUCATION ONLY · NOT FINANCIAL ADVICE.