πSmart Use of Leverage! Complete Freqtrade Leverage Strategy Guide
This article was produced by the Quantitative Trading Lab at https://www.itrade.icu. Visit for more benefits. In Freqtrade, when trading with leverage (especially on futures markets like Binance Futures), you can flexibly control leverage via configuration or strategy code.
This guide covers:
leveragein the config fileleverage()function in the strategyPractical usage and examples
βοΈ 1. Config Option leverage (Global Setting)
leverage (Global Setting)In config.json, you can set a global leverage for all trades:
"leverage": 3β
Suitable Scenarios:
Use the same leverage for all trades
Futures mode trading (e.g., Binance Futures)
β οΈ Notes:
Spot exchanges (e.g., Binance Spot) cannot use leverage
Ensure the account has leverage permissions if using futures
π§ 2. leverage() Function (Dynamic Control in Strategy)
leverage() Function (Dynamic Control in Strategy)You can define a leverage() function in your strategy to dynamically specify leverage per trade. This is only active in Futures mode.
π§ Function Definition:
pair
Trading pair name
current_time
Current datetime
current_rate
Current price
proposed_leverage
Default suggested leverage
max_leverage
Maximum allowed leverage for pair
entry_tag
Optional signal tag
side
'long' or 'short'
π Example 1: Fixed Leverage by Pair
π Example 2: Higher Leverage When Trend Strong
β
Recommended Practices
Global leverage
Quick and simple, same leverage for all trades
leverage() function
Flexible, adjust leverage per pair, signal, or trend
Backtesting
Leverage not enforced in backtests; assess risk accordingly
Combine with stoploss
Leverage increases risk; always set stoploss
π― Practical Example Strategy
π§ Summary
Leverage can be defined in config or strategy for flexible control
Dynamic function supports allocation per market, pair, signal, or trend
Always set a stoploss; proper leverage usage is key to stable profits
Last updated