Files

163 lines
6.9 KiB
Markdown
Raw Permalink Normal View History

# MQL5 MultiSignal DCA CCBSN EA
> **Expert Advisor thông minh cho MetaTrader 5** — 9 loại tín hiệu × DCA đa tầng × CCBSN (Chốt Cắt Bán Sớm Nửa) × Sniper tỉa lệnh × Anti-Detect Prop Firm
![MetaTrader 5](https://img.shields.io/badge/MetaTrader-5-blue)
![MQL5](https://img.shields.io/badge/Language-MQL5-orange)
![Python](https://img.shields.io/badge/Optimizer-Python-yellow)
![License](https://img.shields.io/badge/License-MIT-green)
## 🎯 Tư Duy & Điểm Khác Biệt
### Vấn đề của các bot DCA truyền thống
- ❌ Chỉ 1 loại signal (thường là MA cross) → bỏ lỡ nhiều cơ hội
- ❌ DCA lot cố định → cháy tài khoản khi sideway dài
- ❌ TP chuỗi rồi đóng hết → bỏ lỡ trend lớn
- ❌ Không anti-detect → bị prop firm phát hiện
### Giải pháp: MultiSignal + CCBSN + ML
```
┌──────────────┐ ┌──────────┐ ┌──────────────┐
│ 9 Signal │────▶│ DCA │────▶│ CCBSN │
│ Modes │ │ Adaptive │ │ Partial Close│
│ │ │ │ │ + Trailing │
│ Ichimoku │ │ Distance │ │ │
│ EMA Cross │ │ tăng dần │ │ Chốt 50% │
│ RSI OB/OS │ │ │ │ → Move BE │
│ BB Bounce │ │ Lot │ │ → Trail phần │
│ Stochastic │ │ tăng dần │ │ còn lại │
│ CCI │ │ │ │ │
│ MACD Cross │ │ Filter │ │ = Maximize │
│ Supertrend │ │ by trend │ │ profit per │
│ Momentum │ │ │ │ chain │
└──────────────┘ └──────────┘ └──────────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ EMA + MACD │ │ Sniper │
│ Trend Filter │ │ Tỉa lệnh │
│ │ │ đầu chuỗi │
└──────────────┘ └──────────────┘
```
### Tư duy thiết kế
1. **Multi-Signal Selector**: Thay vì hardcode 1 indicator, user chọn signal phù hợp từng thị trường qua `InpIndiMode` → optimize trên Strategy Tester
2. **CCBSN**: Khi chuỗi DCA về TP → chỉ chốt 50%. Phần còn lại: breakeven + trailing → **bắt trend lớn thay vì chỉ scalp nhỏ**
3. **ML Optimizer** (Python): Train decision tree trên data lịch sử → tự tìm DCA distance + lot size tối ưu per volatility regime
4. **Wave Strategy**: Brute-force 2240+ combo indicators → tìm chiến lược có lợi nhất trên dữ liệu cũ
## 📦 Cấu Trúc
| File | Mô tả |
|------|--------|
| `IchiDCA_CCBSN_PropFirm_Fixed.mq5` | EA chính — 9 signals, DCA, CCBSN, Sniper, Anti-Detect |
| `wave_strategy_optimizer.py` | Brute-force 2240+ combos tìm chiến lược tốt nhất |
| `dca_ml_optimizer.py` | ML tối ưu DCA parameters theo volatility regime |
## 🚀 Cài Đặt
### 1. Copy vào MT5
```
Copy IchiDCA_CCBSN_PropFirm_Fixed.mq5 →
C:\Users\<USER>\AppData\Roaming\MetaQuotes\Terminal\<ID>\MQL5\Experts\
```
### 2. Compile
Mở MetaEditor → Open file → Compile (F7)
### 3. Chạy
Drag & drop EA lên chart XAUUSD M5 → Cấu hình inputs
## ⚙️ Inputs Chính (85+ parameters)
### Signal Selection
| Input | Giá trị | Mô tả |
|-------|---------|-------|
| `InpIndiMode` | 0-8 | Chọn loại tín hiệu |
| `InpTFSignal` | PERIOD_M5 | Timeframe cho signal |
### DCA
| Input | Default | Mô tả |
|-------|---------|-------|
| `InpDCADistance` | 10.0 | Khoảng cách DCA (pips) |
| `InpDCADistMulti` | 1.2 | Hệ số nhân khoảng cách |
| `InpDCALotMulti` | 1.0 | Hệ số nhân lot |
| `InpDCATPPips` | 50.0 | TP chuỗi DCA |
| `InpMaxDCAOrders` | 5 | Max DCA orders |
### CCBSN
| Input | Default | Mô tả |
|-------|---------|-------|
| `InpUsePartialClose` | true | Bật chốt nửa |
| `InpPartialPercent` | 50% | % lot chốt |
| `InpMoveSLToBE` | true | Move SL breakeven |
| `InpTrailStartPips` | 10.0 | Pips kích hoạt trail |
## 🐍 Python Optimizer
### Wave Strategy Optimizer
```bash
pip install numpy pandas scikit-learn
# Export XAUUSD M5 data from MT5 → CSV
python wave_strategy_optimizer.py --data XAUUSD_M5.csv --output-dir ./
```
### ML DCA Optimizer
```bash
python dca_ml_optimizer.py --data XAUUSD_M5.csv
# → Generates ml_params.mqh with optimized DCA parameters
```
## 🐛 Known Issues & Fixes
| Issue | Fix |
|-------|-----|
| Exness: `ORDER_FILLING_IOC` not supported | `GetFillingType()` auto-detect |
| `iBands` buffer 0 ≠ UPPER | Buffer: 0=BASE, 1=UPPER, 2=LOWER |
| Close position fails | Retry 3x with Sleep(500) |
| EMA trend + BB bounce = 0 signals | Don't mix trend filter with mean reversion |
## 🗺️ Hướng Phát Triển
- [ ] Walk-forward optimization (train/test split)
- [ ] Multi-timeframe signal confluence
- [ ] Risk management per volatility regime (ML-driven)
- [ ] Dashboard web theo dõi performance real-time
- [ ] Thêm signal: Order Block, Fair Value Gap (ICT concepts)
## 📄 License
MIT License — Thoải mái sử dụng, chỉnh sửa, phân phối.
---
## 💼 Bạn muốn Bot Trading tương tự?
| Bạn cần | Chúng tôi đã làm ✅ |
|---------|---------------------|
| Bot DCA thông minh | ✅ 9 signal modes + adaptive DCA |
| Quản lý rủi ro tự động | ✅ CCBSN + Sniper + Equity Trailing |
| Tối ưu bằng ML | ✅ Python optimizer → hardcode MQ5 |
| Bot cho Prop Firm | ✅ Anti-Detect features built-in |
| Backtest & Optimize | ✅ 85+ inputs cho MT5 Strategy Tester |
<p align="center">
<a href="https://comarai.com"><img src="https://img.shields.io/badge/🎯_Yêu_cầu_Demo-comarai.com-blue?style=for-the-badge" alt="Demo"></a>
<a href="https://zalo.me/0834422439"><img src="https://img.shields.io/badge/💬_Zalo-0834422439-green?style=for-the-badge" alt="Zalo"></a>
<a href="mailto:hungphamphunguyen@gmail.com"><img src="https://img.shields.io/badge/📧_Email-Contact-red?style=for-the-badge" alt="Email"></a>
</p>
### 🤖 Comarai — Companion for Marketing & AI Automation
> *"Bạn không cần thuê 10 nhân viên. Bạn cần 4 AI Agents chạy 24/7."*
| Em Sale | Em Content | Em Marketing | Em Trade |
|---------|-----------|-------------|----------|
| Tìm khách tự động | Viết content viral | Chạy campaign 24/7 | Trade bot thông minh |
<p align="center">
<b>Built by <a href="https://github.com/hungpixi">@hungpixi</a> | <a href="https://comarai.com">Comarai.com</a></b>
</p>