The Drawdown Breaker Blind Spot
Most drawdown guards are built on a simple, reasonable-sounding premise: track losses, and when losses pile up, stop trading. The implementation almost always looks at the same number — realized PnL. A trade closes, the result is booked, the counter increments. Three losses in a row? Cool off. Daily loss limit hit? Flatten and stop.
The problem is that this guard is blind to the exact moment it matters most: while positions are open and bleeding. An unrealized loss of 4% sitting in three open positions is invisible to a realized-PnL guard. The counter still reads zero. Every safety number is green. Then the positions close — and the drawdown "suddenly" appears, fully formed, in one tick of the counter.
This post dissects the blind spot, walks through a scenario where every guard reads fine while the account is drowning, and presents a dual-viewport design: realized drawdown and pool-wide mark-to-market unrealized PnL tracked separately, with the unrealized view gating new entries.
The Blind Spot, Precisely
Consider a typical consecutive-loss breaker:
class RealizedLossBreaker:
def __init__(self, max_consecutive_losses: int = 3,
daily_loss_limit: float = 0.02):
self.max_consecutive_losses = max_consecutive_losses
self.daily_loss_limit = daily_loss_limit
self.consecutive_losses = 0
self.day_start_equity = None
self.realized_pnl_today = 0.0
def on_trade_closed(self, pnl: float) -> None:
self.realized_pnl_today += pnl
if pnl < 0:
self.consecutive_losses += 1
else:
self.consecutive_losses = 0
def can_open_new(self, current_equity: float) -> bool:
if self.consecutive_losses >= self.max_consecutive_losses:
return False
if self.day_start_equity is None:
self.day_start_equity = current_equity
day_return = self.realized_pnl_today / self.day_start_equity
return day_return > -self.daily_loss_limit
This code is correct for what it measures. The issue is what it doesn't measure. on_trade_closed only fires when a trade closes. Between the open and the close, consecutive_losses and realized_pnl_today are frozen. If you have five positions open and all five are down 1.5% each, the breaker sees zero losses, zero realized drawdown, and happily approves a sixth entry.
The guard is not wrong. It is answering a different question than the one you think you're asking. "How much have I lost?" and "How much am I currently down?" are different quantities, and the gap between them is where accounts die.
Why people build it this way
It's not laziness. Realized PnL is easy: it's a single scalar that updates on a discrete event. Unrealized PnL is a moving target that requires a mark price per position, updates continuously, and has to handle stale quotes, funding, and partial fills. The realized-only guard is the 80% solution that ships in an afternoon. It's just missing the 20% that contains the worst days.
A Scenario Where Every Number Looks Fine
Here's the concrete version. Suppose the account is 100,000 units of quote currency, the consecutive-loss breaker is set to 3, and the daily loss limit is 2%. Position sizing is 20,000 notional per entry, so a 1.5% adverse move on a position is a 300-unit unrealized loss (0.3% of equity).
09:30 — Two positions open. Both drift against you. Unrealized: −600. Realized today: 0. consecutive_losses: 0. Breaker: open for business.
10:15 — The market trends against the book. A third and fourth position open (the breaker approved them, because nothing has closed). Unrealized across four positions: −2,400 (2.4% of equity). Realized today: still 0. consecutive_losses: still 0. can_open_new returns True.
11:00 — A fifth entry. Unrealized: −3,600. The daily loss limit is 2%, but it's computed on realized PnL, so it reads 0%. The breaker is structurally incapable of firing.
13:00 — Stops trigger across the book in a correlated move. All five close within twenty minutes. Realized today: −3,900. consecutive_losses: 5. The breaker finally fires — after the entire drawdown has been realized, and after it approved two entries during the bleed.
At 11:00, the account was down 3.6% on a mark-to-market basis. Every guard reported it was down 0%. The pool was drowning while the dashboard showed a calm surface. This is the blind spot: the guard's measurement point (trade close) is downstream of the risk event (adverse mark-to-market drift on open exposure).
The Fix: Two Viewports, One Gate
The design change is to stop treating "drawdown" as one number. Track two:
- Realized drawdown — the existing view. It governs cooldowns and post-loss behavior, because it's the ground truth of what you've actually given up.
- Pool-wide unrealized PnL — mark every open position to market, sum it, and express it as a fraction of equity. This view updates on every tick (or every bar, or every N seconds — whatever your infrastructure supports). It gates new entries.
The realized view answers "how bad has it been?" The unrealized view answers "how bad is it right now?" Entries should require both to be acceptable.
from dataclasses import dataclass
@dataclass
class Position:
symbol: str
qty: float # signed: + long, - short
entry_price: float
mark_price: float
@property
def unrealized_pnl(self) -> float:
return (self.mark_price - self.entry_price) * self.qty
class DualViewportGuard:
def __init__(self, equity: float,
max_realized_dd: float = 0.02,
max_consecutive_losses: int = 3,
max_unrealized_dd: float = 0.015):
self.equity = equity
self.max_realized_dd = max_realized_dd
self.max_consecutive_losses = max_consecutive_losses
self.max_unrealized_dd = max_unrealized_dd
self.positions: dict[str, Position] = {}
self.realized_pnl_today = 0.0
self.consecutive_losses = 0
def mark(self, symbol: str, price: float) -> None:
if symbol in self.positions:
self.positions[symbol].mark_price = price
def unrealized_pnl(self) -> float:
return sum(p.unrealized_pnl for p in self.positions.values())
def unrealized_dd(self) -> float:
# negative when the pool is under water
return self.unrealized_pnl() / self.equity
def realized_dd(self) -> float:
return self.realized_pnl_today / self.equity
def can_open_new(self) -> tuple[bool, str]:
if self.consecutive_losses >= self.max_consecutive_losses:
return False, "consecutive_loss_breaker"
if self.realized_dd() <= -self.max_realized_dd:
return False, "realized_daily_limit"
if self.unrealized_dd() <= -self.max_unrealized_dd:
return False, "unrealized_pool_limit"
return True, "ok"
Two details matter here.
The mark-to-market gate is checked on entry, not on a timer. You don't need a background thread recomputing the pool every millisecond. You need the check to run at the one moment it can still do something: before a new order goes out. If the pool is down 1.6% and the cap is 1.5%, the next entry is refused — regardless of what the realized counter says.
The two limits are separate knobs with separate meanings. max_unrealized_dd is typically tighter than the realized limit, because unrealized losses are still recoverable and you want to stop adding risk early. max_realized_dd can be looser, because realized losses are sunk and the response there is cooldown, not prevention. Conflating them into one number forces a bad compromise.
Handling the "it's just noise" objection
The obvious pushback: mark-to-market is noisy, and a tight unrealized cap will block entries on harmless intraday wicks. Two mitigations, both cheap:
- Use a smoothed mark. Instead of the last tick, mark against a short moving average of recent prices (say, a 5-minute VWAP or EMA). This filters single-print spikes without hiding a genuine trend against the book.
- Gate on new entries only. The unrealized cap never forces liquidation and never touches existing positions. It only says "not now." A wick that blocks one entry costs you almost nothing; a correlated bleed that blocks five entries is exactly what the guard is for.
from collections import deque
class SmoothedMark:
def __init__(self, window: int = 60):
self.prices: deque[float] = deque(maxlen=window)
def update(self, price: float) -> float:
self.prices.append(price)
return sum(self.prices) / len(self.prices)
Feed SmoothedMark.update(price) into guard.mark(symbol, smoothed) and the gate becomes resistant to single-tick noise while still tracking real adverse drift.
Instrumenting the Blind Spot
The guard change fixes the behavior; you also want the diagnostic so you can see the blind spot forming. Log both viewports on every entry decision, and log the gap:
def log_entry_decision(guard: DualViewportGuard, ts, symbol: str) -> None:
ok, reason = guard.can_open_new()
log.info(
"entry_check ts=%s sym=%s ok=%s reason=%s "
"realized_dd=%.4f unrealized_dd=%.4f gap=%.4f",
ts, symbol, ok, reason,
guard.realized_dd(),
guard.unrealized_dd(),
guard.realized_dd() - guard.unrealized_dd(),
)
The gap column is the interesting one. When realized_dd − unrealized_dd grows large and negative — realized flat, unrealized deeply negative — you are inside the blind spot of a realized-only guard. If you ever run a realized-only breaker in parallel (legacy system, comparison study), this log tells you exactly how many entries it approved that the dual-viewport guard would have refused, and what those entries cost on a mark-to-market basis.
What This Does Not Solve
Be clear about the scope. The unrealized gate does not prevent the first position from going against you, and it does not replace per-position stops. It addresses one specific failure mode: the guard that approves new risk while existing risk is already underwater. Correlation is the amplifier here — five positions that all bleed together look like five independent decisions to the entry logic and like one concentrated bet to the mark-to-market pool. The pool view catches that; the per-trade view never will.
The general principle generalizes beyond drawdown breakers: any risk control whose measurement event is downstream of the risk event has a blind window. Realized PnL is downstream of unrealized PnL. Trade close is downstream of trade open. The fix is always the same — measure at the point where the risk actually lives, and gate at the point where you can still act.
More notes like this ship every week on this site.
Daily Picks
The following pairs are selected from the multi-timeframe trend scanner (Gate.io futures) and are for technical-analysis study only — not investment advice.
Data updated: 2026-11-11 08:46:07
Short
| Pair | Signal | Price | Take Profit | Stop Loss | R/R |
|---|---|---|---|---|---|
| XRP | 强做空 | $1.0555 | $1.0112 | $1.0924 | 1:1.2 |
1 picks selected. Scanner runs every 15 minutes.
Top comments (0)