dynamic-stop-loss
π Master Smart Dynamic Stoploss in Freqtrade: Only Cut Loss When Necessary
This article was produced by the Quantitative Trading Lab at https://www.itrade.icu. Visit for more benefits. In automated trading, stoploss is key to controlling losses and protecting capital. Compared to fixed stoploss, Freqtrade's
custom_stoplossallows dynamic, flexible stoploss design, helping you protect profits during uptrends and exit quickly during losses.
β³οΈ What is custom_stoploss?
custom_stoploss?custom_stoploss dynamically calculates and returns a stoploss price based on position status, time, market conditions, etc.
Return type:
float(new stoploss price)Return
-1to continue using the default stoploss mechanism
β οΈ Note: Only for stoploss, not take profit. Use
custom_exitfor exit strategies.
π Typical Use Cases
Trailing stoploss
Multi-level dynamic stoploss (move stoploss up with profits)
Profit protection at highs
Tiered stoploss (wide to tight)
π§ͺ Example 1: Classic Trailing Stoploss
Move stoploss up with price, always keeping 2% below current rate:
β Stoploss always rises with price; never decreases. β οΈ Stoploss only moves up, never down.
π§ͺ Example 2: Profit-Tiered Stoploss
Define stoploss according to profit tiers:
Profit 0~5% β Stoploss -2%
Profit 5~10% β Stoploss 0% (break-even)
Profit >10% β Lock in 5% profit
π§ͺ Example 3: Tolerate Small Drawdowns
Some coins are prone to quick pullbacks (βstop huntingβ). Set stoploss only if loss exceeds 3%:
π Stoploss vs Take Profit
Feature
Take Profit (custom_exit)
Stoploss (custom_stoploss)
Trigger exit
β Immediate sell
β Set new stoploss price
Frequency
Evaluated each period
Evaluated each period
Purpose
Lock profits
Limit loss / protect capital
Return value
True / False / float
Stoploss price (float) / -1
Complementary
Can work with custom_exit_price
Can work with trailing_stop
π§° Suggested Use with trailing_stop
trailing_stopLet
custom_stoplossmanage initial stoploss,Then let
trailing_stoptake over to protect profits as price rises.
π§ Configuration Tips
Define
custom_stoplossin your strategy; no extra activation needed.Recommended settings:
π Trailing Stop Illustration
Initial entry
100
98
Initial stoploss
Price β
105
102.9
Stoploss moves up
Price β
110.25
107.945
Locking more profit
Price β
115.76
113.45
Continue trailing stop
π Key Reminders
Return value is stoploss price, not percentage.
Return
-1to skip changes; default stoploss applies.
π¦ Summary
custom_stoplossis one of Freqtradeβs most powerful risk management toolsSupports trailing stop, multi-level logic, and profit protection
Combined with
trailing_stopandcustom_exit, it forms a complete capital defense system
Last updated