mql5/Experts/Advisors/ERMT_PMEx/Guides/README.md

834 lines
24 KiB
Markdown
Raw Permalink Normal View History

feat(M5): Implement v2.1 config enforcement and graduated stops in M5 contrarian mode BREAKING CHANGES: - M5 mode now enforces all v2.1 delayed BE/trailing parameters - Graduated stop system replaces legacy disaster stop when enabled - Max bars limit now triggers hard position close Changes to PositionManager_PME_Complete.mqh: 1. Max Bars Hard Close Enforcement - Added check for m_m5_config.max_bars at start of ApplyM5ContrarianManagement() - Forces EXIT_TIME close when position age exceeds configured limit (300 bars) - Prevents indefinite position holding in extended phases 2. Graduated Stop-Loss System - Implements ATR-based phase-progressive stops: * Phase 1 (0-60 bars): 3.5 ATR wide initial protection * Phase 2 (60-180 bars): 2.5 ATR tightened stop * Phase 3 (180+ bars): 2.0 ATR mature stop - Replaces legacy disaster stop when m_config.use_graduated_stops enabled - Falls back to disaster stop (150pt @ -100pt) if graduated stops disabled - Updates m_positions[].current_sl after successful modification 3. Delayed Breakeven Enforcement (v2.1) - Respects m_config.breakeven_min_bars (20 bars minimum age) - Respects m_config.breakeven_min_profit_bars (5 consecutive profit bars) - Applied to both Phase 1 fast BE (25pts) and Phase 2 maturity BE (30pts) - Logs bar count and consecutive profit bars on activation 4. Delayed Trailing Enforcement (v2.1) - Respects m_config.trail_min_bars (40 bars minimum age) - Applied to percentage trail in Phase 2 (30%/40% based on reversal speed) - Sets trail_activated flag and increments m_metrics.trails_activated - Logs activation with percentage and bar count 5. M5 Trailing Helper Metric Sync - Created ApplyM5PercentageTrail() with current_sl sync - Created ApplyM5PointsTrail() with current_sl sync - Created ApplyM5DynamicTrail() with current_sl sync - Standard helpers (ApplyPercentageTrail, etc.) preserved for non-M5 use - M5 contrarian management now calls M5-specific versions exclusively - Fixes metric/state desync between MT5 server and in-memory position tracking Architecture: - M5 mode continues to bypass standard management path (intentional isolation) - Standard trailing/technical/time-exit engines remain unused in M5 mode - Configuration separation maintained: ManagementConfig for standard + v2.1 fields, M5Config for contrarian-specific - No changes to main EA file (ERMT_PME_2.1_M5.mq5) Compatibility: - No breaking changes to standard (non-M5) management path - Existing M5 backtest results remain valid (behavior refinement only) - All v2.1 configuration fields now honored in M5 runtime
2026-03-02 17:08:42 +00:00
# ERMT PME v1.2 - Pure Management Edition
## Enhanced Risk Management Tool - Position Management Expert
---
## Table of Contents
1. [Introduction](#chapter-1-introduction)
2. [Quick Start Guide](#chapter-2-quick-start-guide)
3. [Core Features](#chapter-3-core-features)
4. [Phase Management System](#chapter-4-phase-management-system)
5. [Configuration Guide](#chapter-5-configuration-guide)
6. [Risk Management](#chapter-6-risk-management)
7. [Troubleshooting & FAQ](#chapter-7-troubleshooting--faq)
8. [Advanced Topics](#chapter-8-advanced-topics)
---
## Chapter 1: Introduction
### What is ERMT PME?
ERMT PME (Enhanced Risk Management Tool - Pure Management Edition) is a professional-grade position management EA for MetaTrader 5. Unlike traditional EAs that open trades, ERMT PME focuses exclusively on **managing existing positions** to maximize profits and protect capital.
### Key Philosophy
**"PME doesn't trade - it protects and maximizes"**
The EA implements institutional-grade profit protection strategies that adapt to market conditions and position performance. It's designed to work alongside any trading strategy or EA, acting as an intelligent exit manager.
### What Makes PME Different?
- **Pure Management**: Never opens new positions, only manages existing ones
- **Universal Compatibility**: Works with any EA or manual trading strategy
- **Adaptive Protection**: Phase-based system that evolves as profit grows
- **Non-Intrusive**: Doesn't interfere with positions below profit thresholds
- **Institutional Logic**: Built on proven professional trading principles
### Who Should Use PME?
- **Manual Traders**: Add professional exit management to your setups
- **EA Users**: Enhance any trading robot with superior profit protection
- **Portfolio Managers**: Manage multiple positions with consistent rules
- **Risk Managers**: Implement strict risk controls across all trading
### What PME Does
**Protects Profits**: Locks in gains as positions develop
**Manages Risk**: Enforces strict loss limits and drawdown controls
**Maximizes Returns**: Adaptive trailing for trend-following positions
**Partial Closures**: Banks profits while keeping runners active
**Emergency Protection**: Automatically adds stops to unprotected positions
### What PME Doesn't Do
❌ Does not open new positions
❌ Does not predict market direction
❌ Does not guarantee profits
❌ Does not trade autonomously
---
## System Requirements
### Platform
- **MetaTrader 5** (Build 3000 or higher)
- **Account Type**: Any (ECN, Standard, Pro)
- **Instruments**: All symbols supported
### Recommended Setup
- **VPS**: Recommended for 24/7 operation
- **Latency**: < 50ms to broker for optimal execution
- **Balance**: Minimum $500 (or equivalent) for proper risk management
### Files Structure
```
MQL5/Experts/Advisors/ERMT_PMEx/
├── ERMT_PME_1.2.mq5 # Main EA file
├── README.md # This file
├── Modules_PME/
│ ├── DataTypes_PME.mqh # Core data structures
│ ├── Utilities_PME.mqh # Utility functions
│ ├── RiskManager_PME.mqh # Risk management
│ ├── TechnicalAnalysis_PME_Merged.mqh # Market analysis
│ ├── PositionManager_PME_Complete.mqh # Position handling
│ └── ProfitMaximizer_PME.mqh # Phase management
└── Guides/
└── [Documentation files]
```
---
## Version History
### v1.2 (Current)
- ✨ Fixed critical phase lock calculation bug
- ✨ Added PHASE_INITIAL protection (positions < 40pts untouched)
- ✨ Improved breathing room calculation for better profit protection
- ✨ Fixed file writing errors with filename sanitization
- ✨ Enhanced debug logging for phase calculations
- 🐛 Fixed entry price unit mismatch
- 🐛 Fixed premature position closures
### v1.1
- Phase-based profit management system
- Progressive profit locking
- Multi-level partial closures
- Session-based adjustments
### v1.0
- Initial release
- Basic breakeven and trailing stop
- Emergency stop management
- Risk limit enforcement
---
## License & Disclaimer
### Copyright
© 2024 ERMT Trading Systems. All rights reserved.
### Disclaimer
Trading foreign exchange and contracts for difference on margin carries a high level of risk and may not be suitable for all investors. Past performance is not indicative of future results. This EA is provided as-is without any guarantees. Always test on a demo account before live trading.
### Usage Terms
- ✅ Personal use: Unlimited
- ✅ Demo/Practice accounts: Unlimited
- ❌ Redistribution: Not permitted
- ❌ Commercial resale: Not permitted
- ⚠️ Modification: At your own risk
---
## Chapter 2: Quick Start Guide
### Installation (5 Minutes)
#### Step 1: Copy Files
1. Locate your MetaTrader 5 data folder:
- Open MT5 → File → Open Data Folder
- Navigate to `MQL5/Experts/Advisors/`
2. Copy the entire `ERMT_PMEx` folder here
#### Step 2: Compile
1. Open MetaEditor (F4 in MT5)
2. Find `ERMT_PMEx/ERMT_PME_1.2.mq5` in Navigator
3. Double-click to open
4. Press F7 to compile
5. Check for "0 errors" in the Toolbox
#### Step 3: Attach to Chart
1. Open any chart in MT5 (symbol doesn't matter - PME manages all positions)
2. Drag `ERMT_PME_1.2` from Navigator onto the chart
3. Enable "Allow Algo Trading" when prompted
4. Click OK
**Congratulations!** PME is now active and monitoring your positions.
---
### First-Time Setup (Recommended Settings)
When you first attach PME, use these conservative settings:
#### Essential Settings
```
=== Management Control ===
Manage all positions: true
Magic Filter: 0 (manages all trades)
=== Risk Protection ===
Max Loss Per Trade: 5.0%
Max Daily Loss: 20.0%
Max Drawdown: 25.0%
=== Phase Management ===
Enable Phase Management: true
Phase 1 Trigger: 40 points
Phase 2 Trigger: 60 points
Phase 3 Trigger: 100 points
Phase 4 Trigger: 200 points
Phase 5 Trigger: 400 points
```
**Leave everything else at defaults for now.**
---
### Your First Managed Trade
#### Scenario: Manual Long Trade
1. **Open a position manually**: Buy 0.1 lot EURUSD
2. **PME detects it**: Check Experts tab for confirmation
3. **Watch the magic happen**:
- Position < 40 pts profit: PME monitors but doesn't interfere
- Position reaches 40 pts: PME enters PHASE_PROTECTION
- Position reaches 60 pts: Advances to PHASE_ACCUMULATION
- And so on...
#### What You'll See in Logs
```
[INFO] PME [#123456] Position registered - 0.10 lots @ 1.08500
[INFO] Position #123456 in PHASE_INITIAL (35.0 pts) - no phase lock applied
[INFO] Position #123456 transitioning from Initial to Protection (Peak: 42.0, Current: 41.0)
[INFO] Applied phase lock for #123456: Phase Protection lock: 10.0 pts (was 0.0 pts)
```
---
### Understanding the Dashboard
When `Show Dashboard` is enabled, you'll see a status panel:
```
═══════════════════════
ERMT PME v1.2
─────────────────────
STATUS
Active: 3
Closed: 12
─────────────────────
RISK
Exposure: 250.75
Drawdown: 3.2%
─────────────────────
MANAGEMENT
Breakevens: 8
Trails: 15
Partials: 6
─────────────────────
PERFORMANCE
Saved: $487.50
Captured: $1,245.00
Efficiency: 78.5%
═══════════════════════
```
#### Dashboard Elements Explained
- **Active**: Positions currently being managed
- **Closed**: Positions PME has closed this session
- **Exposure**: Total risk in open positions
- **Drawdown**: Current account drawdown from peak
- **Breakevens**: Times breakeven was applied
- **Trails**: Active trailing stops
- **Partials**: Partial closures executed
- **Saved**: Loss prevented by early exits
- **Captured**: Extra profit from trailing
- **Efficiency**: Overall management effectiveness (%)
---
### Common First-Time Questions
**Q: Why isn't PME doing anything?**
A: Check that:
- Position profit is at least 40 points (Phase 1 trigger)
- "Allow Algo Trading" is enabled (button in toolbar)
- Position matches your Magic Filter (if set)
**Q: Can I use PME with my existing EA?**
A: Yes! PME is designed to work alongside any EA. Just ensure your EA doesn't constantly modify stops, as this may conflict.
**Q: Will PME close my positions immediately?**
A: No. PME only intervenes when profit thresholds are reached. It won't touch positions in PHASE_INITIAL (< 40 points).
**Q: What if I want to manually close a position?**
A: Go ahead! PME won't interfere with manual closures. It simply removes the position from its tracking.
**Q: Can I change settings while PME is running?**
A: Yes, but you'll need to remove and re-attach the EA to the chart for changes to take effect.
---
### Next Steps
Now that PME is running, explore:
- [Core Features](#chapter-3-core-features) - Learn what PME can do
- [Phase Management System](#chapter-4-phase-management-system) - Understand the adaptive logic
- [Configuration Guide](#chapter-5-configuration-guide) - Fine-tune for your strategy
---
## Chapter 3: Core Features
### Feature Overview
PME implements six major management systems that work together to protect and maximize your positions:
1. **Phase Management** - Adaptive profit protection that evolves with your position
2. **Profit Locking** - Progressive locks that secure gains as profit grows
3. **Partial Closures** - Bank profits while keeping runners for big moves
4. **Trailing Stops** - Dynamic trailing based on ATR and momentum
5. **Risk Management** - Strict enforcement of loss and drawdown limits
6. **Emergency Protection** - Automatic stop-loss for unprotected positions
---
### 1. Phase Management System
#### The Six Profit Phases
Your position evolves through six distinct phases as profit grows:
| Phase | Profit Range | Management Strategy | Lock Level |
|-------|-------------|---------------------|------------|
| **INITIAL** | 0-39 pts | Hands-off monitoring | None |
| **PROTECTION** | 40-59 pts | Apply first lock | 10 pts min |
| **ACCUMULATION** | 60-99 pts | Start trailing | 25 pts min |
| **MAXIMIZATION** | 100-199 pts | Active management | 50 pts min |
| **RUNNER** | 200-399 pts | Wide trailing | 100 pts min |
| **EXTREME** | 400+ pts | Maximum protection | 200 pts min |
#### Phase Transition Logic
```
Position opens at 1.0850 (Long)
├─ Price 1.0880 (+30 pts) → INITIAL: PME monitors, no action
├─ Price 1.0892 (+42 pts) → PROTECTION: Lock 10pts (SL @ 1.0860)
├─ Price 1.0915 (+65 pts) → ACCUMULATION: Lock 25pts (SL @ 1.0875)
├─ Price 1.0955 (+105 pts) → MAXIMIZATION: Lock 50pts (SL @ 1.0900)
├─ Price 1.1055 (+205 pts) → RUNNER: Lock 100pts (SL @ 1.0950)
└─ Price 1.1255 (+405 pts) → EXTREME: Lock 200pts (SL @ 1.1050)
```
**Key Feature**: If profit retraces to a lower phase, PME maintains the highest lock achieved (retreat protection).
---
### 2. Profit Locking
#### How Locks Work
Profit locks are **minimum guaranteed profit levels**. Once a lock is set, your SL will never be moved below that level.
#### Lock Calculation Formula
```
Base Lock = Minimum for current phase (10, 25, 50, 100, or 200 pts)
Progressive Lock = (Peak Profit - Base) × Lock Percentage
Total Lock = Base Lock + Progressive Lock
Breathing Room = Allow 50% retracement from peak
Effective Lock = MAX(Total Lock, Peak × 50%)
```
#### Example
```
Position reaches +80 points (ACCUMULATION phase)
├─ Base Lock: 25 points (phase minimum)
├─ Peak Profit: 80 points
├─ Progressive Lock: (80 - 25) × 40% = 22 points
├─ Total Lock: 25 + 22 = 47 points
├─ Breathing Room: 80 × 50% = 40 points
└─ Effective Lock: MAX(47, 40) = 47 points
→ SL set at Entry + 47 points
```
#### Progressive Lock Percentages
- PROTECTION: Lock 30% of excess profit
- ACCUMULATION: Lock 40% of excess profit
- MAXIMIZATION: Lock 50% of excess profit
- RUNNER: Lock 60% of excess profit
- EXTREME: Lock 70% of excess profit
---
### 3. Partial Closures
#### Multi-Level Banking Strategy
PME can close portions of your position at profit milestones, banking gains while keeping runners active.
#### Default Partial Close Levels
| Level | Trigger | Close % | Example (1.0 lot) |
|-------|---------|---------|-------------------|
| **1** | 50 pts | 20% | Close 0.2, Keep 0.8 |
| **2** | 100 pts | 20% | Close 0.2, Keep 0.6 |
| **3** | 200 pts | 25% | Close 0.25, Keep 0.35 |
| **4** | 400 pts | 20% | Close 0.2, Keep 0.15 |
**Total**: 85% taken as profit, 15% kept as final runner
#### Dynamic Adjustment
Partial percentages adapt to market conditions:
- **Strong Momentum**: Close less (keep more for the trend)
- **Weak Momentum**: Close more (bank profits quickly)
- **High Volatility**: Close less (give room for volatility)
#### Example Scenario
```
Open: 1.0 lot EURUSD Long @ 1.0850
├─ +50 pts (1.0900): Close 0.2 lots → Bank $200, Keep 0.8 lots
├─ +100 pts (1.0950): Close 0.2 lots → Bank $400, Keep 0.6 lots
├─ +200 pts (1.1050): Close 0.25 lots → Bank $1000, Keep 0.35 lots
└─ +400 pts (1.1250): Close 0.2 lots → Bank $2400, Keep 0.15 lots
Total Banked: $4000 | Runner Value: $600 (if closes at +400)
```
---
### 4. Trailing Stop System
#### ATR-Based Trailing
PME uses Average True Range (ATR) to dynamically adjust trailing distance based on market volatility.
#### Trailing Distance by Phase
| Phase | Base Distance | With High Volatility |
|-------|--------------|---------------------|
| PROTECTION | 2.5 × ATR | 3.0 × ATR |
| ACCUMULATION | 2.0 × ATR | 2.4 × ATR |
| MAXIMIZATION | 1.5 × ATR | 1.8 × ATR |
| RUNNER | 3.0 × ATR | 3.6 × ATR |
| EXTREME | 4.0 × ATR | 4.8 × ATR |
#### Adaptive Features
- **Momentum Detection**: Wider trails in strong trends
- **Volatility Adjustment**: Automatically compensates for volatile markets
- **Step System**: Only moves SL when price advances by minimum step (15 pts default)
#### Example
```
EURUSD @ +120 pts profit (MAXIMIZATION phase)
ATR = 20 pips
Volatility = Normal
Trail Distance: 1.5 × 20 = 30 pips
Current Price: 1.0970
SL: 1.0970 - 0.0030 = 1.0940
Price moves to 1.0990 (+20 pips)
→ SL advances to 1.0960 (maintaining 30 pip distance)
```
---
### 5. Risk Management
#### Three-Level Protection
**1. Per-Trade Risk** (Default: 5%)
- Maximum loss allowed on any single position
- Enforced by emergency stop-loss if position lacks SL
- Example: $10,000 account → Max $500 loss per trade
**2. Daily Loss Limit** (Default: 20%)
- Maximum cumulative loss allowed in one day
- Closes all positions if breached
- Resets at midnight broker time
**3. Maximum Drawdown** (Default: 25%)
- Maximum peak-to-valley decline allowed
- Closes all positions and halts trading if breached
- Requires manual reset
#### Emergency Stop System
If PME detects a position without a stop-loss:
```
1. Calculate appropriate SL based on ATR (7× multiplier by default)
2. Apply emergency SL immediately
3. Log warning in Experts tab
4. Sound alert (if enabled)
```
#### Risk Limit Actions
```
Scenario: Daily Loss Limit Reached
[WARNING] Daily loss limit reached: 20.5%
[ACTION] Closing all positions (EXIT_RISK)
[INFO] Position #123456 closed @ 1.0875 (-$150)
[INFO] Position #789012 closed @ 1.2450 (-$200)
[ALERT] Daily loss limit triggered!
```
---
### 6. Session-Based Management
#### Trading Session Adjustments
PME recognizes three major trading sessions and adjusts management:
| Session | Time (UTC) | Trail Multiplier | Partial Multiplier |
|---------|-----------|------------------|-------------------|
| **Asian** | 00:00-08:00 | 1.2× (wider) | 1.5× (less frequent) |
| **London** | 08:00-16:00 | 1.0× (standard) | 1.0× (standard) |
| **New York** | 13:00-21:00 | 0.9× (tighter) | 0.8× (more frequent) |
#### Rationale
- **Asian**: Lower volatility → wider stops to avoid whipsaws
- **London**: Standard volatility → normal management
- **New York**: High volatility + trends → tighter stops, faster banking
---
### Feature Interaction
All features work together harmoniously:
```
Position Flow Example:
Open Long @ 1.0850
+30 pts → INITIAL: PME monitors silently
+45 pts → PROTECTION: Lock 10pts, Start light trailing
+70 pts → ACCUMULATION: Lock 25pts, Tighten trail
+80 pts → RUNNER CREATED: Close 20% @ +50pts trigger (banked $200)
+110 pts → MAXIMIZATION: Lock 50pts, Active trailing, Second partial @ +100pts
Retraces to +95 pts → Lock maintained at 50pts (retreat protection)
Rallies to +220 pts → RUNNER: Lock 100pts, Wide trail for runner portion
+410 pts → EXTREME: Lock 200pts, Ultra-wide protection, Final partial
Reverses and hits SL @ +200pts → Exit with 200pt profit locked in
```
---
## Chapter 4: Phase Management System
For a comprehensive deep-dive into the Phase Management System, including detailed lock calculations, phase transitions, and retreat protection, see:
**📖 [Chapter 4: Phase Management System (Full Guide)](README_Chapter4_PhaseManagement.md)**
### Quick Reference
**Phase Progression**:
```
INITIAL (0-39pts) → PROTECTION (40-59pts) → ACCUMULATION (60-99pts) →
MAXIMIZATION (100-199pts) → RUNNER (200-399pts) → EXTREME (400+pts)
```
**Key Concepts**:
- **Forward Transition**: Advancing to higher phase locks more profit
- **Retreat Protection**: Maintains highest lock achieved, never downgrades
- **Progressive Locking**: Lock percentage increases with phase
- **Breathing Room**: Allows retracement from peak before SL hits
**Lock Minimums by Phase**:
- INITIAL: None (0 pts)
- PROTECTION: 10 pts
- ACCUMULATION: 25 pts
- MAXIMIZATION: 50 pts
- RUNNER: 100 pts
- EXTREME: 200 pts
---
## Chapter 5: Configuration Guide
For complete parameter documentation with recommendations and examples, see:
**📖 [Chapter 5: Configuration Guide (Complete Reference)](README_Chapter5_Configuration.md)**
### Configuration Categories
1. **Management Control**: Magic filter, management modes
2. **Phase Triggers**: When each phase activates
3. **Risk Protection**: Loss limits and drawdown controls
4. **Emergency Stops**: Automatic protection for naked positions
5. **Trailing Stops**: ATR-based adaptive trailing
6. **Partial Closures**: Multi-level profit banking
7. **Time/Session Filters**: Time-based adjustments
8. **Display & System**: Dashboard, logging, alerts
### Quick Setup Presets
**Conservative Trader**:
```
Max Loss/Trade: 2%
Phase 1 Trigger: 50 pts
Breathing Room: 60%
Trailing: Wide (High Multipliers)
```
**Balanced Trader** (Recommended):
```
Max Loss/Trade: 5%
Phase 1 Trigger: 40 pts
Breathing Room: 50%
Trailing: ATR Adaptive
```
**Aggressive Trader**:
```
Max Loss/Trade: 8%
Phase 1 Trigger: 30 pts
Breathing Room: 40%
Trailing: Tight (Low Multipliers)
```
---
## Chapter 6: Risk Management
### Risk Protection Layers
**Layer 1: Per-Trade Risk**
- Default: 5% max loss per position
- Enforced via emergency stops
- Prevents catastrophic single-trade losses
**Layer 2: Daily Loss Limit**
- Default: 20% max daily loss
- Auto-closes all positions if breached
- Prevents emotional "revenge trading"
**Layer 3: Maximum Drawdown**
- Default: 25% max peak-to-valley decline
- Emergency shutdown + trading halt
- Final circuit breaker
### Risk Metrics Dashboard
Monitor these daily:
- **Current Exposure**: Total capital at risk
- **Drawdown**: Current vs peak equity
- **Active Positions**: Number of open positions
- **Correlation**: Related positions risk
### Risk Management Best Practices
1. **Never risk more than 2% per trade** (conservative)
2. **Set daily loss limit at 3-5× per-trade risk**
3. **Maximum drawdown should not exceed 30%**
4. **Review risk settings monthly**
5. **Increase limits gradually, decrease immediately**
---
## Chapter 7: Troubleshooting & FAQ
For complete troubleshooting guide and frequently asked questions, see:
**📖 [Chapter 7: Troubleshooting & FAQ (Full Guide)](README_Chapter6_Troubleshooting.md)**
### Common Issues Quick Fix
**PME Not Working?**
1. Check "Allow Algo Trading" is enabled
2. Verify position profit ≥ 40 points
3. Confirm Magic Filter = 0 (or matches position)
4. Check Experts tab for errors
**Premature Closures?**
1. Increase Phase 1 Trigger (40 → 50 pts)
2. Increase Breathing Room (50% → 60%)
3. Switch to TRAIL_ATR method
4. Check for conflicting EAs
**Partials Not Executing?**
1. Verify InpPartialEnabled = true
2. Check minimum position size (0.05+ lots)
3. Test manual partial close (broker support)
4. Review trigger thresholds
**Dashboard Missing?**
1. Press F5 to refresh chart
2. Check dashboard coordinates (X/Y)
3. Remove and re-attach EA
4. Recompile in MetaEditor
### FAQ Highlights
**Q: Will PME conflict with my EA?**
A: Only if your EA constantly adjusts stops. Use Magic Filter to separate.
**Q: Best Phase 1 Trigger setting?**
A: 40 pts standard, 30 pts scalping, 60 pts swing trading
**Q: Should I disable breakeven?**
A: Yes. Phase Management provides superior protection.
**Q: Can PME backtest?**
A: Limited support. Use forward testing or demo accounts.
---
## Chapter 8: Advanced Topics
### Multi-Instance Setup
Running multiple PME instances for different strategies:
```
Chart 1: PME Instance #1
├─ InpMagicFilter: 1001
└─ Manages: Scalping EA positions
Chart 2: PME Instance #2
├─ InpMagicFilter: 2001
└─ Manages: Swing trading positions
Chart 3: PME Instance #3
├─ InpMagicFilter: 0
└─ Manages: Manual trades (no magic)
```
### Performance Metrics
**Management Efficiency Formula**:
```
Efficiency = (Profit Captured + Loss Prevented) / Total Opportunity × 100
Where:
├─ Profit Captured: Extra profit from trailing vs. fixed TP
├─ Loss Prevented: Losses avoided by early exits
└─ Total Opportunity: Max possible profit (all peaks)
60-70%: Good
70-80%: Excellent
80%+: Outstanding
```
### Integration Examples
**With Galileo FX**:
```
1. Install Galileo FX (trading EA)
2. Install PME on any chart
3. Galileo opens positions
4. PME detects and manages them
5. No settings conflicts - they work independently
```
**With Manual Trading**:
```
1. Attach PME to main chart
2. Set InpMagicFilter = 0
3. Open positions manually
4. PME takes over once profit ≥ Phase 1 Trigger
5. Monitor dashboard for phase progression
```
### Custom Development
PME is modular. Key files for customization:
- **DataTypes_PME.mqh**: Add new data structures
- **ProfitMaximizer_PME.mqh**: Modify phase logic
- **PositionManager_PME_Complete.mqh**: Change management behavior
- **ERMT_PME_1.2.mq5**: Adjust main flow
⚠️ **Warning**: Modifications void support. Always backup original files.
---
## Final Notes
### Success with PME
PME is a tool, not a magic solution. Success requires:
1. **Solid Trading Strategy**: PME enhances good strategies, doesn't fix bad ones
2. **Patience**: Let the phase system work, don't micro-manage
3. **Discipline**: Trust the math, respect risk limits
4. **Monitoring**: Review performance weekly, adjust quarterly
5. **Education**: Understand how PME works before going live
### Support & Updates
- **Documentation**: Start here, read all chapters
- **Updates**: Check GitHub releases monthly
- **Issues**: Report bugs with detailed logs
- **Community**: Share experiences, learn from others
---
## Summary Checklist
Before going live with PME:
- [ ] Tested on demo for at least 2 weeks
- [ ] Read all documentation chapters
- [ ] Understand phase management system
- [ ] Configured risk limits appropriately
- [ ] Verified compatibility with trading EA
- [ ] Dashboard displaying correctly
- [ ] Logs showing expected behavior
- [ ] Emergency stops tested and working
- [ ] Partial closures executing (if enabled)
- [ ] Risk limits tested (on demo!)
---
## Acknowledgments
ERMT PME builds on years of professional trading experience and incorporates institutional-grade risk management principles. Thanks to all beta testers and early adopters who provided feedback.
Special recognition:
- Institutional traders who shared profit protection strategies
- MetaTrader community for MQL5 resources
- Early adopters who identified and reported bugs
---
## Contact & Support
**Bug Reports**: GitHub Issues
**Feature Requests**: GitHub Discussions
**Documentation**: This README + Chapter files
**Version**: 1.2
**Last Updated**: November 2024
**Status**: Production Ready
---
**🎯 Ready to start? Go to**: [Chapter 2: Quick Start Guide](#chapter-2-quick-start-guide)
**📚 Deep dive? Explore**:
- [Chapter 4: Phase Management](README_Chapter4_PhaseManagement.md)
- [Chapter 5: Configuration](README_Chapter5_Configuration.md)
- [Chapter 7: Troubleshooting](README_Chapter6_Troubleshooting.md)