max_consec_losses

🦉 AthenaAI is an AI-powered ensemble machine-learning trading bot for PocketOption, built on BinaryOptionsToolsV2Get it on GitLab
💬 Need help? Join the Chipa Discord · ⚡ Go no-code with ChipaEditor

After this many consecutive losing trades, the bot pauses trading for cooldown_seconds and resets the loss counter.

This field has no environment variable — to change it, edit the default in src/config.py or construct BotConfig yourself.

Typeint
Default3
FieldBotConfig.max_consec_losses
Consumed insrc/bot.py (AITradingBot._trade_loop)

What it does

The PerformanceTracker (self.perf) counts consecutive losses as results come in (a win resets it). In _trade_loop, after a signal is fully confirmed but before the trade is placed, the bot checks:

if self.perf.consec_losses >= self.cfg.max_consec_losses:
    self._cooldown_until = now + self.cfg.cooldown_seconds
    log.warning("Hit %d consecutive losses → cooldown %ds",
                self.perf.consec_losses, self.cfg.cooldown_seconds)
    self.perf.consec_losses = 0
    continue

Behavior details:

  • The check triggers a cooldown until now + cooldown_seconds; during that time an early gate blocks trading with the diagnostic ⏸ Cooldown (Ns left).
  • The counter is reset to 0 immediately when the cooldown is triggered. After the cooldown expires, the bot needs another max_consec_losses consecutive losses before pausing again — losses before and after the pause do not accumulate.
  • The check runs only when a trade was otherwise about to be placed (all earlier gates passed), so the cooldown starts at the moment of the first blocked trade attempt, not at the moment of the Nth loss.
  • The comment in src/config.py says “pause after 5 consecutive losses”, but the code default is 3 — the code is authoritative.

Valid values

Any positive integer. Lower values (2–3) stop losing streaks earlier; higher values tolerate longer streaks. Setting it very high effectively disables the loss-streak cooldown (the daily loss limit still applies).

Examples

# src/config.py
max_consec_losses: int = 5              # tolerate longer streaks
from src.config import BotConfig
cfg = BotConfig(ssid="...", max_consec_losses=2, cooldown_seconds=600)

Interactions

  • cooldown_seconds — duration of the pause this field triggers.
  • PO_MAX_DAILY_LOSS — the daily dollar stop-loss is independent and stops trading for the rest of the UTC day.
  • The AdaptiveStrategy adds its own extra cooldown (up to 300 s) when the recent-10 win rate is poor, on top of this mechanism.

Risk note: binary options trading can lose money; loss-streak cooldowns limit clustering of losses but do not guarantee profitability.

See also

💬 Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord — or prototype strategies no-code with ChipaEditor.