Loss guards and limits

What stops a strategy, and for how long.

  • max_daily_loss: at each bar close, the day's closed profit plus open profit is compared with the limit. When it is reached, all trades close and pending orders are cancelled at the next bar's open, and new entries are rejected until the next UTC day.
  • max_drawdown works the same way against the highest equity reached, and pauses the deployment until you resume it.
  • max_open, max_open_per_side, pyramiding, max_total_risk and min_distance reject an entry, with a reason, at the moment it would fill.

The rule is E20. You can also write your own guard as an ordinary rule:

AlgoBarsX
when history.today.pnl < -(2% of account.balance) or account.margin_level < 150%: close_all

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account