mql5/Experts/Advisors/ERMT_PMEx/README_Chapter6_Troubleshooting.md

12 KiB

Chapter 6 & 7: Troubleshooting & FAQ

Common Issues and Solutions

1. PME Not Managing Positions

Symptoms:

  • EA attached but no action on positions
  • No logs in Experts tab
  • Positions not showing in dashboard

Diagnostics:

Check 1: Algo trading enabled?
└─ Look for AutoTrading button (green = on, red = off)
└─ Fix: Click button or press Ctrl+E

Check 2: Position profit sufficient?
└─ PME only acts on positions >=40 points profit (default)
└─ Check: Current profit vs Phase 1 Trigger setting

Check 3: Magic filter conflict?
└─ If InpMagicFilter ≠ 0, only matching positions are managed
└─ Fix: Set InpMagicFilter = 0 to manage all positions

Check 4: EA actually running?
└─ Check Experts tab for initialization messages
└─ Should see: "PME Ready - Managing X positions"
└─ Fix: Remove and re-attach EA

Log Verification:

[INFO] PME initialized successfully - X positions detected
[INFO] Position #123456 in PHASE_INITIAL (35.0 pts) - no phase lock applied

2. Premature Position Closures

Symptoms:

  • Positions closed at breakeven or small profit
  • SL hit too soon after entry
  • Frequent "stopped out" with minimal profit

Causes & Fixes:

A. Phase 1 Trigger Too Low

Problem: Phase 1 at 20 points may be too early
Fix: Increase to 40-50 points
Rationale: Give positions room to develop

B. Breathing Room Too Tight

Problem: InpPhaseLockBreathingRoom = 30% (too tight)
Fix: Increase to 50-60%
Rationale: Allow natural retracements

C. Conflicting Stop Management

Problem: Another EA or manual intervention moving stops
Fix:
  - Disable stop management in other EAs
  - Avoid manual SL adjustments while PME active
  - Use Magic Filter to separate PME from other systems

D. Trailing Too Tight

Problem: InpTrailDistance = 15 points in volatile market
Fix:
  - Use TRAIL_ATR instead of TRAIL_FIXED
  - Increase multipliers for volatile sessions
  - Check InpHighVolatilityMultiplier setting

3. Emergency Stops Applied Unexpectedly

Symptoms:

  • Positions suddenly get wide stop-loss
  • Log shows "Emergency stop applied"
  • SL at unusual distance (e.g., 200 pips)

Explanation: PME detected a position without a stop-loss and applied emergency protection.

Verification:

[WARNING] Position #123456 has no stop-loss - applying emergency protection
[INFO] Emergency SL applied: 1.08350 (based on 7.0× ATR)

Solutions:

Option 1: Disable Emergency Stops (Not recommended)

InpApplyEmergencyStops = false

Option 2: Adjust Emergency Multiplier

InpEmergencySLMultiplier = 5.0  (tighter)
or
InpEmergencySLMultiplier = 10.0 (wider)

Option 3: Ensure Initial SL (Best practice)

Always open positions with initial SL
Let PME manage it from there

4. Partial Closures Not Executing

Symptoms:

  • Position reaches trigger but no partial close
  • Dashboard shows "Partials: 0"
  • Full position remains open

Diagnostics:

Check 1: Partials Enabled?

InpPartialEnabled = true  ✓

Check 2: Broker Allows Partial Closes?

Some brokers: Hedging accounts support partials
Other brokers: Netting accounts may not
Test: Try manual partial close first

Check 3: Minimum Volume?

Problem: Position too small for partial close
Example: 0.01 lot position, trying to close 20%
   └─ 0.01 × 0.20 = 0.002 lots (below minimum)
Fix: Minimum position size = 0.05 lots for 4-level partials

Check 4: Trigger Not Reached?

Log should show:
[INFO] Position #123456 reached +50 pts - executing Level 1 partial (20%)
[INFO] Closed 0.20 lots @ 1.0900 - Bank $200

If missing: Profit hasn't reached InpPartialTrigger1

5. Risk Limits Triggering Unexpectedly

Symptoms:

  • All positions closed suddenly
  • Alert: "Daily loss limit reached"
  • Trading halted

Cause: Risk protection activated

Log Example:

[WARNING] Daily loss limit reached: 20.5%
[ACTION] Closing all positions (EXIT_RISK)
[ALERT] Daily loss limit triggered!

Preventive Measures:

1. Review Risk Settings

Current:
├─ InpMaxLossPerTrade: 5%
├─ InpMaxDailyLoss: 20%
└─ InpMaxDrawdown: 25%

Are these appropriate for your:
├─ Account size?
├─ Trading style?
└─ Risk tolerance?

2. Monitor Drawdown Dashboard

Check dashboard regularly:
Drawdown: 18.5%  ⚠️ Approaching 20% limit

Action: Reduce position sizes or pause trading

3. Adjust for Volatility

High volatility days:
├─ Widen stops temporarily
├─ Reduce position sizes
└─ Lower daily loss limit percentage

6. Dashboard Not Showing

Symptoms:

  • No visual dashboard on chart
  • Settings show InpShowDashboard = true
  • EA running normally

Fixes:

Fix 1: Chart Refresh

Press F5 or right-click chart → Refresh

Fix 2: Check Position

Dashboard coordinates:
├─ InpDashboardX: 20
├─ InpDashboardY: 50

May be off-screen if chart resized
Try: X=50, Y=100

Fix 3: Graphics Issue

MT5 → Tools → Options → Charts
└─ Enable "Show indicators in data window"

Fix 4: Reinstall

1. Remove EA from chart
2. Close and reopen MetaEditor
3. Recompile
4. Re-attach to chart

7. Compilation Errors

Error: "'breathing_room' - undeclared identifier"

Cause: Bug in older version (fixed in v1.2)
Fix: Update to v1.2 or later

Error: "Cannot open file 'XXX.mqh'"

Cause: Missing module file
Fix:
1. Ensure all Modules_PME files are present
2. Check file paths in #include statements
3. Re-copy entire ERMT_PMEx folder

Error: "Invalid stops"

Cause: Trying to set SL too close to current price
Fix: Already addressed in v1.2 (breathing room fix)

8. High CPU Usage

Symptoms:

  • MT5 consuming excessive CPU
  • Slow chart updates
  • System lag

Causes:

A. Too Frequent Updates

Problem: InpUpdateFrequency = 1 second
Fix: Increase to 2-5 seconds
   InpUpdateFrequency = 3

B. Too Many Positions

Problem: Managing 20+ positions simultaneously
Fix:
├─ Use Magic Filter to split management
├─ Run multiple PME instances on different charts
└─ Each manages subset of positions

C. Debug Logging Enabled

Problem: InpLogLevel = LOG_DEBUG
Fix: Change to LOG_INFO for production

Frequently Asked Questions

General

Q: Can PME open new positions? A: No. PME is a pure management EA. It only manages existing positions opened by you or other EAs.

Q: Will PME conflict with my trading EA? A: Generally no, but avoid if your EA:

  • Constantly adjusts stop-losses
  • Uses very tight breakeven systems
  • Implements its own trailing stops

Q: Can I use PME on multiple charts? A: Yes, but unnecessary. One PME instance manages ALL positions across all symbols.

Q: Does PME work on demo accounts? A: Yes, fully functional on demo and live accounts.

Q: Is PME compatible with hedging accounts? A: Yes, but each leg of a hedge is managed independently.


Configuration

Q: Should I enable both Breakeven and Phase Management? A: No. Disable breakeven (InpBreakevenEnabled = false) and use Phase Management. It's superior.

Q: What's the best Phase 1 Trigger setting? A: 40 points for standard trading. Lower (30) for scalping, higher (60) for swing trading.

Q: How do I disable partial closures? A: Set InpPartialEnabled = false

Q: Can I customize partial close percentages? A: Yes, adjust InpPartialPercent1, InpPartialPercent2, etc.

Q: Should I use emergency stops? A: Yes (InpApplyEmergencyStops = true). It's a critical safety feature.


Performance

Q: What's a good management efficiency percentage? A:

  • 60-70%: Good
  • 70-80%: Excellent
  • 80%+: Outstanding

Q: Why did PME let a winner turn into a loser? A: Check logs:

  • Was position in PHASE_INITIAL? (PME doesn't intervene < 40pts)
  • Was there a network/connection issue preventing stop updates?
  • Was breathing room set too wide?

Q: How do I maximize profit capture? A:

  1. Enable phase management
  2. Use adaptive trailing
  3. Enable partial closures
  4. Set appropriate breathing room (50%)
  5. Trust the system - don't micro-manage

Q: PME closed my position too early, missing a big move A: Tune settings:

  • Increase Phase 1 Trigger (more room)
  • Increase breathing room (60-70%)
  • Reduce partial close percentages
  • Widen trailing stops

Technical

Q: Where are logs saved? A: MT5 → File → Open Data Folder → MQL5 → Logs

Q: Where are reports saved? A: MT5 → File → Open Data Folder → MQL5 → Files

  • PME_Snapshot_YYYYMMDD.csv
  • PME_FinalReport_YYYYMMDD-HHMM.txt

Q: How do I enable debug logging? A: Set InpLogLevel = LOG_DEBUG (warning: verbose output)

Q: Can I backtest PME? A: Limited. Strategy tester doesn't fully support management-only EAs. Use forward testing or demo.

Q: How often should I update PME? A: Check for updates monthly. Subscribe to release notifications.


Compatibility

Q: Does PME work with Galileo FX? A: Yes, that's one primary use case. Attach PME to manage Galileo's positions.

Q: Can I use PME with other position managers? A: Not recommended. Multiple managers will conflict.

Q: Does PME support cryptocurrencies? A: Yes, but adjust triggers for crypto volatility (use wider settings).

Q: What about stocks and futures? A: Yes, compatible with any instrument in MT5.


Troubleshooting Workflow

When you encounter an issue:

Step 1: Check Experts Tab
└─ Look for error messages, warnings, or INFO logs

Step 2: Verify Settings
└─ Review all input parameters
└─ Ensure no conflicts (e.g., breakeven + phase management)

Step 3: Check Dashboard
└─ Are positions being detected?
└─ What phase are they in?

Step 4: Test with Single Position
└─ Open one manual position
└─ Watch PME logs as profit grows
└─ Verify phase transitions

Step 5: Enable Debug Logging
└─ Set InpLogLevel = LOG_DEBUG
└─ Reproduce issue
└─ Review detailed logs

Step 6: Report Bug
└─ If issue persists, report with:
   ├─ Log excerpts
   ├─ Input settings
   ├─ Account type (hedge/netting)
   └─ MT5 build number

Getting Help

Support Channels

Documentation:

  • README.md: Main documentation
  • README_Chapter4_PhaseManagement.md: Deep dive on phases
  • README_Chapter5_Configuration.md: Parameter reference

Community:

  • GitHub Issues: Bug reports and feature requests
  • Trading forums: User experiences and tips

Emergency Contact:

  • Critical bugs: Report immediately with "CRITICAL" tag

Best Practices

1. Start Conservative

First Week:
├─ Use demo account
├─ Conservative settings
├─ Monitor closely
└─ Learn PME behavior

2. Keep It Simple

Don't over-optimize:
├─ Start with defaults
├─ Make one change at a time
├─ Test for 1 week minimum
└─ Evaluate results objectively

3. Regular Monitoring

Daily:
├─ Check dashboard
├─ Review efficiency metric
└─ Verify no errors in logs

Weekly:
├─ Review snapshots
├─ Analyze partial close performance
└─ Adjust settings if needed

Monthly:
├─ Full performance review
├─ Compare to baseline (no PME)
└─ Optimize or revert changes

4. Maintenance

Monthly Tasks:
├─ Check for updates
├─ Clear old log files
├─ Archive old reports
└─ Review risk limits

Quarterly Tasks:
├─ Full settings review
├─ Compare periods with/without PME
├─ Assess ROI of management
└─ Tune for current market conditions

Return to: Main README