Sidechair

strategy.max_drawdown_percent

Browse the reference

The largest peak-to-trough fall in equity so far, as a percent of the equity peak.

Try it in the editor

strategy.max_drawdown_percent is a series float: the deepest percentage drop from an equity high to the following low. A value of 12.5 means equity once fell 12.5 percent from its peak.

Type

series float

Remarks

  • It only grows. It is measured against the peak, not against the initial capital.
  • A fall of 50 percent needs a gain of 100 percent to get back to the peak, which is why drawdown limits are usually set well below that.

Example

Pine ScriptLargest equity fall so far, in percentOpen in editor
//@version=6
strategy("Worst drawdown", initial_capital = 10000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
if ta.crossover(ta.sma(close, 10), ta.sma(close, 30))
    strategy.entry("Long", strategy.long)
if ta.crossunder(ta.sma(close, 10), ta.sma(close, 30))
    strategy.close("Long")
plot(strategy.max_drawdown_percent, "Max drawdown %", color.red, style = plot.style_stepline)
bgcolor(strategy.max_drawdown_percent > 25 ? color.new(color.red, 92) : na)

See also

Runs on Sidechair