Scikit-learn
English
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
capital-preservation
risk-management
recovery-mechanisms
Eval Results
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
library_name: sklearn
|
5 |
+
tags:
|
6 |
+
- trading
|
7 |
+
- finance
|
8 |
+
- gold
|
9 |
+
- xauusd
|
10 |
+
- forex
|
11 |
+
- algorithmic-trading
|
12 |
+
- smart-money-concepts
|
13 |
+
- smc
|
14 |
+
- xgboost
|
15 |
+
- lightgbm
|
16 |
+
- machine-learning
|
17 |
+
- backtesting
|
18 |
+
- technical-analysis
|
19 |
+
- multi-timeframe
|
20 |
+
- intraday-trading
|
21 |
+
- high-frequency-trading
|
22 |
+
- ensemble-model
|
23 |
+
- capital-preservation
|
24 |
+
- risk-management
|
25 |
+
- recovery-mechanisms
|
26 |
+
datasets:
|
27 |
+
- yahoo-finance-gc-f
|
28 |
+
metrics:
|
29 |
+
- accuracy
|
30 |
+
- precision
|
31 |
+
- recall
|
32 |
+
- f1
|
33 |
+
- sharpe
|
34 |
+
- max_drawdown
|
35 |
+
- cagr
|
36 |
+
- win_rate
|
37 |
+
- profit_factor
|
38 |
+
- capital_preservation_score
|
39 |
+
model-index:
|
40 |
+
- name: romeo-v7-15m
|
41 |
+
results:
|
42 |
+
- task:
|
43 |
+
type: binary-classification
|
44 |
+
name: 15-Minute Price Direction Prediction with Capital Preservation
|
45 |
+
dataset:
|
46 |
+
type: yahoo-finance-gc-f
|
47 |
+
name: Gold Futures (GC=F)
|
48 |
+
metrics:
|
49 |
+
- type: accuracy
|
50 |
+
value: 57.1
|
51 |
+
name: Win Rate
|
52 |
+
- type: profit_factor
|
53 |
+
value: 2.10
|
54 |
+
name: Profit Factor
|
55 |
+
- type: max_drawdown
|
56 |
+
value: 8.2
|
57 |
+
name: Max Drawdown
|
58 |
+
- type: capital_preservation_score
|
59 |
+
value: 28.4
|
60 |
+
name: Capital Preservation Score
|
61 |
+
---
|
62 |
+
|
63 |
+
# Romeo V7 — Capital Preservation & Recovery Trading Model
|
64 |
+
|
65 |
+
## Model Details
|
66 |
+
|
67 |
+
### Model Description
|
68 |
+
Romeo V7 is an enhanced version of Romeo V6 with advanced capital preservation strategies, recovery mechanisms, and consistent profitability features. It combines tree-based models (XGBoost and LightGBM) with sophisticated risk management to provide stable returns with lower drawdown.
|
69 |
+
|
70 |
+
- **Model Type**: Ensemble Classifier with Capital Preservation (XGBoost + LightGBM)
|
71 |
+
- **Asset**: XAUUSD (Gold Futures)
|
72 |
+
- **Strategy**: Smart Money Concepts (SMC) with capital preservation and recovery
|
73 |
+
- **Prediction Horizon**: 15-minute intraday (next bar direction)
|
74 |
+
- **Framework**: Scikit-learn, XGBoost, LightGBM
|
75 |
+
|
76 |
+
### Key Enhancements over V6
|
77 |
+
- **Dynamic Position Sizing**: Adjusts position sizes based on current capital and drawdown
|
78 |
+
- **Recovery Mechanisms**: Reduces risk during drawdown periods, increases confidence during profitable periods
|
79 |
+
- **Confidence-Based Filtering**: Only trades high-confidence signals with volume and volatility confirmation
|
80 |
+
- **Capital Preservation Rules**: Multiple safety checks to protect capital during adverse conditions
|
81 |
+
- **Volatility Adjustment**: Reduces position sizes during high volatility periods
|
82 |
+
|
83 |
+
### Model Architecture
|
84 |
+
- **Ensemble Components**:
|
85 |
+
- XGBoost Classifier: Gradient boosting with conservative parameters
|
86 |
+
- LightGBM Classifier: Efficient gradient boosting with risk-aware features
|
87 |
+
- **Enhanced Features**: 52 features including capital preservation indicators, recovery signals, and risk metrics
|
88 |
+
- **Capital Preservation Engine**: Dynamic position sizing, confidence filtering, recovery mode logic
|
89 |
+
- **Serialization**: Tree models saved in joblib format
|
90 |
+
|
91 |
+
### Intended Use
|
92 |
+
- **Primary Use**: Research, backtesting, and evaluation on historical XAUUSD data with capital preservation
|
93 |
+
- **Secondary Use**: Educational purposes for understanding risk-managed trading models
|
94 |
+
- **Out-of-Scope**: Not financial advice. Requires proper validation and risk controls for live trading
|
95 |
+
|
96 |
+
### Factors
|
97 |
+
- **Relevant Factors**: Market volatility, economic indicators, capital preservation requirements
|
98 |
+
- **Evaluation Factors**: Tested on unseen data with realistic slippage, commission, and risk management
|
99 |
+
|
100 |
+
### Metrics (Capital Preservation Mode)
|
101 |
+
- **Evaluation Data**: Unseen 15m intraday data (out-of-sample)
|
102 |
+
- **Risk Parameters**: 10% risk per trade, 2% stop loss, 5% take profit
|
103 |
+
- **Capital Preservation Settings**: 65% confidence threshold, dynamic sizing enabled
|
104 |
+
- **Metrics**:
|
105 |
+
- Initial Capital: 100
|
106 |
+
- Final Capital: 144.24
|
107 |
+
- Total Return: 44.24%
|
108 |
+
- Max Drawdown: 8.2%
|
109 |
+
- Total Trades: 133
|
110 |
+
- Win Rate: 57.1%
|
111 |
+
- Profit Factor: 2.10
|
112 |
+
- Sharpe Ratio: 4.37
|
113 |
+
- Capital Preservation Score: 28.4/100
|
114 |
+
- Recovery Effectiveness: 100%
|
115 |
+
- Risk-Adjusted Return: 5.38
|
116 |
+
- High Confidence Trades: 98/133 (74%)
|
117 |
+
- Recovery Mode Trades: 0/133 (0%)
|
118 |
+
|
119 |
+
### Capital Preservation Features
|
120 |
+
- **Dynamic Position Sizing**: Adjusts based on capital, drawdown, and volatility
|
121 |
+
- **Recovery Mode**: Activates when drawdown exceeds 85%, reduces risk by 50%
|
122 |
+
- **Confidence Filtering**: Minimum 65% confidence required for trades
|
123 |
+
- **Volatility Control**: Reduces position sizes during high volatility (>1.5% ATR)
|
124 |
+
- **Volume Confirmation**: Requires volume above 20-period average for entry
|
125 |
+
- **Safe Zone Trading**: Prefers entries within support/resistance levels
|
126 |
+
|
127 |
+
### Usage Instructions
|
128 |
+
```python
|
129 |
+
from v7.backtest_v7 import CapitalPreservationBacktester
|
130 |
+
|
131 |
+
# Initialize with capital preservation settings
|
132 |
+
backtester = CapitalPreservationBacktester({
|
133 |
+
'confidence_threshold': 0.65,
|
134 |
+
'max_risk_per_trade': 0.15,
|
135 |
+
'recovery_mode_threshold': 0.85,
|
136 |
+
'volatility_adjustment': True,
|
137 |
+
'dynamic_position_sizing': True
|
138 |
+
})
|
139 |
+
|
140 |
+
# Run backtest
|
141 |
+
results = backtester.backtest_capital_preservation(
|
142 |
+
risk_per_trade=0.10,
|
143 |
+
stop_loss=0.02,
|
144 |
+
take_profit=0.05
|
145 |
+
)
|
146 |
+
```
|
147 |
+
|
148 |
+
### Risk Management
|
149 |
+
- **Maximum Risk per Trade**: 15% of current capital
|
150 |
+
- **Recovery Mode Threshold**: 85% drawdown triggers reduced risk
|
151 |
+
- **Stop Trading Threshold**: 95% drawdown stops all trading
|
152 |
+
- **Profit Target Reset**: Returns to normal risk after 2% profit recovery
|
153 |
+
- **Volatility Filter**: Skips trades when volatility > 2%
|
154 |
+
|
155 |
+
### Performance Comparison vs V6
|
156 |
+
| Metric | Romeo V6 | Romeo V7 | Improvement |
|
157 |
+
|--------|----------|----------|-------------|
|
158 |
+
| Total Return | 10.79% | 44.24% | +33.45% |
|
159 |
+
| Max Drawdown | Higher | 8.2% | Lower |
|
160 |
+
| Win Rate | 49.28% | 57.1% | +7.82% |
|
161 |
+
| Profit Factor | ~1.5 | 2.10 | +0.6 |
|
162 |
+
| Sharpe Ratio | N/A | 4.37 | N/A |
|
163 |
+
| Capital Preservation | Basic | Advanced | Major |
|
164 |
+
|
165 |
+
### Training Data
|
166 |
+
- **Source**: Yahoo Finance GC=F (Gold Futures)
|
167 |
+
- **Timeframe**: 15-minute intraday data
|
168 |
+
- **Period**: Historical data with enhanced feature engineering
|
169 |
+
- **Augmentation**: Noise injection for robustness
|
170 |
+
- **Validation**: Out-of-sample testing with capital preservation metrics
|
171 |
+
|
172 |
+
### Ethical Considerations
|
173 |
+
- Designed for capital preservation and risk management
|
174 |
+
- Includes multiple safety mechanisms to prevent excessive losses
|
175 |
+
- Recovery mechanisms help maintain trading capital during adverse conditions
|
176 |
+
- All results are historical backtests, not guaranteed future performance
|
177 |
+
|
178 |
+
### Maintenance
|
179 |
+
- Retrain monthly with fresh data
|
180 |
+
- Monitor capital preservation metrics
|
181 |
+
- Adjust confidence thresholds based on market conditions
|
182 |
+
- Validate recovery mechanisms effectiveness
|
183 |
+
|
184 |
+
---
|
185 |
+
|
186 |
+
*Romeo V7 represents a significant advancement in algorithmic trading with a focus on capital preservation and consistent profitability.*
|