Skip to main content

File overview

The onboarding wizard and weekly_optimize.py manage config.json automatically. You should rarely need to edit it by hand.

config.json

The most important section. Controls how much capital is risked per trade.
The equity-aware SL cap formula:
At equity 500 USC: cap = 50 pts. At 2418 USC: cap = 242 pts. Scales automatically as your account grows.

ml_config.json

The feature list is the contract between training and inference. Never reorder, add, or remove features without retraining all 4 models and updating this file.Key groups:
  • Bollinger Bands: bb_upper, bb_lower, bb_width, range_position
  • Trend: price_vs_ema200, trend_strength, macd_signal, ema_crossover
  • Momentum: rsi_14, rsi_divergence, momentum_5, momentum_10
  • Volatility: atr_14, volatility_20, high_low_ratio
  • Volume: volume_ratio, volume_trend
  • Session/news (protected): is_london_session, is_ny_session, is_asian_session, is_news_near, news_minutes_away, news_count_today, is_news_risk_window
  • Account state: drawdown_pct, equity_ratio, win_rate_recent, consecutive_losses
  • Market regime (Phase 17.2): volatility_regime, w1_ema_bias, w1_rsi_norm
Protected features (never drop based on SHAP):
Inference priority: calibrated pkl β†’ ONNX β†’ raw pkl. After every retrain, calibrate_models() runs automatically and writes *_calibrated.pkl files.
The risk model uses 7 equity-state features:
These must stay in sync across ml/risk_trainer.py, ml/risk_predictor.py, and ml_config.json. The model outputs a multiplier in [0.10, 1.25] applied to the base risk percentage.

Broker configuration

The active trading pair is set in config.json:
All broker-specific parameters (pip_value, contract_size, tick_size, digits, etc.) are read automatically from the MT5 API at startup via GET /symbols/{symbol}. The system adapts to any broker or suffix β€” BTCUSD, BTCUSDc, BTCUSDm, etc. account_type (cent / standard) is also auto-detected from account.currency at startup: USC β†’ cent, anything else β†’ standard. No manual config needed.
To switch brokers: update symbol in config.json and API_URL in .env. The broker UTC offset is detected automatically from the live tick timestamp. Use GET /time on the MT5 API to inspect the detected offset.