Skip to content
All library documents

Freqtrade Strategy Callbacks for Trade Management and Execution

Article Freqtrade docs

Summary

This documentation explains how Freqtrade strategy callbacks complement vectorized indicator and signal functions. Callbacks run when needed, often repeatedly during live trading or at each simulated candle, so the guidance warns against costly calculations in frequently invoked methods. It surveys callback roles for startup tasks, loop-level data gathering, stake sizing, entries, exits, stop-losses, return targets, leverage, order handling, and position adjustments.

The document distinguishes signal-based exits computed across a dataframe from per-trade custom exits that can use trade state or profit. It recommends custom stop-loss logic for dynamic protective stops and custom ROI logic for profit thresholds, rather than using those callbacks as substitutes for immediate exit signals. Examples show startup and loop tasks, stake sizing, and profit- or duration-based exits. The material is implementation guidance, not a trading strategy or performance study; behavior depends on callback frequency, configuration, and the accuracy of backtest price assumptions.

Key ideas

  • Main indicator and entry or exit signal functions are intended for vectorized calculations, while callbacks run as needed.
  • Frequent callbacks should avoid heavy calculations because they may execute repeatedly during a trade.
  • Use custom exits for per-trade conditions and custom stop-loss callbacks for dynamic protective stops.
  • Custom ROI callbacks define minimum profit thresholds, while static ROI belongs in the standard ROI setting.
  • Callback behavior and backtest accuracy depend on configuration and execution context.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.