feat: add LSTM, hybrid ensemble, PCA, scaler, ATR stops, rolling window
Major upgrade to the ML engine: - LSTM model type: 2-layer PyTorch LSTM with early stopping, GPU support - Hybrid mode: LSTM (60%) + XGBoost (40%) with agreement gating - StandardScaler normalization (critical for LSTM) - PCA dimensionality reduction (configurable variance retention) - ATR-based dynamic stop-loss/take-profit adapting to volatility - Rolling window retraining for more realistic time series validation - Updated LLM system prompt with docs for all new parameters - All backward compatible (xgboost/lightgbm/catboost still work) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
e24b6605d7
commit
a21e635d9f
+30
-27
@@ -1,43 +1,40 @@
|
||||
{
|
||||
"model_type": "xgboost",
|
||||
"model_type": "hybrid",
|
||||
"features": {
|
||||
"technical_indicators": [
|
||||
"RSI_14", "RSI_7", "RSI_21",
|
||||
"MACD_line", "MACD_signal", "MACD_hist",
|
||||
"BB_upper", "BB_lower", "BB_width",
|
||||
"ATR_14",
|
||||
"SMA_5", "SMA_10", "SMA_20", "SMA_50", "SMA_200",
|
||||
"EMA_5", "EMA_10", "EMA_20", "EMA_50",
|
||||
"OBV",
|
||||
"stoch_k", "stoch_d",
|
||||
"williams_r",
|
||||
"CCI_20",
|
||||
"ROC_10",
|
||||
"keltner_upper", "keltner_lower"
|
||||
],
|
||||
"technical_indicators": ["RSI_14", "RSI_7", "MACD_line", "MACD_signal", "MACD_hist", "BB_upper", "BB_lower", "BB_width", "ATR_14", "SMA_20", "SMA_50", "EMA_10", "EMA_20", "OBV", "stoch_k", "stoch_d", "williams_r", "CCI_20", "ROC_10"],
|
||||
"lookback_periods": [3, 5, 10, 20],
|
||||
"use_volume_features": true,
|
||||
"use_volatility_features": true,
|
||||
"use_candle_patterns": true,
|
||||
"use_candle_patterns": false,
|
||||
"use_lag_features": true,
|
||||
"lag_periods": [1, 2, 3, 5]
|
||||
"lag_periods": [1, 2, 3, 5],
|
||||
"use_pca": true,
|
||||
"pca_variance": 0.95,
|
||||
"use_scaler": true
|
||||
},
|
||||
"target": {
|
||||
"type": "classification",
|
||||
"direction": "long",
|
||||
"horizon_candles": 6,
|
||||
"threshold_pct": 1.0
|
||||
"direction": "both",
|
||||
"horizon_candles": 8,
|
||||
"threshold_pct": 1.5
|
||||
},
|
||||
"hyperparameters": {
|
||||
"learning_rate": 0.05,
|
||||
"max_depth": 6,
|
||||
"n_estimators": 500,
|
||||
"learning_rate": 0.001,
|
||||
"max_depth": 5,
|
||||
"n_estimators": 300,
|
||||
"subsample": 0.8,
|
||||
"colsample_bytree": 0.8,
|
||||
"min_child_weight": 5,
|
||||
"gamma": 0.1,
|
||||
"gamma": 0.3,
|
||||
"reg_alpha": 0.1,
|
||||
"reg_lambda": 1.0
|
||||
"reg_lambda": 2.0,
|
||||
"lstm_hidden_size": 128,
|
||||
"lstm_num_layers": 2,
|
||||
"lstm_dropout": 0.3,
|
||||
"lstm_epochs": 100,
|
||||
"lstm_batch_size": 64,
|
||||
"lstm_sequence_length": 20,
|
||||
"lstm_patience": 10
|
||||
},
|
||||
"strategy": {
|
||||
"entry_threshold": 0.60,
|
||||
@@ -47,13 +44,19 @@
|
||||
"trailing_stop_pct": 1.5,
|
||||
"position_sizing": "confidence_scaled",
|
||||
"max_position_pct": 100,
|
||||
"min_confidence_to_trade": 0.55
|
||||
"min_confidence_to_trade": 0.55,
|
||||
"dynamic_sl_tp": true,
|
||||
"atr_sl_multiplier": 1.5,
|
||||
"atr_tp_multiplier": 3.0
|
||||
},
|
||||
"training": {
|
||||
"walk_forward_windows": 5,
|
||||
"train_pct": 0.7,
|
||||
"validation_pct": 0.15,
|
||||
"test_pct": 0.15
|
||||
"test_pct": 0.15,
|
||||
"rolling_window": true,
|
||||
"rolling_train_size": 2000,
|
||||
"rolling_test_size": 200
|
||||
},
|
||||
"timeframe": "4h"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user