Live trading

πŸ¦‰ AthenaAI is an AI-powered ensemble machine-learning trading bot for PocketOption, built on BinaryOptionsToolsV2 β†’ Get it on GitLab
πŸ’¬ Need help? Join the Chipa Discord Β· ⚑ Go no-code with ChipaEditor

This guide covers operating the bot (python main.py) once it is installed and configured.

Startup paths

At startup the bot decides where its model state comes from:

  • Saved brain exists at PO_BRAIN_PATH (default athena_brain.pkl): it loads it β€” 🧠 Brain loaded (fitted=True, batch=True, models: {...}), plus ⏱ Expiry stats loaded: ... if <brain>_expiry.pkl exists β€” then βœ… Loaded saved brain β€” skipping dataset training!. Journal reload and dataset pre-training are both skipped.
  • No brain (or load failed): the bot first replays trade_journal.db (πŸ”„ Reloaded N trades from journal β€” models retrained!), then pre-trains from PO_DATASET if set β€” a several-minute in-process training run ending with a walk-forward report and βœ… Pre-trained on N samples!.
  • PO_RETRAIN=1: logs πŸ”„ Force retrain requested β€” ignoring saved brain., deletes the brain file, and takes the journal + dataset path above. Use this after changing feature-affecting code or when you suspect a stale brain. Unset it again afterwards β€” it deletes the brain on every startup. See PO_RETRAIN.

Tip: prefer training offline with python train.py (Training) so bot startups are instant.

Reading the log output

Diagnostic ⏸ lines (every 30 seconds while idle)

The trade loop evaluates gates every 2 seconds but only logs the blocking reason at most every 30 seconds. Each reason and what to do about it:

Log lineMeaningAction
⏸ Warming up (N/60 candles)Not enough candles buffered yetWait; ~1 candle per timeframe interval
⏸ Max trades open (1/1)A trade is pending resolutionNormal; resolves after its expiry
⏸ Wait between trades (Ns left)Inside min_wait_between_trades (60 s default)Normal pacing
⏸ Daily loss limit reachedDaily P&L ≀ βˆ’PO_MAX_DAILY_LOSSTrading stops until the UTC day rolls over
⏸ Cooldown (Ns left)Consecutive-loss cooldown (300 s after 3 losses)Wait; protects against tilt
⏸ Outside trading hours (HH UTC)Current UTC hour not in trading_hoursExpected outside 00–04 / 16–17 / 19–23 UTC by default
⏸ Adaptive cooldown (Ns)Recent win rate < 40% triggered an extra 120 s / 300 s waitThe bot is cold; it self-throttles
⏸ Feature compute returned NoneToo few candles for indicatorsShould clear as the buffer fills
⏸ Volatile regime β€” skippingskip_volatile_regime enabled and regime is volatileOff by default
⏸ Low confidence: X% (need 63.0%) …Prediction below PO_MIN_CONFThe most common line β€” the model has no strong opinion
⏸ Overconfident: X% (cap=85.0%) β€” likely overfit noiseAbove PO_MAX_CONFOverfit-looking batch-model signal rejected
⏸ Low range candle (…) β€” skipCandle range < 0.00005 (doji/indecision)Normal in flat markets
⏸ Indicators misaligned (conf=X%)Fewer than 2 of 3 (RSI, MACD hist, SMA cross) agreeRequires PO_REQUIRE_ALIGNMENT=1
⏸ Signal confirmation (n/N) …Waiting for N consecutive candles to agreeOnly with signal_confirmations > 1
⏸ 5-min trend DOWN vs CALL β€” skip (or UP vs PUT)Higher-timeframe trend contradicts the signalMulti-timeframe filter
🧠 Adaptive skip: <reason> (conf=X%)Adaptive strategy blocked the regime/hour/direction or raised the thresholdSee Adaptive strategy

A quiet bot cycling through ⏸ Low confidence lines is healthy β€” see Troubleshooting if nothing trades for many hours.

β–Ά TRADE lines

β–Ά TRADE  CALL  $25.00  conf=68.4%  expiry=300s  regime=trending_up  [120s:55%(20) | 300s:62%(41) | 600s:48%(12)]

Direction, stake ($), model confidence, the AI-chosen expiry, detected regime, and the expiry selector’s per-expiry win-rate stats (win% and sample count).

Result lines

βœ…  WIN  $+21.25  expiry=300s  |  W:14 L:9 WR:60.9% PnL:$87.50  |  expiry stats: ...
❌  LOSS  $-25.00  expiry=300s  |  ...
βž–  DRAW  $+0.00  expiry=300s  |  ...

Profit assumes an 85% payout (win = stake Γ— 0.85, loss = -stake). The middle section is the running performance summary; the end repeats expiry stats after this result was recorded.

Online learning while trading

Every resolved win/loss becomes a training sample:

  • Label derivation: win β†’ the predicted direction was correct; loss β†’ the opposite direction is used as the label.
  • Incremental retrain: the online models (SGD/PA/NB) run partial_fit after every retrain_every = 10 new results, logging Models updated | acc EMAs: {...}.
  • Batch retrain: GBM/RF (and MLP if present) retrain once at least 200 samples are buffered and then every 100 results, always on a sliding window of the most recent 500 samples β€” πŸ”„ Batch models retrained on recent N samples. This stops stale batch models from poisoning the ensemble.
  • Brain autosave: every 10 completed trades the bot writes a journal snapshot and saves the brain (🧠 Brain saved to ...), so a crash loses at most ~10 trades of learning. A clean Ctrl+C shutdown also saves.

How results feed the adaptive systems

Each result also updates:

  • AdaptiveStrategy (src/trading/strategy.py) β€” records direction/regime/confidence/UTC-hour/result; every 25 trades it reviews itself and may block losing regimes or hours, prefer a direction, adjust the confidence threshold Β±3%, and set an extra cooldown (120 s if the recent-10 win rate < 40%, 300 s if < 30%). Watch for its 🧠 Review complete. ... log block.
  • ExpirySelector β€” per-expiry win/loss counts steer future expiry choices and are persisted to <brain>_expiry.pkl.
  • MoneyManager β€” profit updates the daily P&L used by the loss limit (Risk management).
  • FeatureLab β€” tracks whether experimental features help (Feature lab).

Day-to-day checklist

  1. Session IDs expire β€” if the balance call hangs or trades fail, refresh PO_SSID.
  2. Check the startup banner matches your intended config (confidence band, hours, expiries).
  3. Let the daily loss limit and cooldowns do their job β€” don’t restart the bot to bypass them; the loss limit resets automatically at UTC midnight, but the daily P&L counter lives only in memory, so a restart does reset it.
  4. Back up athena_brain.pkl, athena_brain_expiry.pkl, and trade_journal.db occasionally (Persistence).

Risk note

The bot trades real money autonomously within your configured limits. Binary options can lose the full stake on every trade; past performance and walk-forward results do not guarantee future profits. Keep PO_MAX_STAKE and PO_MAX_DAILY_LOSS at levels you can afford to lose.

See also

πŸ’¬ Questions about running AthenaAI? Ask in the #trading-bots channel on the Chipa Discord β€” and if you’d rather design strategies without touching Python, try ChipaEditor.