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(defaultathena_brain.pkl): it loads it βπ§ Brain loaded (fitted=True, batch=True, models: {...}), plusβ± Expiry stats loaded: ...if<brain>_expiry.pklexists β 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 fromPO_DATASETif 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 line | Meaning | Action |
|---|---|---|
βΈ Warming up (N/60 candles) | Not enough candles buffered yet | Wait; ~1 candle per timeframe interval |
βΈ Max trades open (1/1) | A trade is pending resolution | Normal; resolves after its expiry |
βΈ Wait between trades (Ns left) | Inside min_wait_between_trades (60 s default) | Normal pacing |
βΈ Daily loss limit reached | Daily P&L β€ βPO_MAX_DAILY_LOSS | Trading 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_hours | Expected outside 00β04 / 16β17 / 19β23 UTC by default |
βΈ Adaptive cooldown (Ns) | Recent win rate < 40% triggered an extra 120 s / 300 s wait | The bot is cold; it self-throttles |
βΈ Feature compute returned None | Too few candles for indicators | Should clear as the buffer fills |
βΈ Volatile regime β skipping | skip_volatile_regime enabled and regime is volatile | Off by default |
βΈ Low confidence: X% (need 63.0%) β¦ | Prediction below PO_MIN_CONF | The most common line β the model has no strong opinion |
βΈ Overconfident: X% (cap=85.0%) β likely overfit noise | Above PO_MAX_CONF | Overfit-looking batch-model signal rejected |
βΈ Low range candle (β¦) β skip | Candle range < 0.00005 (doji/indecision) | Normal in flat markets |
βΈ Indicators misaligned (conf=X%) | Fewer than 2 of 3 (RSI, MACD hist, SMA cross) agree | Requires PO_REQUIRE_ALIGNMENT=1 |
βΈ Signal confirmation (n/N) β¦ | Waiting for N consecutive candles to agree | Only with signal_confirmations > 1 |
βΈ 5-min trend DOWN vs CALL β skip (or UP vs PUT) | Higher-timeframe trend contradicts the signal | Multi-timeframe filter |
π§ Adaptive skip: <reason> (conf=X%) | Adaptive strategy blocked the regime/hour/direction or raised the threshold | See 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_fitafter everyretrain_every= 10 new results, loggingModels 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 cleanCtrl+Cshutdown 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
- Session IDs expire β if the balance call hangs or trades fail, refresh
PO_SSID. - Check the startup banner matches your intended config (confidence band, hours, expiries).
- 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.
- Back up
athena_brain.pkl,athena_brain_expiry.pkl, andtrade_journal.dboccasionally (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
- Architecture β the loops behind these logs
- Signal gates β every gate in depth
- Troubleshooting
π¬ 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.