regime_window
๐ฆ 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
How many of the most recent candles the regime detector analyzes to classify the market as trending up, trending down, ranging, or volatile.
This field has no environment variable โ to change it, edit the default in src/config.py or construct BotConfig yourself.
| Type | int (candles) |
| Default | 30 |
| Field | BotConfig.regime_window |
| Consumed in | src/bot.py (AITradingBot._trade_loop) โ src/core/regime.py (RegimeDetector.detect) |
What it does
Each trade-loop iteration calls:
regime = self.regime_detector.detect(candle_list, self.cfg.regime_window)
RegimeDetector.detect(candles, window) in src/core/regime.py:
- If fewer than
windowcandles are available, returnsRegime.RANGING(a safe default). - Takes the last
windowcloses, computes per-candle returns, then:vol= standard deviation of returns,rel_trend= linear-regression slope of the closes, normalized by the last price and multiplied bywindow.
- Classifies with v6 thresholds calibrated for 1-minute EURUSD:
vol > 0.0008โVOLATILErel_trend > 0.0003โTRENDING_UPrel_trend < -0.0003โTRENDING_DOWN- otherwise โ
RANGING
The regime label is used for the skip_volatile_regime gate, fed to the AI expiry selector, checked by the AdaptiveStrategy (which blocks regimes with a live win rate below 48%), logged with every trade, and stored in the trade journal. Periodic model snapshots (every 10 trades) call detect without the window argument, using the function default of 30.
Valid values
Any positive integer up to lookback. Smaller windows (15โ20) react faster to regime shifts but flip-flop more; larger windows (50+) are more stable but slower. Note the volatility/trend thresholds are hard-coded for the default 30-candle window on 1-minute data โ changing the window (or timeframe) shifts what those thresholds mean, and the trend term scales with window.
Examples
# src/config.py
regime_window: int = 50 # slower, steadier regime classificationfrom src.config import BotConfig
cfg = BotConfig(ssid="...", regime_window=50)Interactions
skip_volatile_regimeโ hard gate on the resulting label.lookbackโ the candle buffer must hold at leastregime_windowcandles or detection always returns ranging.- Expiry selection uses the regime as an input.
See also
๐ฌ Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord โ or prototype strategies no-code with ChipaEditor.