File overview
| File | Purpose | Tracked in git |
|---|---|---|
.env | Secrets and external service credentials | No |
config.json | Runtime trading behavior, risk profile, filters | Yes |
ml_config.json | Feature list, model paths, labeling, training params | Yes |
weekly_optimize.py manage config.json automatically. You should rarely need to edit it by hand.
config.json
- Risk & position sizing
- Risk profile
- Circuit breakers
- SL/TP
- Confidence threshold
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.
| Field | Description |
|---|---|
risk_percent | Base capital at risk per trade, as % of equity |
min_lot | Floor lot size (never goes below this) |
max_risk_per_trade_pct | Hard cap β actual risk never exceeds this % of equity regardless of lot |
ml_config.json
Feature list (59 features)
Feature list (59 features)
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
Model paths
Model paths
calibrate_models() runs automatically and writes *_calibrated.pkl files.Risk model features
Risk model features
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
Broker-specific parameters live inconfig/brokers.json. The active broker is set in config.json:
pip_value is in USC per lot per point for cent accounts. This drives all equity-aware SL cap calculations.