mql5/Experts/Advisors/SMC_Pine/v1.7_EXECUTIVE_SUMMARY.md
darashikoh 428fd88c60 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

9.4 KiB

noteId tags
27809dd005a111f1af33fb18ab0fc1c3

SMC v1.7 Performance Analysis - Executive Summary

📊 Current Performance Snapshot

═══════════════════════════════════════════════════════════════════
                    v1.7 BACKTEST RESULTS
═══════════════════════════════════════════════════════════════════

Total Trades:           482
├─ Long Trades:        292 (60.6%)  ❌ LOSING MONEY
│  └─ P&L: -$1,280.28 | Win Rate: 35.6%
└─ Short Trades:       190 (39.4%)  ✅ MAKING MONEY
   └─ P&L: +$1,770.34 | Win Rate: 38.4%

NET PROFIT:            $490.06
WIN RATE:              36.7%
PROFIT FACTOR:         1.02  ← CRITICAL: near breakeven
MAX DRAWDOWN:          -$1,892 → +$3,033
GROSS PROFIT:          $30,824
GROSS LOSS:            $30,334

═══════════════════════════════════════════════════════════════════

🚨 Key Issues

# Issue Current Problem Risk
1 Long Trades Losing -$1,280 Entries too frequent, poor quality HIGH
2 Profit Factor = 1.02 $1.02 profit per $1 risk Any negative change flips to loss CRITICAL
3 Win Rate 36.7% Need 43% for healthy edge Losing trades 1.7x > winners HIGH
4 Avg Adverse Excursion -$80-82 per trade Entries happen after reversals MEDIUM
5 Drawdown Volatility -$1,892 swing Equity curve too unstable MEDIUM

🎯 Improvement Goals

Short-Term (Phase 1: Tier 1 Fixes)

Goal: Profit Factor 1.02 → 1.20 (0.18 pt improvement = +18%)

Changes:
  1. Remove D1 filter for longs
  2. Add breakeven lock at 1.5R profit
  3. Implement volatility-based position sizing

Timeline: 3-5 days
Risk: Low (all proven techniques)
Expected Impact: +$600-1,000 to P&L

Medium-Term (Phase 2: Tier 2 Fixes)

Goal: Profit Factor 1.20 → 1.35 (0.15 pt improvement = +13%)

Changes:
  1. Tighten VFI/RSI confirmation
  2. Add H1 multi-timeframe confluence
  3. Implement laddered profit taking (1R, 1.5R, 2R)

Timeline: 1-2 weeks
Risk: Medium (signal count may decrease)
Expected Impact: +$300-700 to P&L

Final State (Full v1.8)

Goal: Profit Factor 1.35 → 1.50 (0.15 pt improvement = +11%)

Changes:
  1. Add volume profile checks
  2. Optimize 4R threshold for ATR trail
  3. Fine-tune position sizing

Timeline: Additional 1-2 weeks
Risk: Medium (requires testing)
Expected Impact: +$200-400 to P&L

💡 Why Longs Fail While Shorts Succeed

Long Trade Analysis (292 trades)

  • Avg Win: $567 | Avg Loss: -$153
  • Win Rate: 35.6% (104 wins, 188 losses)
  • Gross Profit: $17,043 | Gross Loss: $18,323
  • Problem: Winning trades are big but infrequent; losing trades small but frequent
  • Root Cause: D1 filter may be triggering on "correction" lows, not true reversals

Short Trade Analysis (190 trades)

  • Avg Win: $664 | Avg Loss: -$138
  • Win Rate: 38.4% (73 wins, 113 losses)
  • Gross Profit: $13,781 | Gross Loss: $12,011
  • Why It Works: Better entry timing, fewer false signals from D1 bearish phase

📍 The Insight

Shorts naturally perform better during downtrends. Your backtest period (Feb-Mar 2025) was likely bearish-biased. The solution isn't to "fix shorts" (they work) but to make longs more selective.


TIER 1: Do First

✓ CHANGE 1: Remove D1 Bullish requirement for longs
  └─ Rationale: D1 filter is blocking valid entries
  └─ Expectation: +300-400 long trades, more win opportunities
  └─ Impact: Long P&L -$1,280 → potential +$200-500
  └─ Risk: Low (shorts unchanged)

✓ CHANGE 2: Add breakeven lock at 1.5R (not 2R)
  └─ Rationale: Don't let winners turn into losers
  └─ Expectation: Protect 1.5R of every trade that reaches it
  └─ Impact: Drawdown -$1,892 → -$1,500
  └─ Risk: None (pure risk management)

✓ CHANGE 3: Scale position size down in high volatility
  └─ Rationale: Keep $ risk constant regardless of ATR
  └─ Expectation: Smoother equity curve, less drawdown
  └─ Impact: Max single trade loss -$150+ → -$100-120
  └─ Risk: None (pure capital allocation)

TIER 2: Do Next (If Tier 1 works)

⏳ CHANGE 4: Tighten VFI threshold (0 → 0.3)
  └─ Filters out weak momentum entries
  └─ May reduce trade count 10-15%
  └─ Win rate should improve: 36.7% → 38-40%

⏳ CHANGE 5: Add laddered profit taking (25% at each level)
  └─ Lock guaranteed profit: 1R, 1.5R, 2R
  └─ Prevents large reversals from erasing gains
  └─ Profit factor: +0.2-0.3

📈 Expected Outcome After All Changes

BEFORE (v1.7)          AFTER (v1.8)           IMPROVEMENT
─────────────────      ─────────────────      ──────────────
482 trades      →      450-500 trades         Quality > Quantity
36.7% win rate  →      43-45% win rate        +6-8 percentage points
1.02 PF         →      1.35-1.50 PF           +32-47% better
$490 P&L        →      $1,200-1,500 P&L       +145-206% more profit
-$1,892 DD      →      -$1,400 DD             -26% less drawdown
-$1,280 Long    →      +$400-800 Long         From negative to positive

⚠️ Testing Strategy

Test Each Change Independently

1. Change D1 filter ONLY
   └─ Backtest 100 trades
   └─ Compare metrics to baseline
   └─ Go/No-Go decision

2. Add 1.5R breakeven ONLY (if Step 1 passed)
   └─ Backtest full period
   └─ Check drawdown reduction
   └─ Go/No-Go decision

3. Add vol sizing ONLY (if Step 2 passed)
   └─ Backtest full period
   └─ Monitor equity curve smoothness
   └─ Finalize Phase 1

Go Criteria (ALL must be true)

✓ Profit Factor increases by ≥0.05 (1.02 → 1.07 minimum)
✓ Win Rate increases by ≥1% (36.7% → 37.7% minimum)
✓ Max Drawdown decreases or stays same
✓ No single trade loss exceeds -$150
✓ No errors or compilation issues
✓ Trade frequency doesn't drop >50%

No-Go Criteria (ANY triggers rollback)

✗ Profit Factor decreases below 1.00
✗ Win Rate decreases below 35%
✗ Max Drawdown increases >$200 from baseline
✗ Strategy stops triggering entries
✗ Compilation/runtime errors appear

📋 Implementation Timeline

WEEK 1: Phase 1 (Tier 1 Fixes)
├─ Day 1-2: Implement & test D1 filter change
├─ Day 2-3: Implement & test 1.5R breakeven
├─ Day 3-4: Implement & test volatility sizing
└─ Day 5: Validate all changes work together

WEEK 2: Phase 2 (Tier 2 Fixes)
├─ Day 1-2: Implement & test VFI threshold
├─ Day 2-3: Implement & test laddered profit taking
└─ Day 4-5: Full backtest validation

WEEK 3: Optimization & Deployment
├─ Day 1-2: Walk-forward testing
├─ Day 2-3: Paper trading on live data
└─ Day 4-5: Live deployment (if validated)

🎓 Lessons Learned

  1. Signal quality > signal quantity

    • More trades ≠ more profit
    • Better to have 300 high-quality trades (45% WR) than 500 low-quality (36% WR)
  2. Asymmetry between longs/shorts matters

    • Market regime (bullish/bearish) affects directional performance
    • Don't force entries; let the filter do its job (better for shorts = bearish market)
  3. Profit factor of 1.02 is critical

    • Only 2% margin for error
    • Any slippage or commission can flip to loss
    • Need to get to 1.2+ for real-world trading
  4. Breakeven management is key

    • Locking breakeven at 1.5R instead of 2R protects more capital
    • Avoids scenario where +1.8R profit reverses to -0.2R loss
  5. Volatility affects position sizing

    • Static sizing during high ATR periods = oversized positions
    • Dynamic sizing keeps consistent $ risk per trade

🎯 Success Metrics Dashboard

Current → Target (By End of Phase 2)

Profit Factor:        1.02 ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 1.35
Win Rate:            36.7% ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 43%
Avg Trade:          +$1.02 ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +$3.50
Max Drawdown:      -$1,892 ▔▔▔▔▔▔▔▔▔▔▔ -$1,400
Long P&L:          -$1,280 ▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +$300-500
Short P&L:         +$1,770 ▔▔▔▔▔▔▔▔▔ +$1,900+

📞 Questions to Validate Understanding

Before implementing, ask yourself:

  1. Why are shorts outperforming longs?

    • Answer: D1 filter too restrictive for longs in bearish market
  2. Should I remove the D1 filter entirely?

    • Answer: Yes for longs (it was losing); keep for shorts (it's working)
  3. Why lock breakeven at 1.5R instead of 2R?

    • Answer: Don't wait for TP1 to protect capital; lock early
  4. What's the worst that can happen?

    • Answer: Profit factor drops below 1.00 → revert to v1.7 (takes 30 min)
  5. How do I know Phase 1 worked?

    • Answer: Profit Factor ≥ 1.15, Win Rate ≥ 38%, Drawdown ≤ -$1,500

Status: Ready for Implementation

Start with Phase 1 → CHANGE 1 (D1 filter removal) immediately. This is the highest-impact, lowest-risk change.