A losing streak is not proof that a trading edge has vanished. It can, however, be a useful operational trigger for suspending new exposure while a trader reviews market conditions or execution quality. A cTrader cBot should count completed trade outcomes rather than counting adverse ticks, red candles or temporary unrealized losses. The entry gate must remain separate from protective exits.
Define the accounting policy first
For this example, count each fully closed position belonging to one cBot label and symbol. A negative net result increases the streak, a positive result resets it, and zero leaves it unchanged. Three consecutive losses latch a pause; a later closure cannot automatically unlock it. Amounts are hypothetical and expressed in the account currency.

| Closure | Net P&L | Loss streak |
|---|---|---|
| 1 | -40 | 1 |
| 2 | +15 | 0 |
| 3 | -25 | 1 |
| 4 | -30 | 2 |
| 5 | -20 | 3 — pause |
Subscribe to completed-position events
Attach the event handler in OnStart and detach it in OnStop. The handler filters the position label and symbol before reading NetProfit. Use the same unique label when submitting entry orders. This fragment demonstrates a runtime-only counter and entry latch for a single-instance, full-position-close policy; it is not a standalone cBot.
private int lossStreak;
private bool entryPaused;
private const string BotLabel = "StreakDemo";
protected override void OnStart()
{
Positions.Closed += HandleClosed;
}
private void HandleClosed(PositionClosedEventArgs args)
{
var p = args.Position;
if (p.Label != BotLabel || p.SymbolName != SymbolName)
return;
if (p.NetProfit < 0)
lossStreak++;
else if (p.NetProfit > 0)
lossStreak = 0;
if (lossStreak >= 3)
entryPaused = true;
Print("Streak={0}, paused={1}", lossStreak, entryPaused);
}
protected override void OnStop()
{
Positions.Closed -= HandleClosed;
}
// In the existing new-entry branch:
// if (entryPaused) return;
// Continue protective exit management independently.
Place the entry guard after any mandatory position management and before every new-entry or scale-in submission. Working entry orders may still fill after the pause: define whether to cancel them, reconcile any late fill and protect it. Never remove a protective stop simply because the entry gate is closed.
Make restarts and partial closes explicit
The fields in this fragment are in memory and reset on restart. A production bot needs persistent state or reconstruction from its correctly scoped closed-trade history, including a durable identifier and duplicate-processing protection. Do not treat a position's final closure event as a complete realized-profit accounting system for strategies using partial exits. Reconcile the relevant historical deals and decide whether the counting unit is a deal, full position or strategy campaign. Use separate labels for independent instances; shared labels intentionally combine results.
Validation checklist
- Feed the five illustrated results into a test harness and verify the counter sequence 1, 0, 1, 2, 3.
- Test zero net profit, other bot labels, manual closures, partial exits and several positions closing close together.
- Confirm the pause prevents new entries but leaves exits and stop maintenance active. Test late fills and rejected cancellations.
- Define an explicit manual reset or session reset policy before deployment; test persistence across restart.
- Compare backtest behavior with a demo-account run, including fees and actual event timing.
The rule controls future entry eligibility, not a maximum monetary loss. Multiple open positions, gaps and slippage can still produce losses after the latch is set.
Official reference: Platform developer documentation.
This hypothetical educational example has not been compiled or backtested here. Trading involves risk of loss; simulated performance does not guarantee future results.
To adapt this free strategy idea to your own trading rules, contact us about Custom cTrader strategy Development Services.