Hello! Welcome back.
In our last lesson, you built the essential component for any backtest: a script that generates a clean, structured list of every trade a strategy makes. You now have a pandas DataFrame where each row represents a single trade with its entry and exit points. This is the raw data that holds the secrets to your strategy's performance.
This lesson will teach you how to unlock those secrets. We will address the learning outcome: Calculate and interpret key performance metrics: win rate, profit factor, and drawdown. Think of these metrics as the Key Performance Indicators (KPIs) for your trading strategy. Just as a marketer uses KPIs to measure a campaign's success, you'll use these metrics to objectively evaluate your automated trading bots. By the end of this lesson, you'll be able to move beyond a simple equity curve and quantify a strategy's profitability, efficiency, and risk.
The "Big Three" Performance Metrics
A backtest can generate dozens of statistics, but a few stand out as the most critical for an initial assessment. We'll focus on three:
- Win Rate (% Profitable): How often does the strategy win?
- Profit Factor: How much bigger are the wins than the losses?
- Maximum Drawdown: What is the most pain the strategy will inflict on your account?
Let's start with a quick high-level overview of these concepts.
How to Interpret Backtest Results: A Trader's Guide to Smarter Strategy Decisions
This article from FX Replay, 'How to Interpret Backtest Results', gives a great introduction to the key data points we look for after running a backtest. It will help you get familiar with the terminology.
Please read the short introduction and the section 'What Are Backtest Results, Really?'. Focus on the bulleted list of 'Key data points' to see how our three core metrics fit into the bigger picture.
Now, let's dive into each metric one by one, learning how to calculate and, more importantly, how to interpret them.
1. Win Rate: The Seductive Metric
The Win Rate (or Percent Profitable) is the most straightforward metric. It simply tells you what percentage of your trades were winners.
Calculation:
In Python, assuming you have a trade log DataFrame df_trades from the previous lesson, you would first calculate the Profit/Loss (P/L) for each trade. For a simple long-only strategy:
# Assuming 'entry_price' and 'exit_price' columns exist
df_trades['pnl'] = df_trades['exit_price'] - df_trades['entry_price']
# Calculate Win Rate
winning_trades = df_trades[df_trades['pnl'] > 0].shape[0]
total_trades = df_trades.shape[0]
win_rate = (winning_trades / total_trades) * 100 if total_trades > 0 else 0
print(f"Win Rate: {win_rate:.2f}%")
Interpretation:
A high win rate feels good psychologically, but it can be dangerously misleading. A strategy that wins 90% of the time can still lose money if the 10% of losing trades are massive. Conversely, many highly successful trend-following and ICT strategies have low win rates (30-45%) but are very profitable because their winners are significantly larger than their losers.
This next resource provides a perfect illustration of this crucial concept.
Profit Factor in Trading: Formula, Good Benchmarks & Win Rate Comparison
It's vital to understand that win rate alone means nothing. This article, 'Profit Factor in Trading', has an excellent comparison of two strategies that demonstrates why a lower win rate can actually be much more profitable.
Read the section titled 'Which Strategy Wins?' and study the 'Calculation Breakdown' for Strategy A and Strategy B. This is a fundamental concept in quantitative trading that you must grasp.
2. Profit Factor: The Efficiency Metric
This brings us to a more powerful metric: the Profit Factor. It directly compares the total money made on winning trades to the total money lost on losing trades. It answers the question: "For every dollar I lost, how many dollars did I make?"
Calculation:
Where Gross Profit is the sum of all winning trades, and Gross Loss is the sum of all losing trades (taken as a positive value).
Python Implementation:
# Assuming the 'pnl' column is already calculated
gross_profit = df_trades[df_trades['pnl'] > 0]['pnl'].sum()
gross_loss = abs(df_trades[df_trades['pnl'] < 0]['pnl'].sum())
profit_factor = gross_profit / gross_loss if gross_loss > 0 else float('inf')
print(f"Profit Factor: {profit_factor:.2f}")
Interpretation:
- PF > 1.0: The strategy is profitable.
- PF < 1.0: The strategy is losing money.
- PF = 1.5: For every $1 lost, the strategy made $1.50. This is often considered "good."
- PF > 2.0: The strategy is very strong.
The Profit Factor is a much better indicator of a strategy's true profitability than the win rate because it accounts for the magnitude of wins and losses.
3. Maximum Drawdown: The "Pain" Metric
The Maximum Drawdown (Max DD) measures the largest peak-to-trough decline in your account's equity curve during the backtest period. In simple terms, it's the worst losing streak your strategy experienced, measured in percentage terms from its highest point.
Why it's important: This metric quantifies the risk and the psychological "pain" of a strategy. A strategy might have an amazing Profit Factor of 3.0, but if it comes with a 70% Max Drawdown, would you be able to stick with it when your account is down by that much? For most traders, the answer is no.
Many professional quants and portfolio managers look at this metric first. If the drawdown is unacceptable, they don't even bother looking at the profits.
What Makes a Really Good TradingView Strategy? Max Drawdown, Profit Factor, Win Rate, ...
Let's see why analysts prioritize drawdown. This video from Michael Automates explains why Maximum Drawdown is the first metric he checks when evaluating any strategy.
Watch from 03:02 to 03:50. Listen to how the presenter frames drawdown as a primary filter for risk before even considering the potential rewards.
Python Implementation:
Calculating drawdown requires you to first have an equity curve (the cumulative P/L over time).
# 1. Calculate the equity curve (cumulative P/L)
initial_capital = 10000 # Example starting capital
df_trades['cumulative_pnl'] = df_trades['pnl'].cumsum()
df_trades['equity'] = initial_capital + df_trades['cumulative_pnl']
# 2. Calculate the running maximum (previous peaks) of the equity curve
df_trades['previous_peaks'] = df_trades['equity'].cummax()
# 3. Calculate the drawdown as the percentage drop from the peak
df_trades['drawdown'] = (df_trades['equity'] - df_trades['previous_peaks']) / df_trades['previous_peaks']
# 4. The maximum drawdown is the smallest value in the drawdown series
max_drawdown = df_trades['drawdown'].min()
print(f"Maximum Drawdown: {max_drawdown:.2%}")
Here is an image showing a self-contained Python function that does this:

Test your understanding!
A strategy has a 35% win rate and a Profit Factor of 1.9. Another has an 80% win rate and a Profit Factor of 1.1. If both have a similar Maximum Drawdown, which strategy is likely more robust and profitable in the long run? Why?
Show answer
The strategy with the 35% win rate and 1.9 Profit Factor is likely superior. The Profit Factor of 1.9 indicates it makes $1.90 for every $1.00 it loses, showing a strong "edge." The strategy with the 1.1 Profit Factor is barely profitable (making only $1.10 for every $1.00 lost) and could easily become a losing strategy with small changes in market conditions or transaction costs, despite its high win rate.
Putting It All Together: A Holistic View
No single metric tells the whole story. You must interpret them together.
- A high Win Rate with a high Profit Factor is great.
- A low Win Rate is only acceptable if the Profit Factor is high.
- A high Profit Factor is only attractive if the Maximum Drawdown is psychologically tolerable for you.
This chart provides an excellent mental model for the relationship between win rate and profit factor.

Finally, let's watch how these metrics are used in a practical comparison to select the best strategy among several alternatives.
What Makes a Really Good TradingView Strategy? Max Drawdown, Profit Factor, Win Rate, ...
Now, let's see a real-world example of using these KPIs to make a decision. This clip shows a side-by-side comparison of several strategies.
Watch from 12:07 to 14:02. The presenter applies Max Drawdown, Profit Factor, and Win Rate to compare strategies. Notice his thought process: he immediately discards strategies with unacceptably high drawdowns and then uses a combination of the other metrics to identify the superior system.
Conclusion
You have now learned how to calculate and interpret the three most important performance metrics for any trading strategy. This moves you from simply building a backtester to being able to critically analyze its output—a crucial skill for developing automated bots.
Key Takeaways:
- Win Rate measures the frequency of wins but is meaningless on its own.
- Profit Factor measures the efficiency of profitability (
Gross Profit / Gross Loss) and is a more robust metric than win rate. A value above 1.5 is generally considered good. - Maximum Drawdown measures the largest equity decline and is a critical indicator of risk and psychological sustainability.
- These metrics must be analyzed holistically to get a true picture of a strategy's performance and risk profile.
Preview of the Next Lesson:
The numbers we calculated today—especially drawdown—are derived from the equity curve. In the next lesson, we will focus on the equity curve itself. You will learn to analyze a backtest's equity curve to assess strategy performance and volatility. A visual inspection of the curve can reveal patterns, like consistency or long flat periods, that the numbers alone might not capture.