Position Exit Management System – ClosePositionType
One of the biggest challenges in recovery strategies like Grid or Martingale ⚡️ (without stop loss) is handling open losing trades.
📉 If unmanaged, they can cause heavy drawdown or margin calls.
✅ ClosePositionType is a smart system 🤖 that closes trades logically and in groups — either at real profit 💵 or at breakeven ⚖️.
📌 Core Concept
1️⃣ Open recovery trades without SL when a position goes into loss
2️⃣ Check combined trades for profit or breakeven
3️⃣ Close trades together if conditions are met 🔒
⚙️ Key Parameters
inProfit 💰: Minimum net profit for group closure
0️⃣ = Close at breakeven
0️⃣ = Close only in real profit
Exit_Trigger 🔔: Maximum losing trades before system activation
🔁 Pairing Logic
(Position 1️⃣ + Position 5️⃣) ≥ inProfit → closed ✅
(Position 3️⃣ + Position 4️⃣) ≥ inProfit → closed ✅
Position 2️⃣ → handled separately (risk-free or left open)
🧪 Example Scenario
Exit_Trigger = 5️⃣
inProfit = $2️⃣💵
📍 Flow:
1️⃣ Position 1 enters loss ❌
2️⃣ Position 2 opens as recovery 🔄
3️⃣ Market moves against 📉 → Positions 3️⃣, 4️⃣, 5️⃣ open
4️⃣ System activates:
(Position 1+5 ≥ $2️⃣💵) → closed ✅
(Position 3+4 ≥ $2️⃣💵) → closed ✅
Position 2 → managed separately 🔒
🎯 Benefits
📈 Closes trades at profit or breakeven
📉 Smart drawdown reduction
⏳ Prevents long-term exposure
🔄 Dynamic risk handling without fixed SL
🔗 Links
👨💻 Seller Profile on MQL5
Product on MQL5 Market
🌐 Vikopo Lunexa Product Page
🎥 YouTube Demo Video