Risk Management

Risk limits stop a bot from opening new trades after losses. They never close a position for you and never stop a bot from closing one: once a limit is reached the bot keeps managing its open position (stop loss, take profit, its strategy's exits) and simply opens nothing new.

Overview

Every limit is off until you set it.

  • Daily / weekly loss - the bot's loss today (this week) as a % of the account
  • Drawdown from peak - how far the bot's PnL has fallen from its best point
  • Losing trades in a row - a losing streak
  • Pause once flat - optionally pause the bot after its position closes
  • Notifications - one alert when a limit is reached, one when it lifts

Setting risk limits

  1. Open Dashboard → Trading Bots (or Signal Bots) and click your bot
  2. On the Overview tab, find the Risk limits card
  3. Enter the limits you want (leave a box empty to turn that limit off) and click Save risk limits

The same settings can be sent with PATCH /api/bots/{botId}:

{
    "riskConfig": {
        "maxDailyLossPercent": 3,
        "maxWeeklyLossPercent": 7,
        "maxDrawdownPercent": 15,
        "maxConsecutiveLosses": 4,
        "pauseOnBreach": false,
        "notifyOnBreach": true
    }
}

null (or 0) turns a limit off. Percentages are between 0 and 100; the losing streak is a whole number from 1 to 100.

SettingWhat it measuresLifts
Daily loss %The bot's PnL since 00:00 UTC (closed trades after fees, plus how much its open position moved since 00:00 UTC at the latest mark) as a % of the account's equity at the start of the dayThe next day (00:00 UTC)
Weekly loss %The same since Monday 00:00 UTCThe next Monday
Drawdown from peak %The fall of the bot's PnL (closed + open) from its highest point since the bot was last started, as a % of the account's equity at that start plus that peakWhen you restart the bot, or raise or remove the limit
Losing trades in a rowLosing closed trades in a row since the bot was last started; a winning trade resets itWhen you restart the bot, or raise or remove the limit

What happens when a limit is reached

  1. The bot goes close-only: no new entries; its exits, stop loss and take profit keep running
  2. A banner on the bot page says which limit was reached and when it lifts
  3. You get one alert, "Risk limit reached: no new trades", and another when the limit lifts (unless Tell me when a limit is reached and when it lifts is off). There is no warning before a limit is reached.
  4. With Pause once flat on, the bot is paused after its open position closes (never while it holds one; a Signal Bot is stopped), and you get a "Bot paused: position closed (risk limit)" alert

A daily or weekly limit lifts by itself when the next day or week starts. Any limit lifts when you raise or remove it. Restarting the bot (Stop, then Start) starts the drawdown and losing-streak tracking afresh, but does not lift a daily or weekly limit early: a bot started again before the day (week) ends runs, but opens nothing until 00:00 UTC (Monday 00:00 UTC for a weekly limit), and its alert names that time.

Example (daily loss 3%):

Account equity at 00:00 UTC: $10,000   (limit: $300)
Trade 1 closes:  -$100   → today -$100 (1.0%)
Trade 2 closes:  -$150   → today -$250 (2.5%)
Open position:   -$75    → today -$325 (3.25%)  ⚠️ no new trades until tomorrow

The open position counts, so a large unrealized loss can reach the limit before anything closes. A position opened before the day (week) started counts only for its move since then, so a position still underwater from yesterday does not keep today's limit reached.


Account exposure cap

Each exchange connection can have an exposure cap: the size (notional) of every open position on that account, from all bots and manual trades, as a % of the account's equity. At or above the cap, no new position opens on that account, from any bot or the trading terminal; closes always run. For example, 300 allows open positions worth up to 3x the account's equity. It is off unless set (PATCH /api/exchanges/{id} with maxExposurePercent).


Best Practices

1. Start Conservative

For new bots or strategies:

SettingConservativeModerateAggressive
Daily Loss1-2%2-3%3-5%
Weekly Loss3-5%5-7%7-10%
Drawdown5-10%10-15%15-25%
Consecutive34-55-7

2. Match Risk to Strategy

Strategy TypeDaily LossDrawdownConsecutive
Scalping1-2%5%5-7
Day Trading2-3%10%4-5
Swing Trading3-5%15%3-4
Trend Following5%+20%+3-4

3. Turn on notifications

A limit reached quietly looks like a bot that stopped trading. Keep Tell me when a limit is reached and when it lifts on so you know why. See Trading Alerts for the alerts it sends.

4. Set Realistic Limits

Too tight limits cause:

  • Frequent stretches with no new trades
  • Missed opportunities
  • Frustration

Too loose limits cause:

  • Excessive losses
  • Account damage
  • Emotional trading

5. Review and Adjust

After each breach:

  1. Analyze what caused the breach
  2. Was it normal market volatility?
  3. Was it a strategy flaw?
  4. Adjust limits or strategy accordingly

Position-Level Risk Management

In addition to bot-level limits, use position-level controls:

Stop Loss on Every Trade

// Always set stop loss
td.trade.longBracket({
    size: td.config.positionSize,
    stopLoss: entryPrice * (1 - stopLossPercent / 100),
    takeProfit: entryPrice * (1 + takeProfitPercent / 100),
});

Position Sizing Based on Risk

// Risk-based position sizing
const riskAmount = accountBalance * (riskPerTradePercent / 100);
const stopLossDistance = entryPrice - stopLossPrice;
const positionSize = riskAmount / stopLossDistance;

td.trade.long({ size: positionSize });

Or let TradeStaq size it with td.trade.buyRisk({ riskPercent, stopLoss }) (see Advanced Signals).


Troubleshooting

The bot stopped opening trades

Check the banner on the bot page: it names the limit reached and when it lifts. Raise or remove the limit to let it trade again sooner. Restarting the bot lifts a drawdown or losing-streak limit, but not a daily or weekly one.

Drawdown does not reset

Drawdown is measured from the bot's best point since it was last started, so it does not reset by itself. Restart the bot to start tracking afresh.

Turning risk limits off

Clear every box in the Risk limits card and save, or send "riskConfig": null.


Next Steps