
Algorithmic Trading 101: Strategies, Backtesting & Risk Management
A practitioner-oriented course covering the core building blocks of systematic trading: how to backtest without fooling yourself, the statistics behind mean-reversion and momentum strategies, and how to size positions and manage risk so a good strategy doesn't blow up your account.
Course Syllabus
9 / 10Chapter 9: Drawdown Control — Stop Losses and CPPI
Chapter 9: Drawdown Control — Stop Losses and CPPI
Chapter 8 gave us a mathematical framework for sizing positions to maximize long-term compounded growth — the Kelly formula, tempered with half-Kelly caution and simulation-based adjustments for fat-tailed returns. But even a perfectly Kelly-sized strategy, built on a genuinely validated edge, can still experience a drawdown so large that it becomes practically or psychologically unbearable — even if it's still theoretically 'optimal' on paper.
This is where drawdown control tools come in. Unlike position sizing, which asks 'how much should I bet, on average, to grow fastest?', drawdown control asks a different question entirely: 'what is the worst-case decline I am willing to tolerate, and how do I structurally enforce that limit?'
This chapter examines two very different approaches to this problem — the blunt, familiar stop loss, and the more sophisticated Constant Proportion Portfolio Insurance (CPPI) — and explains a genuinely counterintuitive finding: stop losses, which feel like an obviously good idea, can actually hurt the backtested performance of mean-reversion strategies, even while they remain a natural, logical fit for momentum strategies.
Why this chapter matters: Drawdown control isn't just about survival — it's about matching the right risk-limiting tool to the right kind of strategy. Applying the wrong tool to the wrong strategy family can quietly erode an otherwise genuine edge.
1. Why Drawdown Control Is a Distinct Problem from Position Sizing
The Gap Between 'Optimal on Average' and 'Tolerable in the Worst Case'
The Kelly formula from Chapter 8 optimizes for the average long-term compounded growth rate across many possible future outcomes. But 'average' hides a lot of variation — even a Kelly-sized strategy can, in an unlucky historical stretch, experience a severe, sustained drawdown before eventually recovering.
Classic Example: Suppose a half-Kelly-sized mean-reversion strategy on a cointegrated pair of Indian private banks (built using Chapter 5's Bollinger band framework) has a backtested track record showing an excellent long-run compounded annual growth rate — but buried within that same backtest is an 18-month stretch, say spanning a period of unusual macro stress, where the strategy's equity curve declined by 35% before eventually recovering and going on to new highs. Mathematically, the Kelly framework already 'knows about' this drawdown — it's baked into the variance term used to compute optimal leverage. But knowing about it in the mean/variance sense is very different from surviving it in real life: an 18-month, 35% drawdown might exceed what you, your investors, or your broker's margin requirements can actually tolerate, regardless of whether the strategy eventually recovered in the backtest.
Two Distinct Goals
This distinction motivates two genuinely different risk-management questions, both covered in this chapter:
- "How do I cut losses on individual losing trades before they compound into something dangerous?" → the domain of the stop loss.
- "How do I structurally cap my entire account's maximum possible drawdown, regardless of what any individual trade does?" → the domain of CPPI.

2. Stop Losses: The Familiar Tool
What a Stop Loss Does
A stop loss is a rule that automatically exits a position once it has lost a predetermined amount — whether measured in absolute price terms, percentage terms, or a multiple of a volatility measure like the Average True Range (ATR). It's the most familiar risk-management tool in trading, and for good reason: it directly answers the intuitive question, 'how much am I willing to lose on this specific trade before admitting I was wrong?'
Classic Example: A trader running an intraday breakout strategy on Bank Nifty futures might set a stop loss at 40 points below the entry price on a long position — if Bank Nifty declines by 40 points from entry, the position is automatically closed, capping the loss on that specific trade regardless of how much further the decline might have continued.
The Counterintuitive Finding: Stop Losses Can Hurt Mean-Reversion Backtests
Here is the central, genuinely surprising lesson of this section: applying a stop loss to a mean-reversion strategy will usually make its backtested performance look worse — not better.
This seems backwards at first. Shouldn't cutting losses always help? The explanation lies in a subtle interaction with survivorship bias, a concept we first introduced in Chapter 1.
Remember: a mean-reversion strategy, by construction, is built on the premise that a price deviation will eventually revert. If your backtest is built on a series that genuinely did mean-revert historically (which it must have, or the backtest wouldn't show mean-reversion profits in the first place), then any trade that appeared to be a large, painful drawdown in the middle of its life eventually recovered and became profitable by the time the position was closed — that's precisely what "mean reversion validated by backtest" means. A stop loss, by exiting the position partway through that temporary drawdown, locks in a loss on a trade that the backtest's own historical data shows would have eventually recovered.
Classic Example: Consider the Bollinger-band mean-reversion strategy on the Britannia–Nestlé India spread we built in Chapter 5. Suppose one particular historical trade saw the spread widen well beyond the entry threshold before eventually reverting and closing profitably at the Bollinger band's exit signal. If a tight stop loss had been layered onto this same backtest, it might have triggered during that temporary widening — locking in a loss on a trade that, according to the very same backtest, was headed toward eventual profitability. Because the backtest already 'knows' (with the benefit of hindsight) that this series mean-reverts, adding a stop loss to that specific historical episode can only remove profitable outcomes from the sample, never add them — mechanically dragging down the reported backtest performance.
Warning: This doesn't mean stop losses are useless for mean-reversion strategies — it means their backtested performance impact is structurally biased to look negative, precisely because a backtest only include instances where reversion did eventually occur. In live trading, you'll inevitably encounter genuine black-swan cases where a series that looked mean-reverting in your historical sample stops reverting entirely — a structural break, a fundamental change in the underlying relationship (think back to Chapter 4's warning about needing a plausible, durable economic rationale). A stop loss provides essential protection against exactly this kind of scenario, even though it will make every backtested trade in your historical sample look worse on paper.
The Practical Resolution
Given this tension, a sensible practical approach for mean-reversion strategies is:
- Set the stop loss wide enough that it is never actually triggered within your validated backtest sample. This preserves the backtest's reported performance (since the stop loss doesn't interfere with any trade that actually occurred historically) while still providing a hedge against a genuine black-swan event outside the range of anything seen in the backtest.
- Think of this stop loss as tail-risk insurance, not a performance-enhancing tool. Its job isn't to improve your average backtested return — it's to protect against the scenario where your entire mean-reversion premise (a validated, cointegrated relationship) breaks down structurally, something no historical backtest sample can fully anticipate.
Note: This is a direct, practical extension of Chapter 4's core lesson — statistical cointegration is not a permanent, guaranteed property. A wide, rarely-triggered stop loss is your insurance policy against the day a relationship you validated statistically simply stops holding, for reasons the historical data couldn't have shown you in advance.
Why Stop Losses Are Different for Momentum Strategies
For momentum strategies (Chapter 6), the situation is entirely different — a stop loss is a natural, logical component of the strategy's own premise, not a compromise.
Recall that momentum strategies bet on continuation: a rising trend keeps rising, a falling trend keeps falling. If a momentum position starts losing money shortly after entry, that is direct, immediate evidence against the very thesis the trade was based on — the trend may be reversing, weakening, or was never as strong as the entry signal suggested. Cutting the loss quickly isn't fighting against the strategy's logic; it's a direct, consistent application of it.
Classic Example: Consider the cross-sectional momentum strategy on Nifty 500 stocks from Chapter 6 — long the top decile of trailing-return performers, short the bottom decile. If a stock in the long basket, entered because of strong recent relative performance, begins declining sharply shortly after entry, that decline is itself informative: it suggests the stock's momentum characteristic may already be fading, weakening the very rationale for holding it. A stop loss here isn't overriding the strategy's logic — it's reinforcing it, exiting a position once the evidence for the original thesis has visibly deteriorated.

3. Constant Proportion Portfolio Insurance (CPPI): Capping the Whole Account
The Core Idea
Where a stop loss operates at the level of individual trades, Constant Proportion Portfolio Insurance (CPPI) operates at the level of the entire account. It's designed for traders who need a hard, structural cap on maximum drawdown — rather than accepting whatever drawdown a Kelly-style constant-leverage scheme happens to produce (recall Chapter 8's example of an account being forced to sell into losses and buy into gains to maintain constant leverage).
CPPI works by dynamically dividing your total capital into two conceptual buckets:
- A risk-free (or low-risk) 'cushion' — capital held in a safe, stable instrument.
- A risky 'active' allocation — capital deployed into your actual trading strategy.
The key mechanism: as your account's total value approaches a predetermined floor (the minimum acceptable account value, below which you never want to fall), CPPI automatically shifts more capital into the safe cushion and less into the risky strategy — reducing exposure exactly when you're closest to the danger zone. Conversely, when the account is well above the floor (comfortably profitable), CPPI allows a larger allocation to the risky strategy, letting you capture more of the upside when there's more of a buffer to work with.
Classic Example: Suppose you run a systematic strategy portfolio (perhaps combining the mean-reversion and momentum strategies from earlier chapters) with a starting capital of ₹20,00,000, and you've decided you never want your account to fall below a floor of ₹16,00,000 (an 80% floor). Under a CPPI scheme, when your account value is comfortably above this floor — say, at ₹22,00,000 — a relatively large proportion of that capital can be allocated to the active trading strategies. But if a string of losses brings the account down to ₹17,00,000 (getting close to the ₹16,00,000 floor), CPPI automatically and progressively reduces the proportion allocated to active trading, shifting more into the safe cushion — reducing the account's sensitivity to further losses right when it matters most, making it statistically very unlikely (though never mathematically guaranteed in extreme gap-risk scenarios) that the account will actually breach the floor.
CPPI vs. Constant Leverage: The Key Difference
This is a meaningfully different behavior from the constant-leverage approach in Chapter 8. Under pure constant leverage (Kelly-style), your exposure is always a fixed multiple of current equity — you keep adding to positions after gains and cutting after losses, all the way down to a very low equity level, with no special protective floor. Under CPPI, your exposure to the risky strategy shrinks disproportionately faster as you approach the floor — actively working to prevent the account from ever reaching zero, at the cost of giving up some upside participation during strong winning streaks (since capital is progressively 'locked in' as safe cushion rather than continuously reinvested at full intensity).
Note: CPPI does not eliminate risk entirely — it manages it. In an extreme, fast-moving market event (a genuine overnight gap, for instance, driven by unexpected news between one trading session's close and the next session's open — a real risk in Indian markets around events like surprise policy announcements or global market shocks), the account's value could theoretically still gap below the intended floor before the CPPI mechanism has a chance to rebalance, since rebalancing typically happens at discrete intervals (e.g., daily) rather than continuously. CPPI substantially reduces the probability of breaching the floor under normal market conditions — it does not provide an absolute, unconditional guarantee.

When CPPI Makes Sense
CPPI is particularly well-suited to situations where:
- You (or your investors) have a genuinely hard, non-negotiable floor — for example, a fund mandate that legally or contractually cannot fall below a certain capital preservation threshold.
- You want to participate meaningfully in a strategy's upside during good periods, while still sleeping soundly knowing there's a structural mechanism actively working to prevent a catastrophic, account-ending drawdown.
- You're combining multiple strategies (as discussed in Chapter 8) and want an account-level safety net that sits above any individual strategy's own risk controls, rather than relying solely on position-level stop losses.
4. Choosing the Right Tool for the Right Strategy
Bringing this chapter's lessons together into a practical decision framework:
| Situation | Recommended Tool | Why |
|---|---|---|
| Mean-reversion strategy, individual trade level | Wide stop loss, rarely triggered in backtest | Protects against structural relationship breakdown without dragging down validated backtest performance |
| Momentum strategy, individual trade level | Tighter, logic-consistent stop loss | Directly reinforces the strategy's own continuation-based premise |
| Whole-account, hard floor requirement | CPPI | Structurally caps maximum drawdown while preserving meaningful upside participation |
| Whole-account, no hard floor, comfortable with Kelly-style variability | Constant leverage (Chapter 8) alone | Maximizes long-term theoretical growth rate, accepting the drawdown variability that comes with it |
Golden Rule: Don't reach for a stop loss reflexively just because it 'feels safer.' Ask which strategy family you're protecting, and what specifically you're protecting against — a temporary, historically-validated deviation (where a wide, rarely-triggered stop is appropriate), or a genuine trend-reversal signal (where a tighter, logic-consistent stop is appropriate). And for whole-account protection, recognize that CPPI and simple constant-leverage Kelly sizing are two genuinely different philosophies, not the same tool wearing different names.
5. Key Takeaways
- Drawdown control is a distinct problem from position sizing: Kelly-style sizing (Chapter 8) optimizes average long-term growth, but doesn't guarantee that any single realized drawdown will be tolerable in practice.
- Stop losses cut losses on individual trades once a predetermined loss threshold is reached — intuitive, but their effect differs sharply by strategy type.
- For mean-reversion strategies, stop losses typically make backtested performance look worse, because a backtest only contains trades that (by the nature of validated mean reversion) eventually recovered — a stop loss locks in losses on trades the backtest's own data shows would have turned profitable. The practical fix is a wide stop loss, set so it's never triggered within the validated backtest sample, treated as insurance against a genuine structural breakdown rather than a performance-enhancing tool.
- For momentum strategies, stop losses are a natural, logic-consistent extension of the strategy's own premise — a loss shortly after entry is direct evidence the continuation thesis may be failing, so cutting it quickly reinforces rather than fights the underlying logic.
- Constant Proportion Portfolio Insurance (CPPI) operates at the whole-account level, dynamically shifting capital between a safe 'cushion' and an active risky allocation based on proximity to a predetermined floor — shrinking risky exposure as the account nears the floor, and expanding it when there's more of a buffer, providing a structural (though not absolute, due to gap risk) cap on maximum drawdown.
- Choosing between these tools requires matching the tool to the actual risk you're managing: individual-trade risk versus whole-account risk, and mean-reversion logic versus momentum logic — applying the wrong tool to the wrong situation can quietly erode a genuinely validated edge.
Coming up in Chapter 10: In our final chapter, we bring everything together — showing how mean-reversion and momentum strategies tend to perform in opposite market regimes, and how combining both, layered with the position sizing and drawdown control discipline from Chapters 8 and 9, builds a more resilient, complete algorithmic trading approach.