--- language: en license: mit library_name: sklearn tags: - trading - finance - gold - xauusd - forex - algorithmic-trading - smart-money-concepts - smc - xgboost - lightgbm - machine-learning - backtesting - technical-analysis - multi-timeframe - intraday-trading - high-frequency-trading - ensemble-model - keras - tensorflow datasets: - yahoo-finance-gc-f metrics: - accuracy - precision - recall - f1 - sharpe - max_drawdown - cagr - win_rate model-index: - name: romeo-v6-15m results: - task: type: binary-classification name: 15-Minute Price Direction Prediction dataset: type: yahoo-finance-gc-f name: Gold Futures (GC=F) metrics: - type: accuracy value: 49.28 name: Win Rate - type: sharpe value: 0.0 name: Sharpe Ratio (N/A for simple metrics) - type: max_drawdown value: 0.0 name: Max Drawdown (N/A for simple metrics) - type: cagr value: 0.0 name: CAGR (N/A for simple metrics) --- # Romeo V6 — High-Risk Ensemble Trading Model for XAUUSD ## Model Details ### Model Description Romeo V6 is a high-risk ensemble machine learning model designed for predicting price movements in XAUUSD (Gold vs US Dollar) futures on 15-minute intraday data. It combines tree-based models (XGBoost and LightGBM) with an optional Keras neural network head to generate trading signals. The model outputs a probability score for long (up) trades, and the backtester handles entry/exit logic, position sizing, and risk management with aggressive settings for higher returns and volatility. - **Model Type**: Ensemble Classifier (XGBoost + LightGBM + optional Keras NN) - High-Risk Configuration - **Asset**: XAUUSD (Gold Futures) - **Strategy**: Smart Money Concepts (SMC) with technical indicators - **Prediction Horizon**: 15-minute intraday (next bar direction) - **Framework**: Scikit-learn, XGBoost, LightGBM, TensorFlow/Keras ### Model Architecture - **Ensemble Components**: - XGBoost Classifier: Gradient boosting on decision trees. - LightGBM Classifier: Efficient gradient boosting with leaf-wise growth. - Optional Keras Neural Network: Dense layers with custom `SumAxis1Layer` to replace anonymous Lambda for serialization. - **Features**: 31 canonical features including technical indicators (SMA, EMA, RSI, Bollinger Bands) and SMC elements (order blocks, volume profiles). - **Serialization**: Tree models saved in joblib `.pkl` format; Keras model in native `.keras` format. - **Weights**: Ensemble weights stored in artifact for weighted probability averaging. ### Intended Use - **Primary Use**: Research, backtesting, and evaluation on historical XAUUSD data. - **Secondary Use**: Educational purposes for understanding ensemble trading models. - **Out-of-Scope**: Not financial advice. Do not use for live trading without proper validation, risk controls, and regulatory compliance. ### Factors - **Relevant Factors**: Market volatility, economic indicators affecting gold prices (e.g., USD strength, inflation data). - **Evaluation Factors**: Tested on unseen data; robustness scanned across slippage, commission, and threshold parameters. ### Metrics - **Evaluation Data**: Unseen 15m intraday data (out-of-sample). - **Metrics**: - Initial Capital: 100 - Final Capital: 162.31 - Total Return: 62.31% - Total Trades: 207 - Win Rate: 49.28% - Avg PnL per Trade: 0.3010 ### Training Data - **Source**: Yahoo Finance (GC=F) historical data. - **Preprocessing**: Feature engineering with technical indicators and SMC concepts. - **Split**: Trained on historical data; evaluated on unseen fresh dataset. ### Quantitative Analyses - **Robustness Scan**: Tested under normal conditions (commission 0.02%, slippage 0.5 pips) and difficult market conditions (commission 0.05%, slippage 1.0 pips). - Normal: Win Rate 50.51%, Return 62.80%, Trades 198. - Difficult: Win Rate 31.82%, Return -16.38%, Trades 198. - **M2M Equity**: Per-bar mark-to-market equity calculation for accurate risk metrics. ### Ethical Considerations - **Bias**: Model trained on historical data; may not account for future market changes or black swan events. - **Risk**: High volatility in forex; potential for significant losses. - **Transparency**: Full disclosure of assumptions, limitations, and evaluation. ### Caveats and Recommendations - **Limitations**: High-risk position sizing (5% risk per trade) leads to higher volatility and drawdown. Simplified position sizing; small-account behavior may differ with margin rules. Historical backtests not indicative of future results. - **Recommendations**: Use with stop-loss, diversify, and consult financial advisors. Validate on your own data before use. This model is for high-risk tolerance traders. ## Usage ### Loading the Model ```python import joblib artifact = joblib.load('trading_model_romeo_daily.pkl') features = artifact['features'] # Canonical feature list models = artifact['models'] # Dict of XGBoost/LightGBM models weights = artifact['weights'] # Ensemble weights ``` ### Making Predictions ```python import pandas as pd # Prepare df with features matching artifact['features'] X = df[features].fillna(0) # Fill missing features with 0 probabilities = sum(weight * model.predict_proba(X)[:, 1] for model, weight in zip(models.values(), weights.values())) / sum(weights.values()) signals = (probabilities > threshold).astype(int) # threshold e.g. 0.5 ``` ### Backtesting Use `v6/backtest_v6.py` with high-risk settings (risk_per_trade=0.05, threshold=0.4) on custom data. It aligns features automatically. ### Requirements - Python 3.8+ - scikit-learn, xgboost, lightgbm, tensorflow, joblib ## Files - `trading_model_romeo_daily.pkl`: Main artifact. - `romeo_keras_daily.keras`: Optional Keras model. - `README.md`: This model card. - `metadata.json`: Structured metadata. ## Contact For issues or contributions: https://github.com/JonusNattapong/AITradings-samsam