Lesson 5: First Strategy Backtest
๐ Course Series: Complete Freqtrade Quantitative Trading Course
๐ Section: Part 2 - Backtesting Practice
โฑ Duration: 2 hours
๐ฏ Difficulty: โญโญ Beginner
๐ฏ Learning Objectives
After completing this lesson, you will be able to:
- โ Understand what backtesting is and why we backtest
- โ Master basic backtesting command usage
- โ Read and understand various metrics in backtest reports
- โ Identify and resolve common backtesting errors
- โ Evaluate whether a strategy is worth further research
๐ Prerequisites
Required Conditions
- [x] Completed lessons 1-4
- [x] Freqtrade environment installed and configured
- [x] Downloaded at least 30 days of historical data
Environment Verification
# 1. Activate environment
conda activate freqtrade
# 2. Verify version
freqtrade --version
# Should show: freqtrade 2025.9 or higher
# 3. Verify strategy is available
freqtrade list-strategies -c config.json | grep Strategy001
# Should show: โ Strategy001 โ Strategy001.py โ OK โ
# 4. Verify data is downloaded
freqtrade list-data -c config.json
# Should show downloaded trading pairs and timeframes
If any step has issues, please return to the corresponding lesson for review.
๐ Theoretical Knowledge
5.1 What is Backtesting?
Backtesting is the process of simulating trading strategies using historical data, aimed at evaluating the strategy's past performance.
How Backtesting Works
Historical Data โ Strategy Logic โ Simulated Trading โ Performance Report
โ โ โ โ
Candle Data Buy/Sell Signals Position Records Profit Statistics
Example Explanation:
- Assume today is 2025-09-30
- We use historical data from 2025-09-01 to 2025-09-30
- Simulate what would happen if the strategy ran during these 30 days
- Statistics on profit/loss, win rate, maximum drawdown, etc.
Backtesting vs Live Trading Differences
| Dimension | Backtesting | Live Trading |
|---|---|---|
| Data | Historical data (known) | Real-time data (unknown) |
| Execution | Instant completion | Real waiting |
| Slippage | May be ignored | Actually exists |
| Fees | Estimated | Actually deducted |
| Psychology | No pressure | Emotional fluctuations |
โ ๏ธ Important Note: Good backtesting doesn't guarantee good live trading, but poor backtesting definitely means poor live trading!
5.2 Why Backtest?
5 Key Reasons
-
Verify Strategy Logic
- Is the strategy concept correct?
- Are buy/sell signals reasonable?
-
Evaluate Profitability
- Can it make money? How much?
- What's the win rate?
-
Assess Risk Level
- What's the maximum drawdown?
- Can it be tolerated?
-
Optimize Parameters
- Which parameters work better?
- How to adjust stop-loss and take-profit?
-
Build Confidence
- Only use real money after strategy validation
Limitations of Backtesting
โ What backtesting cannot do:
- Cannot predict the future (history doesn't exactly repeat)
- Cannot eliminate all risks
- Cannot replace live trading verification
โ What backtesting can do:
- Quickly screen strategies
- Discover obvious problems
- Provide optimization directions
5.3 Basic Backtesting Process
graph LR
A[Prepare Data] --> B[Select Strategy]
B --> C[Set Parameters]
C --> D[Execute Backtest]
D --> E[Analyze Results]
E --> F{Strategy Good?}
F -->|Yes| G[Enter Live Testing]
F -->|No| H[Optimize or Abandon]
H --> C
๐ป Practical Operations
5.4 First Backtest Command
Command Structure
freqtrade backtesting \
-c config.json \ # Configuration file
--strategy Strategy001 \ # Strategy name
--timerange 20250901-20250930 # Time range
Step-by-Step Execution
Step 1: Activate Environment
conda activate freqtrade
cd /path/to/freqtrade-strategies
Step 2: Verify Data
# Ensure data is downloaded
freqtrade list-data -c config.json
# Sample output:
# BTC/USDT 5m 2025-09-01 -> 2025-09-30
# ETH/USDT 5m 2025-09-01 -> 2025-09-30
Step 3: Execute Backtest
freqtrade backtesting \
-c config.json \
--strategy Strategy001 \
--timerange 20250901-20250930
Execution Process Explanation
After starting the backtest, you'll see output similar to this:
2025-09-30 16:00:00 - freqtrade - INFO - freqtrade 2025.9
2025-09-30 16:00:01 - freqtrade.configuration - INFO - Using config: config.json ...
2025-09-30 16:00:02 - freqtrade.exchange - INFO - Using Exchange "Binance"
2025-09-30 16:00:03 - freqtrade.optimize.backtesting - INFO - Loading data from 2025-09-01 to 2025-09-30
2025-09-30 16:00:04 - freqtrade.optimize.backtesting - INFO - Running backtesting for Strategy Strategy001
Execution Time:
- 1 month data: about 5-30 seconds
- 3 months data: about 30-60 seconds
- 1 year data: about 2-5 minutes
5.5 Complete Backtest Report Interpretation
After backtesting completes, multiple tables will be displayed. Let's interpret them one by one:
๐ Table 1: BACKTESTING REPORT (Core Report)
BACKTESTING REPORT
โโโโโโโโโโโโณโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Pair โ Trades โ Avg Profit % โ Tot Profit USDT โ Tot Profit % โ Avg Duration โ Win Draw Loss Win% โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ BTC/USDT โ 7 โ 0.52 โ 3.643 โ 0.36 โ 3 days, 20:05:00 โ 6 0 1 85.7 โ
โ ETH/USDT โ 6 โ -0.98 โ -5.897 โ -0.59 โ 4 days, 5:28:00 โ 5 0 1 83.3 โ
โ BNB/USDT โ 10 โ 0.92 โ 9.137 โ 0.91 โ 2 days, 7:17:00 โ 10 0 0 100 โ
โ SOL/USDT โ 17 โ -0.29 โ -4.912 โ -0.49 โ 1 day, 3:23:00 โ 15 0 2 88.2 โ
โ XRP/USDT โ 16 โ 0.21 โ 3.366 โ 0.34 โ 1 day, 9:40:00 โ 14 0 2 87.5 โ
โ TOTAL โ 56 โ 0.1 โ 5.338 โ 0.53 โ 2 days, 2:11:00 โ 50 0 6 89.3 โ
โโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโ
Column-by-Column Explanation:
-
Pair (Trading Pair)
- Individual performance for each trading pair
- TOTAL row is the summary of all trading pairs
-
Trades (Number of Trades)
- Number of completed trades
- โ ๏ธ Too few (<10): Insufficient sample, unreliable
- โ Moderate (10-100): Reasonable
- โ ๏ธ Too many (>200): Possible overtrading
-
Avg Profit % (Average Return Rate)
- Average profit/loss percentage per trade
- Example: 0.52% means average profit of 0.52% per trade
- โ > 0.5%: Good
- โ ๏ธ < 0.1%: May lose money after fees
-
Tot Profit USDT (Total Profit USDT)
- Total profit/loss for the trading pair (unit: USDT)
- Example: BTC/USDT earned 3.643 USDT
-
Tot Profit % (Total Return Rate)
- Total return rate relative to initial capital
- Calculation: Total profit/loss / Initial capital
- Example: 0.36% means earned 3.6 USDT from 1000 USDT
-
Avg Duration (Average Position Time)
- Average holding time per trade
- Example: 3 days, 20:05:00 = 3 days 20 hours 5 minutes
- โ ๏ธ Too long: Low capital utilization, overnight risk
- โ ๏ธ Too short: High fee percentage
-
Win Draw Loss Win% (Win/Loss Statistics)
- Win: Number of profitable trades
- Draw: Number of breakeven trades
- Loss: Number of losing trades
- Win%: Win rate = Win / (Win + Loss)
- Example: 6 wins, 0 draws, 1 loss, 85.7% win rate
Key Observations:
- โ BNB/USDT performed best: 10 trades all wins, total return +0.91%
- โ ETH/USDT performed worst: Total return -0.59%
- โ Overall performance: 56 trades, 50 wins 6 losses, 89.3% win rate, total return +0.53%
๐ Table 2: LEFT OPEN TRADES REPORT (Open Positions Report)
LEFT OPEN TRADES REPORT
โโโโโโโโโโโโณโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Pair โ Trades โ Avg Profit % โ Tot Profit USDT โ Tot Profit % โ Avg Duration โ Win Draw Loss Win% โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ ETH/USDT โ 1 โ 0.28 โ 0.277 โ 0.03 โ 7 days, 10:40:00 โ 1 0 0 100 โ
โ BNB/USDT โ 1 โ 0.17 โ 0.167 โ 0.02 โ 7 days, 10:30:00 โ 1 0 0 100 โ
โ XRP/USDT โ 1 โ -0.76 โ -0.762 โ -0.08 โ 4:10:00 โ 0 0 1 0 โ
โ BTC/USDT โ 1 โ -2.33 โ -2.313 โ -0.23 โ 12 days, 21:25:00 โ 0 0 1 0 โ
โ TOTAL โ 4 โ -0.66 โ -2.631 โ -0.26 โ 6 days, 23:41:00 โ 2 0 2 50.0 โ
โโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโ
Meaning:
- Trades still open when backtesting ended
- These trades are not included in the total profit above
- โ ๏ธ Note: Open trades may be losing (like BTC/USDT -2.33%)
Why are there open trades?
- Strategy is still waiting for sell signals
- Backtest time ended but trades aren't completed
- These trades would continue in live trading
How to evaluate?
- Few open positions (<5): Normal
- Overall loss on open positions: Need attention, strategy exit conditions may be too strict
๐ Table 3: ENTER TAG STATS (Entry Tag Statistics)
ENTER TAG STATS
โโโโโโโโโโโโโณโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Enter Tag โ Entries โ Avg Profit % โ Tot Profit USDT โ Tot Profit % โ Avg Duration โ Win Draw Loss Win% โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ OTHER โ 56 โ 0.1 โ 5.338 โ 0.53 โ 2 days, 2:11:00 โ 50 0 6 89.3 โ
โ TOTAL โ 56 โ 0.1 โ 5.338 โ 0.53 โ 2 days, 2:11:00 โ 50 0 6 89.3 โ
โโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโ
Meaning:
- Statistics classified by entry reason
- Strategy001 marks all entries as "OTHER" (default tag)
- Advanced strategies can set multiple entry tags, showing which entry method works better
Example (Advanced Strategy):
Enter Tag | Entries | Avg Profit %
-------------+---------+--------------
breakout | 20 | 1.2% โ Breakout entry performs well
oversold | 15 | -0.5% โ Oversold entry performs poorly
๐ Table 4: EXIT REASON STATS (Exit Reason Statistics)
EXIT REASON STATS
โโโโโโโโโโโโโโโณโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Exit Reason โ Exits โ Avg Profit % โ Tot Profit USDT โ Tot Profit % โ Avg Duration โ Win Draw Loss Win% โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ roi โ 48 โ 1.01 โ 48.639 โ 4.86 โ 1 day, 10:01:00 โ 48 0 0 100 โ
โ force_exit โ 4 โ -0.66 โ -2.631 โ -0.26 โ 6 days, 23:41:00 โ 2 0 2 50.0 โ
โ stop_loss โ 4 โ -10.18 โ -40.670 โ -4.07 โ 5 days, 6:40:00 โ 0 0 4 0 โ
โ TOTAL โ 56 โ 0.1 โ 5.338 โ 0.53 โ 2 days, 2:11:00 โ 50 0 6 89.3 โ
โโโโโโโโโโโโโโโดโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโ
This is one of the most important tables! Tells you how trades ended.
Exit Reason Explanations:
-
roi (Take Profit)
- Automatically take profit when ROI target is reached
- Example: 48 trades took profit through ROI, average return +1.01%
- โ Excellent performance: All profitable
-
exit_signal (Signal Sell)
- Strategy generates sell signal
- Example: Not present in this backtest
- ๐ Strategy001 uses
exit_profit_only = True, only responds to sell signals when profitable
-
stop_loss (Stop Loss)
- Stop loss triggered
- Example: 4 stop losses, average loss -10.18%
- โ ๏ธ Warning: High stop loss ratio indicates strategy is risky
-
force_exit (Force Close)
- Open positions at backtest end are forcibly closed
- Example: 4 trades, average -0.66%
- ๐ These are the trades from the "Open Positions Report" above
Key Observations:
- โ Most trades (48/56 = 85.7%) took profit through ROI
- โ ๏ธ 4 stop losses caused -40.670 USDT in losses
- ๐ Without stop losses, total return would be +46 USDT (5.338 + 40.670)
๐ Table 5: SUMMARY METRICS (Summary Metrics)
SUMMARY METRICS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Metric โ Value โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Backtesting from โ 2025-09-01 00:00:00 โ
โ Backtesting to โ 2025-09-30 00:00:00 โ
โ Trading Mode โ Spot โ
โ Max open trades โ 5 โ
โ โ โ
โ Total/Daily Avg Trades โ 56 / 1.93 โ
โ Starting balance โ 1000 USDT โ
โ Final balance โ 1005.338 USDT โ
โ Absolute profit โ 5.338 USDT โ
โ Total profit % โ 0.53% โ
โ CAGR % โ 6.93% โ
โ Sortino โ 0.86 โ
โ Sharpe โ 1.22 โ
โ Calmar โ 9.71 โ
โ SQN โ 0.24 โ
โ Profit factor โ 1.12 โ
โ Expectancy (Ratio) โ 0.10 (0.01) โ
โ Avg. daily profit โ 0.184 USDT โ
โ Avg. stake amount โ 99.739 USDT โ
โ Total trade volume โ 11198.536 USDT โ
โ โ โ
โ Best Pair โ BNB/USDT 0.91% โ
โ Worst Pair โ ETH/USDT -0.59% โ
โ Best trade โ SOL/USDT 1.45% โ
โ Worst trade โ SOL/USDT -10.18% โ
โ Best day โ 7.981 USDT โ
โ Worst day โ -29.492 USDT โ
โ Days win/draw/lose โ 19 / 8 / 3 โ
โ Min/Max/Avg. Duration Winners โ 0d 01:00 / 8d 02:35 / 1d 15:48 โ
โ Min/Max/Avg. Duration Losers โ 0d 04:10 / 12d 21:25 / 5d 16:42 โ
โ Max Consecutive Wins / Loss โ 40 / 3 โ
โ Rejected Entry signals โ 0 โ
โ Entry/Exit Timeouts โ 0 / 0 โ
โ โ โ
โ Min balance โ 1000.996 USDT โ
โ Max balance โ 1040.2 USDT โ
โ Max % of account underwater โ 3.62% โ
โ Absolute drawdown โ 37.676 USDT (3.62%) โ
โ Drawdown duration โ 4 days 07:15:00 โ
โ Profit at drawdown start โ 40.2 USDT โ
โ Profit at drawdown end โ 2.524 USDT โ
โ Drawdown start โ 2025-09-21 03:50:00 โ
โ Drawdown end โ 2025-09-25 11:05:00 โ
โ Market change โ 6.66% โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Core Metrics Detailed Explanation:
๐ Profit Metrics
-
Total profit %: Total return rate 0.53%
- 1000 USDT โ 1005.338 USDT
-
CAGR %: Annualized return rate 6.93%
- If this return rate continues for a year, annualized return 6.93%
- โ ๏ธ Note: This is just 1 month of data annualized, doesn't represent real annualized return
-
Avg. daily profit: Average daily profit 0.184 USDT
- Average profit of 0.184 USDT per day
๐ Risk Metrics
-
Max % of account underwater (Maximum Drawdown): 3.62%
- Maximum decline from highest point to lowest point
- Example: Account highest 1040.2 USDT, lowest fell to 1002.524 USDT
- Calculation: (1040.2 - 1002.524) / 1040.2 = 3.62%
- โ < 10%: Controllable risk
- โ ๏ธ 10-20%: Moderate risk
- โ > 20%: High risk
-
Sharpe Ratio: 1.22
- Risk-adjusted return metric
- โ > 1.0: Good
- โ > 2.0: Excellent
- โ < 0: Loss
-
Sortino Ratio: 0.86
- Similar to Sharpe, but only considers downside risk
- โ > 1.0: Good
๐ Win/Loss Statistics
-
Win rate: 89.3% (50 wins / 56 trades)
- โ > 60%: Good
- โ ๏ธ < 50%: Need to improve profit/loss ratio
-
Profit factor: 1.12
- Total profit / Total loss
- Calculation: (48.639 + ...other profits) / (40.670 + ...other losses)
- โ > 1.5: Excellent
- โ > 1.0: Profitable
- โ < 1.0: Loss
-
Max Consecutive Wins / Loss: 40 consecutive wins / 3 consecutive losses
- Longest winning and losing streaks
- โ ๏ธ Long losing streaks can affect psychology
๐ Other Key Metrics
-
Best trade / Worst trade: +1.45% / -10.18%
- Best and worst single trades
- Risk Warning: Worst trade -10.18% = strategy's stoploss
-
Days win/draw/lose: 19 profitable days / 8 breakeven / 3 losing days
- Daily profit/loss statistics
- ๐ 19 out of 30 days were profitable
-
Market change: 6.66%
- Market increase during same period
- Comparison: Strategy earned 0.53%, market rose 6.66%
- โ ๏ธ Underperformed market! Simply holding BTC might have been better
5.6 How to Judge Strategy Quality?
Based on this backtest report, let's evaluate Strategy001:
โ Advantages
- High win rate: 89.3%, very stable
- Small drawdown: 3.62%, controllable risk
- High take-profit efficiency: 85.7% of trades took profit through ROI
- Sharpe > 1: Good risk-adjusted returns
โ Disadvantages
- Low returns: 0.53%, underperformed market (6.66%)
- Large stop loss: -10% stop loss causes large single losses
- Long holding time: Average 2 days, low capital utilization
- Small sample: Only 56 trades
๐ฏ Overall Evaluation
Rating: โญโญโญ / โญโญโญโญโญ
Applicable Scenarios:
- โ Conservative investors
- โ Range-bound markets
- โ Bull markets (underperforms market)
- โ Pursuing high returns
Recommendations:
- Can try Dry-run verification
- Need to optimize stop-loss strategy
- Consider reducing holding time
- Not recommended in bull markets
๐ Common Errors and Solutions
Error 1: No data found
ERROR - No data found. Terminating.
Causes:
- Timeframe mismatch (strategy uses 5m, but only 1h data downloaded)
- No data in time range
Solution:
# Check timeframe used by strategy
grep "timeframe" user_data/strategies/Strategy001.py
# Output: timeframe = '5m'
# Download corresponding data
freqtrade download-data -c config.json --days 30 --timeframes 5m
Error 2: Strategy not found
ERROR - Impossible to load Strategy 'Strategy001'
Causes:
- Strategy name spelling error
- Strategy file not in strategies directory
Solution:
# List all available strategies
freqtrade list-strategies -c config.json
# Confirm strategy name (case sensitive)
Error 3: Timeframe mismatch
ERROR - Timeframe '15m' is not available. Available: ['5m']
Causes:
- Backtest specified timeframe doesn't match downloaded data
Solution:
# Method 1: Download corresponding timeframe data
freqtrade download-data -c config.json --days 30 --timeframes 15m
# Method 2: Backtest using existing timeframe
freqtrade backtesting -c config.json --strategy Strategy001 --timeframe 5m
๐ Practical Tasks
Task 1: Basic Backtesting (Required)
Objective: Complete your first backtest
# 1. Backtest Strategy001 (2025-09-01 to 2025-09-30)
freqtrade backtesting \
-c config.json \
--strategy Strategy001 \
--timerange 20250901-20250930
# 2. Record the following metrics:
- Total trades: _______
- Win rate: _______
- Total return: _______
- Maximum drawdown: _______
- Sharpe Ratio: _______
Submission:
- [ ] Backtest report screenshot
- [ ] Key metrics record table
- [ ] Your strategy evaluation (100-200 words)
Task 2: Error Diagnosis (Optional)
Objective: Familiarize with common errors and solutions
Try executing the following "error" commands, observe error messages, and fix them:
# Error 1: Non-existent strategy
freqtrade backtesting -c config.json --strategy NotExistStrategy
# Error 2: Non-existent trading pair
# First edit config.json, add "FAKE/USDT" to pair_whitelist
# Error 3: Timeframe without downloaded data
freqtrade backtesting -c config.json --strategy Strategy001 --timeframe 1h
# For each error:
# 1. Record error message
# 2. Analyze cause
# 3. Write solution
Task 3: Comparative Analysis (Advanced)
Objective: Compare backtest results from different time ranges
# Backtest 1 month
freqtrade backtesting -c config.json --strategy Strategy001 --timerange 20250901-20250930
# Backtest 3 months (need to download data first)
freqtrade backtesting -c config.json --strategy Strategy001 --timerange 20250701-20250930
Create comparison table:
| Metric | 1 Month | 3 Months | Difference Analysis |
|---|---|---|---|
| Number of trades | |||
| Win rate | |||
| Total return | |||
| Maximum drawdown | |||
| Sharpe |
Thinking Questions:
- Are the 1-month and 3-month results very different?
- Which time range is more credible?
- If differences are large, what does that indicate?
๐ Extended Reading
Recommended Articles
Related Documentation
- ๐ TESTING_GUIDE.md - Complete Testing Guide
- ๐ STRATEGY_SELECTION_GUIDE.md - Strategy Selection Guide
๐ Post-Class Quiz
Multiple Choice
-
What is the main purpose of backtesting?
- A. Predict future prices
- B. Evaluate strategy historical performance
- C. Guarantee live trading profits
- D. Replace live trading
-
What happens with a 90% win rate but 1:10 profit/loss ratio strategy?
- A. Big profits
- B. Big losses
- C. Breakeven
- D. Cannot determine
-
What does maximum drawdown of 30% mean?
- A. Maximum 30% loss per trade
- B. Fell 30% from highest to lowest point
- C. 70% win rate
- D. 30% total loss
-
What does Sharpe Ratio < 0 indicate?
- A. Strategy is profitable
- B. Strategy is losing
- C. Risk is too high
- D. Insufficient data
-
Why doesn't good backtesting guarantee good live trading?
- A. History doesn't repeat
- B. Slippage and psychological factors exist
- C. Possible overfitting
- D. All of the above
Calculation Problems
Initial capital 1000 USDT, final 1053 USDT, what is the total return rate?
10 trades, 7 wins 3 losses, what is the win rate?
Account rose from 1000 to 1200, then fell to 1100, what is the maximum drawdown?
Practical Problems
-
Please explain this backtest result:
- Number of trades: 200
- Win rate: 45%
- Average profit: +2%
- Average loss: -1%
- Is this strategy profitable or losing?
If a strategy earns 50% in bull markets and loses 30% in bear markets, would you use it? Why?
Answers at end โฌ๏ธ
โ Learning Checklist
Before proceeding to the next lesson, ensure you have:
- [ ] Understood what backtesting is and its purpose
- [ ] Able to execute basic backtesting commands
- [ ] Able to read and understand the 5 tables in backtest reports
- [ ] Know how to judge strategy quality
- [ ] Able to identify and resolve common errors
- [ ] Completed at least 3 backtests with different strategies/time ranges
- [ ] Understood limitations of backtesting
If you have any questions, please return to the corresponding section for review, or ask in the community.
๐ฏ Next Lesson Preview
Lesson 6: Strategy Performance Analysis
In Lesson 6, we will:
- Deep dive into how to evaluate strategy quality
- Master multi-dimensional strategy comparison methods
- Learn to create professional strategy comparison tables
- Understand the importance and weighting of different metrics
๐ฌ Post-Class Discussion
Thinking Questions
- What do you think constitutes a "good strategy"?
- If backtesting returns are high but drawdown is also large, would you use it?
- Backtesting 1 month vs backtesting 1 year, which is more important?
Share Your Backtest Results
Welcome to share in the community:
- Your first backtest results
- Problems encountered and solutions
- Evaluation of Strategy001
๐ Quiz Answers
- B
- B (9 small wins + 1 big loss = overall loss)
- B
- B
- D
- (1053 - 1000) / 1000 = 5.3%
- 7 / 10 = 70%
- (1200 - 1100) / 1200 = 8.33%
- Profitable. Expected return = 45% ร (-1%) + 55% ร 2% = 0.65% > 0
- No. Although it looks profitable, can't predict if future is bull or bear, too risky.
Happy learning! Ready for Lesson 6? ๐
๐ Course Feedback: If any part of this lesson is unclear, feel free to provide suggestions!
Top comments (1)
The LEFT OPEN TRADES section says those trades are excluded from total profit, but the EXIT REASON table includes force_exit in the same total. I would reconcile those rows against the exported trade file before using the headline result. For a challenge test, terminal closure should also be labelled separately from the daily equity path: a trade summary alone cannot tell you whether an intraday limit was crossed.