Portfolio · condition block
Drawdown circuit breaker
The drawdown block is a circuit breaker. It is true when the bot's equity has fallen at least X% from the highest equity it reached during the run.
How the engine evaluates it
At the start of every candle the engine updates the run's peak equity, before that candle's trades. Equity is cash plus the position at the close.
The block fires while (1 − equity / peak) × 100 is at least X. It is a state: it stays true until equity recovers.
drawdown % = (1 − equity / peak equity) × 100
fires when drawdown % ≥ X
Botscript syntax
In the Lab you pick this block from the Portfolio group and fill in its fields. In the code view the same condition is written like this:
drawdown 15%
drawdown 25%
Settings
| Setting | Values | Default | Notes |
|---|---|---|---|
| Percent | 0 – 100% | 15% | Fall from the run's peak equity. |
How traders use it
- Emergency exit:
drawdown 20% and holdingwithsell 100%. - Stop new entries: add
not drawdown 15%to every entry rule.
Example bot
bot "Trend With Breaker"
when drawdown 20% and holding
then sell 100%
when supertrend(10,3) flips bullish and not drawdown 20%
then buy 100%
when supertrend(10,3) flips bearish
then sell 100%
- Sells everything once equity is 20% below its peak.
- Refuses new entries while the drawdown lasts.
- Otherwise follows Supertrend flips.
Pitfalls
- After the breaker sells, equity is flat in cash and the drawdown stays the same, so
not drawdown 20%keeps blocking entries for the rest of the run. That is often what you want; if not, use a smaller number or no entry filter. - The peak is per run. A new run starts with a fresh peak.
Drawdown: frequently asked questions
What is the peak measured from?
The highest equity reached during the run, checked at the start of each candle.
Does the drawdown reset after I sell?
No. It is measured from the run's peak, so it only shrinks when equity climbs back.
Is this the same as the max drawdown in the results?
Closely related: the results report the largest fall from peak over the whole run. This block lets the bot react while it happens.
Can I use it to stop trading for good?
Yes: add not drawdown X% to your entry rules.
Related blocks
Simulated results are hypothetical. They include only the fee and slippage you set on the bot, not every real-world cost or market condition, and past performance does not guarantee future results. Nothing here is financial advice.