πŸ“˜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:

  • leverage in the config file

  • leverage() function in the strategy

  • Practical usage and examples


βš™οΈ 1. Config Option 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)

You can define a leverage() function in your strategy to dynamically specify leverage per trade. This is only active in Futures mode.

πŸ”§ Function Definition:

Parameter
Meaning

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


Item
Recommendation

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