Quant500 Academy

4. Reading the backtest chart: price, trades and equity

Level 12: Backtesting and Real Risk Metrics

The chart Backtrader produces with cerebro.plot() is a visual representation of the strategy's performance over the backtesting period. Reading it well is a skill in itself: most of a strategy's serious problems show up in the chart before they show up in the metrics table. These are its main components.

1. The price chart

2. Portfolio value

3. Trades

4. Indicators

If you have used additional indicators (MACD, RSI, and so on), they are drawn in separate panels below the price, showing how they evolve.

5. Zoom and pan

You can zoom in and out and pan across the chart to inspect specific stretches in detail. That is exactly what you should do when something does not add up.

How to analyze it

Patterns that give problems away

There are three pictures that should set off an immediate alarm.

A flat equity curve with a huge number of trade markers means the strategy trades non-stop and costs are eating the gross margin. The signal may be real and still not be exploitable.

A curve that rises in a single step (flat for years with a vertical jump on one specific date) indicates that the entire result depends on a single trade. Remove that date and there is probably nothing left.

A cash line that separates from the portfolio value and never comes back reveals an open position that was never closed: the rest of the curve is the underlying asset, not your strategy. Many spectacular curves are an accidental buy and hold.

Finally, test sensitivity: check how much the results change when you vary the parameters, and make sure the strategy is not excessively optimized for the period tested.

To go deeper into this lesson

The rest of Quant500

What you are learning, applied to the index every day:

The model portfolio, weekly in your inbox

Every Saturday, its week in one minute: how it went, the best and the worst, and which insiders bought with their own money. Plus, the day the model is rebuilt, which stocks come in and which go out. A simulation, not advice. At most one email a week, no ads, no account; one-click unsubscribe. Made by one person: Pol Gracia.

A model portfolio with simulated results, not a personalized recommendation. Your email is used for this only: privacy.

Behind the Academy and the rest of Quant500 there is one person: Pol Gracia Serrahima.