Initial commit: MAEA Expert Advisor v1.00
- Implemented complete trend-following strategy with EMA-based signals - Added 5 visual indicator lines (3 EMAs + 2 Border Lines) - Implemented breakthrough and pullback signal detection - Added dynamic lot sizing (0.01/0.02 based on pullback) - Implemented comprehensive filters: * Volume filter (20-bar average) * Spread filter (max 30 points) * Multiple Timeframe filter (H1 trading, D1 trend confirmation) * News filter (Thailand timezone) - Added advanced risk management: * Take Profit in USD * Stop Loss at Border Lines * Breakeven (100 points) * Trailing Stop (100 points) * Max drawdown protection (10%) - Created comprehensive documentation - Connected to Gitea repository
This commit is contained in:
196
plans/MAEA-summary.md
Normal file
196
plans/MAEA-summary.md
Normal file
@@ -0,0 +1,196 @@
|
||||
# MAEA Project Summary
|
||||
|
||||
## Project Overview
|
||||
**MAEA (Moving Average Expert Advisor)** - An advanced trend-following trading robot for MetaTrader 4 with sophisticated filtering and risk management features.
|
||||
|
||||
**Repository:** https://git.moreminimore.com/kunthawat/MAEA
|
||||
**Timezone:** Thailand (UTC+7)
|
||||
|
||||
## Core Strategy
|
||||
|
||||
### Indicator System (5 Visual Lines)
|
||||
1. **EMA High** (Light Blue) - EMA of High prices, period 30
|
||||
2. **EMA Medium** (Yellow) - EMA of Close prices, period 30
|
||||
3. **EMA Low** (Orange) - EMA of Low prices, period 30
|
||||
4. **High Border** (Purple) - EMA High + (EMA Medium - EMA Low)
|
||||
5. **Low Border** (Purple) - EMA Low - (EMA Medium - EMA Low)
|
||||
|
||||
### Signal Types
|
||||
|
||||
#### 1. Breakthrough Signal
|
||||
- **Buy:** Close price breaks above EMA High
|
||||
- **Sell:** Close price breaks below EMA Low
|
||||
- **Purpose:** Triggers order opening
|
||||
|
||||
#### 2. Pullback Signal
|
||||
- **Buy Pullback:** Price moves down to hit any line, then closes above the line
|
||||
- **Sell Pullback:** Price moves up to hit any line, then closes below the line
|
||||
- **Purpose:** Increases lot size when breakthrough occurs in same direction
|
||||
- **Tracking:** Separate for buy and sell directions
|
||||
|
||||
### Order Management
|
||||
- **Single Order:** Only one order at a time
|
||||
- **Dynamic Lot Sizing:**
|
||||
- 0.01 lot (no pullback before breakthrough)
|
||||
- 0.02 lot (pullback occurred before breakthrough)
|
||||
- **Stop Loss:** At Border Lines (Low Border for buys, High Border for sells)
|
||||
- **Take Profit:** Target in USD (default $5)
|
||||
- **Breakeven:** Move SL to entry at X points profit (default 100)
|
||||
- **Trailing Stop:** Trail by X points after breakeven (default 100)
|
||||
|
||||
## Advanced Filters
|
||||
|
||||
### 1. Volume Filter
|
||||
- Calculate 20-bar volume average
|
||||
- Trade only when current volume > average
|
||||
- Ensures sufficient market activity
|
||||
|
||||
### 2. Spread Filter
|
||||
- Maximum allowed spread: 30 points
|
||||
- Prevents trading during high spread periods
|
||||
|
||||
### 3. Multiple Timeframe (MTF) Filter (Optional)
|
||||
- **Trading Timeframe:** H1
|
||||
- **Filter Timeframe:** D1
|
||||
- **Logic:**
|
||||
- D1 close > D1 EMA High: Only buy orders allowed
|
||||
- D1 close < D1 EMA Low: Only sell orders allowed
|
||||
- D1 close between: No orders allowed
|
||||
- Can be enabled/disabled
|
||||
|
||||
### 4. News Filter (Optional)
|
||||
- Avoid specific hours (default: 14, 15, 20, 21)
|
||||
- Avoid specific days (default: 1, 5)
|
||||
- All times in Thailand timezone (UTC+7)
|
||||
- Can be enabled/disabled
|
||||
|
||||
### 5. Risk Management
|
||||
- **Max Drawdown:** Percentage-based protection (default 10%)
|
||||
- Stops trading if drawdown exceeds limit
|
||||
- Resumes trading when drawdown is below limit
|
||||
|
||||
## Implementation Phases
|
||||
|
||||
### Phase 1: Project Setup & Git Configuration (3 tasks)
|
||||
- Create MQL4 project structure
|
||||
- Initialize Git repository
|
||||
- Configure remote to Gitea server
|
||||
|
||||
### Phase 2: Core EA Structure (4 tasks)
|
||||
- Create MAEA.mq4 with basic framework
|
||||
- Define all input parameters
|
||||
- Set up indicator buffers
|
||||
- Initialize global variables
|
||||
|
||||
### Phase 3: Indicator Calculations (4 tasks)
|
||||
- Implement EMA calculations (High, Medium, Low)
|
||||
- Implement Border Line calculations
|
||||
- Add visual indicators with colors
|
||||
- Implement Volume average calculation
|
||||
|
||||
### Phase 4: Signal Detection (4 tasks)
|
||||
- Implement breakthrough signal detection
|
||||
- Implement pullback signal detection
|
||||
- Implement separate pullback tracking
|
||||
- Implement pullback flag reset logic
|
||||
|
||||
### Phase 5: Multiple Timeframe Filter (3 tasks)
|
||||
- Implement D1 EMA calculations
|
||||
- Implement MTF filter logic
|
||||
- Add enable/disable toggle
|
||||
|
||||
### Phase 6: Additional Filters (4 tasks)
|
||||
- Implement volume filter
|
||||
- Implement spread filter
|
||||
- Implement news filter (Thailand timezone)
|
||||
- Add enable/disable toggle for news filter
|
||||
|
||||
### Phase 7: Order Management (7 tasks)
|
||||
- Implement order opening with all filters
|
||||
- Implement dynamic lot sizing
|
||||
- Implement Stop Loss placement
|
||||
- Implement Take Profit calculation
|
||||
- Implement Breakeven logic
|
||||
- Implement Trailing Stop logic
|
||||
- Implement single order restriction
|
||||
|
||||
### Phase 8: Risk Management (3 tasks)
|
||||
- Implement max drawdown calculation
|
||||
- Implement drawdown protection
|
||||
- Implement trading resume logic
|
||||
|
||||
### Phase 9: Order Monitoring & Management (5 tasks)
|
||||
- Implement Take Profit checking
|
||||
- Implement Breakeven checking and SL modification
|
||||
- Implement Trailing Stop checking and SL modification
|
||||
- Implement Stop Loss checking
|
||||
- Implement order closure logic
|
||||
|
||||
### Phase 10: Testing & Validation (7 tasks)
|
||||
- Test all EMA and Border Line calculations
|
||||
- Test breakthrough and pullback signals
|
||||
- Test all filters
|
||||
- Test order opening with correct lot sizes
|
||||
- Test TP, SL, breakeven, and trailing stop
|
||||
- Test drawdown protection
|
||||
- Test visual indicators display
|
||||
|
||||
### Phase 11: Documentation & Deployment (5 tasks)
|
||||
- Create comprehensive README.md
|
||||
- Add parameter descriptions and usage instructions
|
||||
- Add troubleshooting guide
|
||||
- Commit initial code to Git
|
||||
- Push to Gitea repository and verify
|
||||
|
||||
## Total Tasks: 50
|
||||
|
||||
## Key Features Summary
|
||||
|
||||
✅ **Advanced Trend Following:** EMA-based with dynamic border lines
|
||||
✅ **Smart Signal Detection:** Breakthrough and pullback signals with separate tracking
|
||||
✅ **Dynamic Lot Sizing:** 0.01 or 0.02 based on market behavior
|
||||
✅ **Comprehensive Filters:** Volume, spread, MTF, news, and drawdown protection
|
||||
✅ **Risk Management:** TP in USD, SL at borders, breakeven, trailing stop
|
||||
✅ **Visual Indicators:** 5 colored lines for easy analysis
|
||||
✅ **Flexible Configuration:** All features can be enabled/disabled
|
||||
✅ **Single Order Management:** Prevents over-trading
|
||||
✅ **Timezone Aware:** Thailand timezone (UTC+7) for all time-based features
|
||||
|
||||
## Default Parameters
|
||||
|
||||
| Parameter | Value | Description |
|
||||
|-----------|-------|-------------|
|
||||
| EMA Period | 30 | Period for all EMAs |
|
||||
| Lot Size (Normal) | 0.01 | Lot without pullback |
|
||||
| Lot Size (Pullback) | 0.02 | Lot with pullback |
|
||||
| Take Profit | $5 | Target profit in USD |
|
||||
| Breakeven Points | 100 | Points to trigger breakeven |
|
||||
| Trailing Stop Points | 100 | Trail distance after breakeven |
|
||||
| Max Spread | 30 points | Maximum allowed spread |
|
||||
| Volume Period | 20 | Bars for volume average |
|
||||
| Max Drawdown | 10% | Maximum drawdown percentage |
|
||||
| MTF Filter | true | Enable/disable MTF filter |
|
||||
| News Filter | true | Enable/disable news filter |
|
||||
|
||||
## Technical Specifications
|
||||
|
||||
- **Platform:** MetaTrader 4
|
||||
- **Language:** MQL4
|
||||
- **Trading Timeframe:** H1 (recommended)
|
||||
- **Filter Timeframe:** D1 (for MTF)
|
||||
- **Currency Pairs:** All pairs (user-selectable)
|
||||
- **Account Types:** Any MT4 account
|
||||
- **Server Timezone:** Thailand (UTC+7)
|
||||
|
||||
## Next Steps
|
||||
|
||||
The implementation plan is complete and ready for execution. All 50 tasks have been clearly defined and organized into 11 logical phases. The plan includes:
|
||||
|
||||
1. ✅ Detailed strategy documentation
|
||||
2. ✅ Visual flow diagram
|
||||
3. ✅ Complete implementation steps
|
||||
4. ✅ Input parameters table
|
||||
5. ✅ Testing checklist
|
||||
6. ✅ Technical specifications
|
||||
|
||||
**Ready to proceed with implementation in Code mode.**
|
||||
Reference in New Issue
Block a user