Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.novosky.app/llms.txt

Use this file to discover all available pages before exploring further.

File overview

FilePurposeTracked in git
.envSecrets and external service credentialsNo
config.jsonRuntime trading behavior, risk profile, filtersYes
ml_config.jsonFeature list, model paths, labeling, training paramsYes
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.
"dynamic_position_sizing": {
  "enabled": true,
  "risk_percent": 3.0,
  "min_lot": 0.01,
  "max_lot": 100,
  "max_risk_per_trade_pct": 10.0
}
FieldDescription
risk_percentBase capital at risk per trade, as % of equity
min_lotFloor lot size (never goes below this)
max_risk_per_trade_pctHard cap β€” actual risk never exceeds this % of equity regardless of lot
The equity-aware SL cap formula:
hard_cap_pips = (max_risk_per_trade_pct Γ— equity) / (lot Γ— pip_value)
pip_value = trade_tick_value / trade_tick_size  (auto-read from broker symbol info)
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):
is_news_near, news_minutes_away, news_count_today, is_news_risk_window
is_london_session, is_ny_session, is_asian_session
"ensemble_paths": {
  "rf": "models/rf_signal.pkl",
  "xgb": "models/xgb_signal.pkl",
  "lgb": "models/lgb_signal.pkl",
  "rf_onnx": "models/rf_signal.onnx",
  "xgb_onnx": "models/xgb_signal.onnx",
  "lgb_onnx": "models/lgb_signal.onnx"
}
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:
"risk_model": {
  "features": [
    "drawdown_pct", "equity_ratio", "win_rate_recent",
    "consecutive_losses", "volatility_20", "atr_14", "hour"
  ]
}
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:
{
  "symbol": "BTCUSD",
  "symbols": ["BTCUSD"],
  "symbol_configs": {
    "BTCUSD": { "lot": 0.01, "sl_pips": 200, "tp_pips": 300 }
  }
}
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.