Freqtrade Basics: Understanding How Freqtrade Works

·

Freqtrade is a powerful, open-source cryptocurrency trading bot designed for automation, backtesting, and strategy optimization. Whether you're new to algorithmic trading or refining your existing systems, understanding the foundational concepts of Freqtrade is essential for building reliable and profitable strategies.

This guide breaks down core terminology, fee handling, pair naming conventions, and the execution logic behind both live trading and backtesting. We’ll also explore how Freqtrade manages technical indicators, order types, profit calculations, and strategy callbacks to give you a complete picture of its inner workings.


Core Freqtrade Terminology

Before diving into operations, let’s clarify key terms used throughout Freqtrade:

👉 Discover how automated trading can boost your crypto strategy today.


Fee Handling in Freqtrade

All profit calculations in Freqtrade include trading fees by default—ensuring realistic performance metrics. This applies consistently across different modes:

This accurate fee modeling ensures that simulated results closely reflect real-world outcomes, reducing surprises when going live.


Trading Pair Naming Conventions

Freqtrade follows the CCXT library's naming standards, which are critical for correct market identification.

Using incorrect formatting may result in errors like "this pair is not available." Here's how to format pairs correctly:

Spot Pairs

Format: BASE/QUOTE
Example: XRP/USDT — meaning XRP is bought using USDT.

Futures Pairs

Format: BASE/QUOTE:SETTLE
Example: ETH/USDT:USDT — indicates an ETH perpetual futures contract settled in USDT.

Understanding this distinction prevents mismatches between your configuration and exchange markets—especially important when working with derivatives.


How the Freqtrade Bot Executes Trades

When you launch Freqtrade in live or dry-run mode using the command freqtrade trade, the bot starts an automated loop that runs continuously until stopped.

This process begins by triggering the optional bot_start() callback and then enters a recurring cycle (by default every few seconds, configurable via process_throttle_secs). Each iteration performs the following steps:

  1. Load Open Trades
    Retrieves currently active trades from persistent storage (database or JSON file).
  2. Determine Tradable Pairs
    Compiles a list of trading pairs eligible for analysis based on configuration filters.
  3. Download OHLCV Data
    Fetches historical candlestick data (Open, High, Low, Close, Volume) for all relevant pairs—including informational pairs used only for signal generation.
This download occurs once per cycle to minimize API calls and network overhead.
  1. Call Strategy Callbacks
    Executes key strategy methods:

    • populate_indicators() – Calculates technical indicators.
    • populate_entry_trend() – Generates long/short entry signals.
    • populate_exit_trend() – Determines exit conditions.
  2. Check Order Timeouts
    For pending orders:

    • Calls check_entry_timeout() or check_exit_timeout() if order age exceeds limits.
    • Invokes adjust_entry_price() to dynamically update limit prices.
  3. Manage Exit Conditions
    Evaluates active positions for closure using:

    • Stop-loss and ROI (Return on Investment) settings.
    • Exit signals from strategy.
    • Custom logic via custom_exit() and custom_stoploss().
    • Final exit price determined by exit_pricing or custom_exit_price().
    • Confirmation via confirm_trade_exit() before placing the order.
  4. Adjust Position Size (if enabled)
    Uses adjust_trade_position() to add to or partially close positions—ideal for scaling strategies.
  5. Evaluate New Entry Opportunities
    If under max_open_trades, checks for new entries:

    • Entry price set via entry_pricing or custom_entry_price().
    • Leverage determined via leverage() in margin/futures mode.
    • Stake amount calculated via custom_stake_amount().
    • Final entry confirmed via confirm_trade_entry().

This entire loop repeats indefinitely, enabling continuous monitoring and automated execution.


Backtesting & Hyperopt Execution Logic

While live trading focuses on real-time execution, backtesting and hyperparameter optimization (Hyperopt) simulate performance using historical data.

The process includes:

  1. Loading historical OHLCV data for configured pairs.
  2. One-time call to bot_start().
  3. Running indicator calculations (populate_indicators() per pair).
  4. Generating entry and exit signals (populate_entry_trend(), populate_exit_trend()).
  5. Simulating trades candle-by-candle:

    • Calling bot_loop_start() per iteration.
    • Checking order timeouts via config or callbacks.
    • Adjusting entry prices with adjust_entry_price().
    • Evaluating entry signals (enter_long, enter_short).
    • Confirming entries/exits via optional callbacks.
    • Setting custom prices with custom_entry_price() (applied at candle open).
    • Determining leverage and stake size where applicable.
    • Applying position adjustments via adjust_trade_position().
    • Using custom_stoploss() and custom_exit() for advanced exits.
    • Calculating exit prices via custom_exit_price() (applied at candle close).

Finally, a detailed backtest report is generated—showing profit/loss, win rate, drawdowns, and more.

🔔 Important Note:
Backtests use default exchange fees unless overridden with the --fee parameter. Also, callback frequency differs:

👉 See how strategy testing can improve your trading accuracy before going live.


Frequently Asked Questions

Q: Does Freqtrade support futures trading?
A: Yes. Freqtrade fully supports futures markets with proper pair formatting (BASE/QUOTE:SETTLE) and leverage configuration via the leverage() callback.

Q: Can I customize entry and exit prices?
A: Absolutely. Use custom_entry_price() and custom_exit_price() in your strategy to define dynamic pricing logic beyond standard limit/market orders.

Q: How are profits calculated in Freqtrade?
A: All profits—unrealized, realized, and total—include trading fees. Total return percentages are based on your total stake investment.

Q: What happens if I exceed max_open_trades?
A: The bot will skip new entries until one or more open trades are closed, respecting your configured concurrency limit.

Q: Is it safe to run Freqtrade with real funds?
A: Always start with paper trading (dry-run mode). Test thoroughly in simulation before deploying live strategies.

Q: Can I modify fees during backtesting?
A: Yes. Use the --fee argument in backtest or hyperopt commands to simulate different fee structures.


Final Thoughts

Freqtrade offers a robust framework for developing, testing, and deploying automated crypto trading strategies. By mastering its core concepts—from pair naming to callback execution—you gain full control over your algorithmic trading workflow.

Whether you're analyzing technical indicators, optimizing entry logic, or simulating long-term performance, Freqtrade provides the tools needed to make informed decisions.

👉 Start refining your strategy with advanced trading tools now.

Keywords: Freqtrade basics, cryptocurrency trading bot, algorithmic trading, backtesting crypto strategies, technical indicators in trading, automated trading system, Freqtrade strategy development, live trading automation