Hello! Welcome back to the final lesson in our module on backtesting.
In our last session, we quantified your strategy's performance by calculating the "big three" metrics: Win Rate, Profit Factor, and Maximum Drawdown. You learned that a high win rate isn't everything and that a combination of efficiency (Profit Factor) and risk (Max Drawdown) gives a much clearer picture. The code you wrote to calculate Max Drawdown required generating an equity curve—the cumulative profit of your strategy over time.
Today, we'll focus entirely on that equity curve. This lesson directly addresses the learning outcome: Analyze a backtest's equity curve to assess strategy performance and volatility. While the metrics give you the numbers, the equity curve tells the story. By learning to read its shape, you can understand a strategy's "personality"—is it a steady earner, or a volatile beast? This visual analysis is a critical skill for deciding whether a strategy is robust enough to include in your automated trading arsenal.
1. The Equity Curve: Your Strategy's Financial Biography
The equity curve is a graph plotting your account's value over the duration of the backtest. It's the single most important visualization for assessing performance at a glance.
First, let's clarify a small but important distinction you'll see in professional trading platforms.
Performance Metrics — The Equity Curve and Drawdown
This article from Medium provides a clear definition of the Equity Curve and distinguishes it from the closely related Balance Curve. Understanding this difference is key to interpreting real-time performance.
Please read section '1) The Equity Curve'. Focus on the definitions of the Balance Curve and the Equity Curve and why the Equity Curve is the true representation of performance, as it includes open trades.
To summarize the key point from the reading:
- Balance Curve: Shows your account value after each trade is closed. It only changes when a trade is finished.
- Equity Curve: Shows your account value in real-time, including the profit or loss of any currently open trades.
For our backtesting purposes, where we process a list of completed trades, the two are often very similar. The important takeaway is that the equity curve provides a continuous, moment-to-moment record of your strategy's journey.
An ideal equity curve would be a smooth, straight line pointing up and to the right. Reality, of course, is much messier. A realistic curve will have periods of growth, stagnation, and decline.

2. Reading the Shape: What the Curve Tells You
The overall shape of the equity curve reveals far more than just the final profit. It speaks to the strategy's consistency and risk profile.
Slope and Smoothness
Think of analyzing an equity curve like a marketer analyzing a campaign's growth chart. A steep, steady upward trend is what you want to see.
- The Slope: A steeper slope indicates a higher rate of return. A strategy that makes 50% in one year will have a much steeper curve than one that makes 10% over the same period.
- The Smoothness (Volatility): A smooth, steady curve indicates consistent returns with low volatility. A jagged, spiky curve signifies high volatility—large upswings and downswings. While it might be profitable, a highly volatile strategy can be psychologically difficult to trade.
This article reinforces this point well.
How to Understand Trading Strategy Backtest Results
This article from Veles Finance discusses how to interpret the 'Cumulative Profit' chart, which is another name for the equity curve.
Read the subsection 'Profitability and Return'. Pay attention to the descriptions of what a 'smooth upward line' indicates versus what 'sharp spikes and long horizontal sections' signal.
Plateaus and Drawdowns
Almost every strategy will experience periods where it doesn't perform well. The equity curve makes these periods visually obvious.
- Plateaus (Stagnation): These are long, flat sections where the strategy is breaking even, neither making nor losing significant money. This often means the market conditions are not suitable for your strategy's logic. If a plateau lasts for months, it's a major red flag.
- Drawdowns: These are the valleys in your equity curve—the drops from a previous peak to a subsequent trough. This is the visual representation of the Maximum Drawdown metric you calculated in the last lesson.

3. Beyond Maximum Drawdown: Duration Matters
In the last lesson, we focused on the depth of the drawdown. But the equity curve reveals another crucial dimension: the duration.
Drawdown Duration is the time it takes for your account to recover from a drawdown and return to its previous peak.
Why does this matter? A sharp, deep 20% drawdown that recovers in two weeks is psychologically very different from a slow, grinding 15% drawdown that lasts for six months. The latter can destroy a trader's confidence and cause them to abandon a perfectly good strategy right before it starts working again.
The 6 performance metrics behind WINNING in trading.
Let's hear from a professional trader about the real-world impact of drawdowns and their duration. In this video, he analyzes his own portfolio's performance.
Watch from 04:02 to 07:09. Listen carefully as he discusses not just his drawdown percentage, but how long it lasted ('average drawdown duration') and the psychological challenges ('mental capital') of sitting through it.
This brings a critical human element to our analysis. When you look at an equity curve, ask yourself not just "How much could I lose?" but also "How long could I be losing or going nowhere, and can I handle that?"
4. Practical Analysis: Improving a Strategy
Analyzing an equity curve isn't just a passive exercise. It's the primary tool for diagnosing problems with a strategy and guiding improvements.
I Backtested 21 Years of Market Data in 6 Seconds with ChatGPT: This Changes Everything
Now let's see this in practice. This video shows someone running a backtest, analyzing the initial equity curve, identifying its flaws, and then attempting to improve it.
First, watch from 13:21 to 14:16. The presenter plots the first balance curve and immediately spots problems: a big sideways area and a large drawdown. Then, watch from 17:42 to 18:23, where he compares the original curve to a new one after making a change. This is the core workflow of iterative strategy development.
This iterative loop is fundamental to developing trading bots:
- Backtest the initial idea.
- Analyze the equity curve to identify weaknesses (e.g., excessive volatility, huge drawdowns, long stagnation).
- Hypothesize a change to fix the weakness (e.g., add a stop-loss, change an indicator parameter).
- Re-run the backtest and compare the new equity curve to the old one.
- Repeat.
Test your understanding!
You backtest two strategies.
- Strategy A has a final return of +100% and a Max Drawdown of 40%. Its equity curve is extremely steep for the first half of the test and then completely flat for the second half.
- Strategy B has a final return of +60% and a Max Drawdown of 15%. Its equity curve is a consistently smooth, upward-sloping line across the entire test period.
Which strategy would you prefer to trade, and why? What does the shape of Strategy A's curve tell you?
Show answer
Most traders would prefer Strategy B. Although its total return is lower, its consistency (smooth curve) and lower risk (15% Max DD) make it far more reliable and easier to trade psychologically.
Strategy A's curve indicates it worked incredibly well under a specific market regime that was present in the first half of the data but completely stopped working in the second half. This suggests the strategy is not robust and is highly dependent on certain market conditions, making it unreliable for future trading.
5. Visualizing the Equity Curve in Python
Now, let's bring this to your code. In the previous lesson, you created a pandas DataFrame df_trades with an equity column. Visualizing this is straightforward with a library like Matplotlib.
import pandas as pd
import matplotlib.pyplot as plt
# --- Assume df_trades is your DataFrame from the previous lesson ---
# It should have 'exit_time', 'pnl', 'cumulative_pnl', and 'equity' columns.
# Set the exit time as the index for plotting
df_trades_plot = df_trades.set_index('exit_time')
# Create the plot
plt.figure(figsize=(12, 6))
plt.plot(df_trades_plot['equity'], label='Equity Curve', color='blue')
# Add titles and labels for clarity
plt.title('Strategy Equity Curve')
plt.xlabel('Date')
plt.ylabel('Account Equity ($)')
plt.legend()
plt.grid(True)
# Display the plot
plt.show()
# You can also analyze the drawdown visually
plt.figure(figsize=(12, 6))
plt.plot(df_trades_plot['equity'], label='Equity', color='blue')
plt.plot(df_trades_plot['previous_peaks'], label='Previous Peak', linestyle='--', color='green')
plt.fill_between(df_trades_plot.index, df_trades_plot['equity'], df_trades_plot['previous_peaks'],
where=(df_trades_plot['equity'] < df_trades_plot['previous_peaks']),
color='red', alpha=0.3, label='Drawdown')
plt.title('Equity Curve with Drawdowns')
plt.xlabel('Date')
plt.ylabel('Account Equity ($)')
plt.legend()
plt.grid(True)
plt.show()
This code will generate a clear chart of your strategy's performance, allowing you to perform the visual analysis we've discussed.
Conclusion
You have now completed your introduction to backtesting. You can not only calculate the critical performance statistics but also interpret the visual story told by the equity curve. This dual-pronged analysis is essential for any serious quantitative trader.
Key Takeaways:
- The equity curve is a visual log of your account's value over time.
- A smooth, steep, upward-sloping curve is the ideal, indicating consistent and high returns.
- Jaggedness in the curve represents volatility, which can be psychologically taxing.
- Plateaus (flat sections) signal that the strategy is ineffective in the current market environment.
- Drawdowns are the valleys in the curve. Analyzing their depth and duration is critical for understanding a strategy's risk profile.
- Visual analysis of the equity curve is used to diagnose problems and guide the iterative process of strategy improvement.
Preview of the Next Module:
This lesson concludes our module on backtesting. The skills you've acquired—generating trades, calculating metrics, and analyzing the equity curve—are the final validation steps before you can trust a strategy with real capital.
In our next module, the Capstone, you will synthesize everything you've learned. The very first step will be to document a personal trading plan with strict rules for manual execution. The analysis you've performed here is precisely what will inform your decision on which strategies are worthy of being included in that plan. You've learned how to build and test; now you're ready to plan and execute.