customized-take-profit
π Boost Your Profit by 10% with One Line? How to Use custom_roi for Precise Take Profit
custom_roi for Precise Take ProfitThis article was produced by the Quantitative Trading Lab at https://www.itrade.icu. Visit for more benefits. In Freqtrade strategies,
custom_roiis a highly useful function that allows you to dynamically adjust your take profit target based on current position status, time, and profit. Compared to staticminimal_roi,custom_roiis more flexible and can help improve profitability and risk management.
βοΈ custom_roi Function Overview
custom_roi Function Overviewcustom_roi allows users to define custom take profit logic. It is called automatically every trading interval and returns a dynamic ROI target. Returning 0 triggers immediate exit, while returning None continues to use the default ROI.
Function Signature Example
def custom_roi(self, trade, current_profit: float, current_time) -> float | None:
"""
Custom take profit strategy
Parameters:
- trade: Current trade object with position info
- current_profit: Current profit (float)
- current_time: Current timestamp
Returns:
- float ROI target, or None to use default ROI
"""
passπ Example: Dynamic Take Profit Based on Hold Time and Profit
β Does minimal_roi Still Apply When Using custom_roi?
minimal_roi Still Apply When Using custom_roi?Once
custom_roiis implemented,minimal_roiis ignored; take profit logic is fully controlled bycustom_roi.If
custom_roireturnsNone, it falls back to the defaultminimal_roi.It is recommended to fully define take profit logic in
custom_roifor consistent behavior.
β
Practical Tips
Use
custom_roito flexibly define take profit thresholds based on hold time and profitAdd logging for easier debugging and strategy evaluation across market conditions
Dynamic take profit is suitable for volatile or trending markets, enhancing profitability and risk control
π§ Summary
custom_roiis an essential extension interface for take profit management in FreqtradeEnables smart, dynamic take profit strategies
Fully replaces static
minimal_roi, increasing strategy flexibility and adaptabilityWell-designed take profit logic is key to risk management and maximizing returns
Last updated