π Article 6: Freqtrade - "Visualize Your Data with Charts! Plot-Dataframe Visualization Tutorial"
During strategy development, backtest results are often presented in tabular form, making it hard to quickly identify issues. The plot-dataframe command visualizes buy/sell points, indicator lines, and price trends as charts, helping you instantly understand strategy performance.
π Want to Learn Quantitative Trading?
π Visit: https://www.itrade.icu
Find Freqtrade Basics, Strategy Practices, Indicator Analysis, and more to help you master quantitative trading skills effortlessly!
π― 1. Basic Usage: Generating Charts
freqtrade plot-dataframe \
--config user_data/config.json \
--strategy MyStrategy \
--timerange 20230101-20230201
This command generates an .html file in the user_data/plot/ directory, which you can open in a browser to view:
- Candlestick price trends
- Buy/Sell points (marked with arrows)
- Technical indicators (e.g., EMA, MACD)
π§Ύ 2. Parameter Breakdown
| Parameter | Description |
|---|---|
--config |
Path to the configuration file (includes trading pairs, timeframes, etc.) |
--strategy |
Strategy class name (e.g., MyStrategy) |
--timerange |
Time range for the chart (e.g., 20230101-20230201) |
--indicators1 |
Indicators for the main chart (e.g., EMA, close) |
--indicators2 |
Indicators for the subplot (e.g., RSI, MACD) |
--exportfilename |
Output file path (supports .html or .png) |
--userdir |
Custom user_data directory (default is fine) |
π 3. Adding Custom Indicators
You can include additional indicators in the chart to validate signal logic:
Code Example:
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['ema'] = ta.EMA(dataframe['close'], timeperiod=20)
dataframe['fast_ema'] = ta.EMA(dataframe['close'], timeperiod=10)
dataframe['slow_ema'] = ta.EMA(dataframe['close'], timeperiod=50)
dataframe['rsi'] = ta.RSI(dataframe['close'], timeperiod=14)
macd, macdsignal, macdhist = ta.MACD(dataframe['close'])
dataframe['macd'] = macd
return dataframe
-
--indicators1plots on the main chart (price chart), e.g., EMA lines. -
--indicators2plots on the subplot, e.g., RSI, MACD.
Complete Example:
freqtrade plot-dataframe \
--config user_data/config.json \
--strategy MyStrategy \
--timerange 20230101-20230201 \
--indicators1 close ema fast_ema slow_ema \
--indicators2 rsi macd
β Note:
- Indicator names must match the column names in the
DataFramecreated in thepopulate_indicators()method of your strategy. - Mismatched names wonβt cause errors, but the indicators wonβt appear on the chart.
- Indicators must be defined in
populate_indicators()to take effect.
πΎ 4. Exporting to HTML / PNG
By default, the output is an HTML file. To specify:
--exportfilename user_data/plot/myplot.html
To export as PNG (static image):
--exportfilename user_data/plot/myplot.png
π Note: Exporting to PNG requires additional tools like Puppeteer or headless Chrome. Beginners should stick to HTML format.
π³ 5. Running in a Docker Environment
To use the command in Docker:
docker compose run --rm freqtrade plot-dataframe \
--config /quants/freqtrade/user_data/config.json \
--strategy MyStrategy \
--timerange 20230101-20230201
Ensure the /quants/freqtrade/user_data directory is correctly mounted in docker-compose.yml.
β 6. Usage Tips
| Purpose | Method |
|---|---|
| Verify strategy logic | Check if buy/sell points are correctly positioned |
| Debugging | Compare indicators with signal logic |
| Strategy sharing | Export charts as HTML for easy presentation |
| Evaluate indicator performance | Plot multiple indicators to check for redundancy |
π Summary
plot-dataframe is a powerful visualization tool in Freqtrade, ideal for debugging complex strategies and validating buy/sell logic.
Recommended Workflow:
- Run Backtest:
freqtrade backtesting \
--config user_data/config.json \
--strategy MyStrategy \
--timeframe 15m \
--timerange 20220101-20230101
- Generate Chart:
freqtrade plot-dataframe \
--config user_data/config.json \
--strategy MyStrategy \
--timerange 20250601-20250626
- Analyze Chart:
- Are buy signals triggered too early or too late?
- Are there frequent false signals?
- Are the indicators effective?
Master plot-dataframe to optimize strategies efficiently with data-driven insights!

Top comments (0)