docs: clarify mode behavior and sample config in MaxDrawdown protection

This commit is contained in:
ABS
2026-02-19 04:21:32 +08:00
parent e19d96f85c
commit e524e030ef

View File

@@ -69,10 +69,16 @@ def protections(self):
#### MaxDrawdown
`MaxDrawdown` calculates the maximum relative drawdown using the account's equity curve within the `lookback_period` in minutes (or in candles when using `lookback_period_candles`).
It evaluates the portfolio's peak-to-trough declines by considering the starting balance and the cumulative profit of all trades within the window. If the observed drawdown exceeds `max_allowed_drawdown`, trading will stop for `stop_duration` after the last trade - assuming that the bot needs some time to let markets recover.
`MaxDrawdown` supports 2 calculation modes within the `lookback_period` in minutes (or in candles when using `lookback_period_candles`):
The default calculation method is the sum-of-profit-ratios method (`calculation_mode: "ratios"`) for backward compatibility. To use the standard peak-to-trough equity drawdown (recommended), set `calculation_mode: "equity"`.
- `calculation_mode: "ratios"` (default): Legacy approximation based on cumulative profit ratios.
- `calculation_mode: "equity"`: Standard peak-to-trough drawdown on the account equity curve, using starting balance and cumulative absolute profit.
With `calculation_mode: "ratios"`, drawdown is derived from cumulative trade profit ratios, not from the account equity curve. This is kept for backward compatibility and can differ from account-level drawdown when position sizing changes over time.
For new setups, `calculation_mode: "equity"` is recommended. Prefer `calculation_mode: "ratios"` only when you intentionally rely on legacy behavior, especially with fixed stake amount configurations where ratio-based behavior is easier to reason about.
If the observed drawdown exceeds `max_allowed_drawdown`, trading will stop for `stop_duration` after the last trade - assuming that the bot needs some time to let markets recover.
The below sample stops trading for 12 candles if max-drawdown is > 20% considering all pairs - with a minimum of `trade_limit` trades - within the last 48 candles. If desired, `lookback_period` and/or `stop_duration` can be used.
@@ -82,6 +88,7 @@ def protections(self):
return [
{
"method": "MaxDrawdown",
"calculation_mode": "equity",
"lookback_period_candles": 48,
"trade_limit": 20,
"stop_duration_candles": 12,