This guide covers fundamental concepts about how Freqtrade operates and its core functionalities.
Freqtrade Terminology
- Strategy: Your trading algorithm that instructs the bot on actions to take.
- Trade: An open position.
- Open Order: Active exchange orders awaiting completion.
- Trading Pair: Tradable currency pairs (e.g., spot pairs like
XRP/USDT, futures likeXRP/USDT:USDT). - Timeframe: Candlestick duration (e.g.,
"5m","1h"). - Technical Indicators: Tools like SMA, EMA, RSI, etc.
- Limit Order: Executes at specified price or better.
- Market Order: Guarantees execution, potentially affecting price volatility.
- Current Profit: Unrealized profit (used internally).
- Realized Profit: Actualized profit (relevant for partial fills).
- Total Profit: Combines realized/unrealized profits, calculated against total investment.
Fee Management
Freqtrade incorporates fees in all profit calculations:
- Backtesting/Hyperopt: Uses exchange default fees.
- Live Trading: Applies actual fees (including discounts like BNB).
👉 Optimize your trading strategy with low fees
Trading Pair Nomenclature
Follows CCXT conventions:
Spot Pairs
Format: base/quote (e.g., ETH/USDT).
Futures Pairs
Format: base/quote:settle (e.g., ETH/USDT:USDT).
Bot Execution Logic
The iterative loop runs every few seconds (internals.process_throttle_secs):
Initialization:
- Fetch open trades from storage.
- Identify tradable pairs.
- Download OHLCV data (including informational pairs).
Strategy Analysis:
- Call
populate_indicators(). - Evaluate entry/exit trends via
populate_entry_trend()andpopulate_exit_trend().
- Call
Order Management:
- Check order timeouts (
check_entry_timeout(),check_exit_timeout()). - Adjust prices via
adjust_entry_price().
- Check order timeouts (
Position Handling:
- Validate stop-loss, ROI, exit signals.
- Determine exit pricing (
exit_pricingorcustom_exit_price()). - Call
confirm_trade_exit()before order placement.
Entry Validation:
- Set entry price (
entry_pricingorcustom_entry_price()). - Calculate leverage (
leverage()) for margin/futures. - Determine stake size (
custom_stake_amount()). - Confirm via
confirm_trade_entry().
- Set entry price (
Backtesting/Hyperopt Execution
Simulates core logic without live interactions:
- Load historical data for configured pairs.
- Call
bot_start()once. - Compute indicators (
populate_indicators()per pair). - Evaluate entry/exit signals (
populate_entry_trend(),populate_exit_trend()). Simulate trades candle-by-candle:
- Check timeouts (
unfilledtimeoutor callback-based). - Adjust entry prices (
adjust_entry_price()). - Validate entries/exits (
confirm_trade_entry/exit()). - Manage position sizing (
custom_stake_amount()). - Handle partial exits (
adjust_trade_position()).
- Check timeouts (
👉 Master backtesting techniques for better results
FAQ
Q: How often are callbacks triggered in backtesting vs. live trading?
A: Backtesting calls each callback once per candle; live trading triggers them per iteration (~5s intervals).
Q: Does Freqtrade support custom fee structures?
A: Yes, use --fee parameter in backtesting/hyperopt to override defaults.
Q: What happens if a trading pair uses incorrect nomenclature?
A: The bot may fail to recognize it, causing errors like "pair unavailable."
Q: How is total profit calculated?
A: Sum of realized/unrealized profits relative to total investment.
Q: Can I adjust open positions dynamically?
A: Yes, via adjust_trade_position() callback for live trading.