Freqtrade applies a strategy's protections in backtesting only with --enable-protections. Without it, they are silently skipped, which is the subject of closed GitHub issue #12753. In our measured run of a SampleStrategy variant (−3% stop, 6-candle CooldownPeriod, StoplossGuard 2 losing stops in 72 candles locks 36), the flag cut trades from 209 to 181 and stoploss exits from 63 to 55, and recorded 194 locks. The loss changed from −56.741 to −54.434 USDT. Both runs lost money.
Calculation and worked example. AI-assisted drafting. Educational information; no individual financial advice.
Protections are off in backtests unless you pass the flag
Freqtrade's official plugins page (checked 2026-11-12) says protections are supported in backtesting and hyperopt, but only when you pass --enable-protections. Without the flag, the protections property in your strategy is not applied in backtesting. A closed GitHub issue from January 2026, #12753 "CooldownPeriod no effect when backtesting", shows the trap. A user saw a new trade one candle after an exit despite a 10-candle CooldownPeriod. A maintainer pointed to the flag and confirmed it is off by default, because of its performance cost. The same applies to backtests started from the web UI, which has its own setting for this.
What the two protections do
From the official plugins page:
- CooldownPeriod locks a pair for
stop_duration_candles(orstop_durationminutes) after a trade on that pair exits. It works per pair only and never locks all pairs. - StoplossGuard looks at trades closed within
lookback_period_candles. If at leasttrade_limitof them ended by stoploss with a loss, it stops trading forstop_duration_candles. That is across all pairs unlessonly_per_pairis true. It countsstop_loss,stoploss_on_exchangeandtrailing_stop_lossexits.
Our with-and-without runs
We ran this comparison on the box on 2026-11-12. Both runs used the same strategy file, data and settings; the only difference was the flag.
- Freqtrade 2026.10 (pip install, Python 3.13, CCXT 4.5.92), run on our box on 2026-11-12
- Data: public spot OHLCV for BTC/USDT, ETH/USDT, SOL/USDT and XRP/USDT, downloaded with
freqtrade download-datafrom one exchange's public API for 2026-07-01 to 2026-11-01. Candle times are UTC. - Config: dry-run wallet 1,000 USDT, stake 100 USDT,
max_open_trades3,StaticPairList,--fee 0.001(0.1% per side) set explicitly,--cache none - Strategy
SampleProtectionsTest: the stockSampleStrategywith two changes. The stoploss is tightened to −3%, so StoplossGuard has stoploss exits to count in a three-month window. And thisprotectionsproperty was added:
@property
def protections(self):
return [
{"method": "CooldownPeriod", "stop_duration_candles": 6},
{"method": "StoplossGuard", "lookback_period_candles": 72,
"trade_limit": 2, "stop_duration_candles": 36, "only_per_pair": False},
]On 5m candles that is a 30-minute cooldown per pair, and a 3-hour pause for all pairs after 2 losing stoplosses within 6 hours.
freqtrade backtesting -c user_data/config.json -s SampleProtectionsTest -i 5m \
--timerange 20260801-20261101 --fee 0.001 --cache none
freqtrade backtesting -c user_data/config.json -s SampleProtectionsTest -i 5m \
--timerange 20260801-20261101 --fee 0.001 --cache none --enable-protectionsResults
| Metric | Without flag | With --enable-protections |
|---|---|---|
| Trades | 209 | 181 |
| Wins / losses | 143 / 66 | 122 / 59 |
| Stoploss exits | 63 | 55 |
| Other exits | ROI 143, force_exit 3 | ROI 122, exit_signal 1, force_exit 3 |
| Absolute profit | −56.741 USDT (−5.674%) | −54.434 USDT (−5.443%) |
| Max account drawdown | 6.780% (68.607 USDT) | 6.771% (68.669 USDT) |
| Average holding time | 21:02 | 23:11 |
| Locks recorded | 0 | 194 |
With the flag, the result file recorded 175 cooldown locks and 19 StoplossGuard locks. Freqtrade's lock reasons read "Cooldown period for for 6 candles." (sic, with the doubled word) and "2 stoplosses in 360 min, locking for 36 candles."
How to read the difference
- Confirm the protections actually ran. The quickest check is the lock list in the result. Zero locks with a
protectionsproperty in the strategy usually means the flag was missing, as in issue #12753. - Count trades, not just profit. Protections removed 28 trades net, including 8 stoploss exits. Only 158 trades matched on pair and entry time across the two runs: 51 trades appeared only without protections, and 23 only with them. A lock blocks one entry, and a freed slot then goes to a different signal. That is why you cannot simply subtract the blocked trades.
- Read the risk columns with care. Absolute profit improved by 2.307 USDT. The drawdown percentage barely moved (6.780% vs 6.771%), and the drawdown in USDT was slightly higher with protections. The strategy lost money in both runs. Protections changed which trades happened. They did not turn a losing configuration into a winning one, and one window cannot show they would.
- Tune per strategy. The docs warn that not all protections work for all strategies and that parameters need tuning. Our parameters were chosen to make both protections fire in this window, not optimised.
Reproduce and extend
Keep everything identical except --enable-protections. Export trades and compare them per trade, not only the summary line. The backtest statistics tool can turn each run's closed-trade results into profit factor and drawdown, and the drawdown recovery tool shows what a given drawdown means for recovery. For local versus exchange stops, see stoploss on exchange vs local, and for structuring the evaluation, the bot evaluation guide. All figures above are measured results from one stock-derived test strategy and one three-month window, kept with our batch evidence. They are not a performance or profit claim.
Sources & method
What this article adds
A measured protections on/off backtest pair run on the box with the exact strategy code and commands. It includes lock counts by protection (175 cooldown, 19 StoplossGuard), a per-trade overlap analysis (158 shared, 51 only without, 23 only with) explaining why blocked trades cannot simply be subtracted, and a zero-locks check for a missing flag.
How it was prepared
We ran freqtrade 2026.10 (PyPI, Python 3.13) on the box on 2026-11-12 with public spot OHLCV for four USDT pairs (2026-08-01 to 2026-11-01), an explicit 0.1% fee, a 100 USDT stake, max_open_trades 3 and --cache none. The two runs differ only by --enable-protections. The test strategy, result zips, configs, data checksums and the comparison script are in the batch evidence folder. Protection semantics come from the official plugins page fetched 2026-11-12 Asia/Shanghai, and the issue history from the GitHub API the same day.
- Freqtrade docs (stable): Plugins — Protections Checked 2026-11-12
- Freqtrade docs (stable): Backtesting command reference Checked 2026-11-12
- GitHub freqtrade/freqtrade issue #12753: CooldownPeriod no effect when backtesting (closed 2026-01-28) Checked 2026-11-12
The plugins page supports the flag requirement, CooldownPeriod and StoplossGuard semantics including pair versus global scope and counted exit types, and the tuning warning. The backtesting reference supports the --enable-protections option. Issue #12753 (closed 2026-01-28) supports the missing-flag symptom and the maintainer's statement that protections are off by default in backtests, including web UI backtests. The measured values come from our own runs.
For corrections, contact the publisher. Editorial policy · Affiliate disclosure