Skip to content

Grid Masters Temporal Trader MT5 – Complete User-Guide (Part 2)

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

    Β 

    Β  GRID MASTERS TEMPORAL TRADER MT5

    Β  Β  COMPLETE USER MANUAL AND GUIDE

    Β  Β  Version 1.12 | Copyright 2026, Hector Moses @ Grid Masters

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

    TABLE OF CONTENTS

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

    5. OPERATIONAL GUIDE

    Β  Β 5.1 How the EA Operates Daily

    Β  Β 5.2 Grid Placement Logic

    Β  Β 5.3 Position Management Flow

    Β  Β 5.4 Trim Engine Activation

    Β  Β 5.5 Lock System Triggers

    6. STRATEGY SETUPS

    Β  Β 6.1 Conservative Setup (Low Risk)

    Β  Β 6.2 Moderate Setup (Balanced)

    Β  Β 6.3 Aggressive Setup (High Volume)

    Β  Β 6.4 Trend-Following Setup

    Β  Β 6.5 Range-Trading Setup

    7. OPTIMIZATION GUIDE

    Β  Β 7.1 Backtesting Best Practices

    Β  Β 7.2 Forward Testing Protocol

    Β  Β 7.3 Parameter Optimization

    Β  Β 7.4 Currency Pair Selection

    Β  Β 7.5 Timeframe Selection

    8. RISK MANAGEMENT

    Β  Β 8.1 Position Sizing Calculations

    Β  Β 8.2 Margin Management

    Β  Β 8.3 Drawdown Expectations

    Β  Β 8.4 Lock Settings Strategy

    Β  Β 8.5 Emergency Procedures

    9. TROUBLESHOOTING

    Β  Β 9.1 Common Issues and Solutions

    Β  Β 9.2 Error Messages Explained

    Β  Β 9.3 Performance Problems

    Β  Β 9.4 Broker-Specific Issues

    10. ADVANCED USAGE

    Β  Β  10.1 Multi-Symbol Trading

    Β  Β  10.2 Portfolio Management

    Β  Β  10.3 News Event Handling

    Β  Β  10.4 Custom Time Slot Strategies

    11. FAQ

    12. SUPPORT & CONTACT

    COMPLETE USER MANUAL AND GUIDE – (Part 2)

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

    5. OPERATIONAL GUIDE

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

    5.1 HOW THE EA OPERATES DAILY

    ──────────────────────────────

    DAILY CYCLE:

    00:00 SERVER TIME – DAILY RESET

    β”œβ”€ All time slot flags reset (g_fired1/2/3 = false)

    β”œβ”€ EA ready to trigger at configured times

    └─ Existing positions/orders remain active

    TIME SLOT 1 TRIGGERS (e.g., 05:00)

    β”œβ”€ EA checks: Is g_fired1 already true? No β†’ Continue

    β”œβ”€ Market available? Spread OK? Yes β†’ Continue

    β”œβ”€ Check SMA filter (if enabled)

    β”œβ”€ Price > SMA? β†’ Place BUY grid only

    β”œβ”€ Price < SMA? β†’ Place SELL grid only

    β”œβ”€ SMA disabled? β†’ Place both grids

    β”œβ”€ Set g_fired1 = true (won’t fire again today)

    └─ Grid deployed successfully

    CONTINUOUS MONITORING (EVERY TICK)

    β”œβ”€ Check existing positions:

    β”‚Β  Β β”œβ”€ Break-even reached? β†’ Move SL to BE + offset

    β”‚Β  Β β”œβ”€ Trailing trigger? β†’ Adjust trailing SL

    β”‚Β  Β β”œβ”€ Basket profit target? β†’ Execute partial close

    β”‚Β   └─ Position age limit? β†’ Close aged positions

    β”œβ”€ Check trim engines:

    β”‚Β  Β β”œβ”€ Position count > Legacy Trim max? β†’ Trim positions

    β”‚Β   └─ Position count > AI Trim max? β†’ AI trim positions

    β”œβ”€ Check locks:

    β”‚Β  Β β”œβ”€ Equity Lock reached? β†’ Close all, clear grid

    β”‚Β  Β β”œβ”€ Profit Lock reached? β†’ Close all, freeze (optional)

    β”‚Β   └─ Drawdown Lock reached? β†’ Close all, clear grid

    β”œβ”€ Check grid refresh:

    β”‚Β   └─ 70% of pending orders consumed? β†’ Re-deploy grid

    └─ Repeat every tick

    TIME SLOT 2 TRIGGERS (e.g., 10:00)

    β”œβ”€ Same process as Slot 1

    └─ Independent of Slot 1 (fresh grid)

    TIME SLOT 3 TRIGGERS (e.g., 15:00)

    β”œβ”€ Same process as Slot 1

    └─ Independent of Slots 1 & 2

    23:59 SERVER TIME

    β”œβ”€ Day cycle completes

    └─ Tomorrow: Reset at 00:00

    5.2 GRID PLACEMENT LOGIC

    ─────────────────────────

    STEP-BY-STEP PROCESS:

    1. TRIGGER CHECK

    Β  Β β”œβ”€ Current server time = Time Slot X?

    Β  Β β”œβ”€ Has this slot already fired today?

    Β   └─ If no β†’ Proceed to Step 2

    2. MARKET VALIDATION

    Β  Β β”œβ”€ Is market open and tradable?

    Β  Β β”œβ”€ Is spread within acceptable range?

    Β  Β β”œβ”€ Is enough free margin available?

    Β   └─ If all yes β†’ Proceed to Step 3

    3. SMA ANALYSIS (if enabled)

    Β  Β β”œβ”€ Calculate current SMA value

    Β  Β β”œβ”€ Compare mid-price to SMA

    Β  Β β”œβ”€ Determine bias:

    Β  Β β”‚Β  Β β”œβ”€ Price > SMA β†’ BUY_ONLY

    Β  Β β”‚Β  Β β”œβ”€ Price < SMA β†’ SELL_ONLY

    Β  Β β”‚Β   └─ Filter disabled β†’ BOTH

    Β   └─ Proceed to Step 4

    4. POSITION LIMIT CHECK

    Β  Β β”œβ”€ Count current BUY positions

    Β  Β β”œβ”€ Count current SELL positions

    Β  Β β”œβ”€ If BUY count >= Max BUY β†’ Skip BUY grid

    Β  Β β”œβ”€ If SELL count >= Max SELL β†’ Skip SELL grid

    Β   └─ Proceed to Step 5

    5. PENDING ORDER LIMIT CHECK

    Β  Β β”œβ”€ Query broker’s max pending orders limit

    Β  Β β”œβ”€ Count current pending orders on account

    Β  Β β”œβ”€ Would placing grid exceed limit?

    Β   └─ If yes β†’ Abort, log warning

    6. DELETE OLD PENDING ORDERS

    Β  Β β”œβ”€ Loop through all pending orders

    Β  Β β”œβ”€ If order belongs to this EA (magic match):

    Β  Β β”‚Β   └─ Delete order

    Β   └─ Clear the slate for fresh grid

    7. PLACE BUY GRID (if allowed)

    Β  Β β”œβ”€ Calculate BUY levels to place (respecting position limits)

    Β  Β β”œβ”€ For each level (1 to BuyLevels):

    Β  Β β”‚Β  Β β”œβ”€ Calculate price: Current + (Level Γ— Spacing)

    Β  Β β”‚Β  Β β”œβ”€ Calculate SL: Price – SL_Points (if SL > 0)

    Β  Β β”‚Β  Β β”œβ”€ Calculate TP: Price + TP_Points (if TP > 0)

    Β  Β β”‚Β  Β β”œβ”€ Validate price against stop-level rules

    Β  Β β”‚Β  Β β”œβ”€ Check margin for this lot size

    Β  Β β”‚Β   └─ Place Buy Stop pending order

    Β   └─ BUY grid complete

    8. PLACE SELL GRID (if allowed)

    Β  Β β”œβ”€ Calculate SELL levels to place (respecting position limits)

    Β  Β β”œβ”€ For each level (1 to SellLevels):

    Β  Β β”‚Β  Β β”œβ”€ Calculate price: Current – (Level Γ— Spacing)

    Β  Β β”‚Β  Β β”œβ”€ Calculate SL: Price + SL_Points (if SL > 0)

    Β  Β β”‚Β  Β β”œβ”€ Calculate TP: Price – TP_Points (if TP > 0)

    Β  Β β”‚Β  Β β”œβ”€ Validate price against stop-level rules

    Β  Β β”‚Β  Β β”œβ”€ Check margin for this lot size

    Β  Β β”‚Β   └─ Place Sell Stop pending order

    Β   └─ SELL grid complete

    9. LOG SUCCESS

    Β   └─ “Grid placed: X BUY levels, Y SELL levels at Z spacing”

    VISUAL EXAMPLE (Grid Spacing = 50 points):

    Current Price: 1.1000

    SELL GRID:Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  BUY GRID:

    1.0850 ← Sell Stop (Level 3)Β  Β  Β  Β  1.1150 ← Buy Stop (Level 3)

    1.0900 ← Sell Stop (Level 2)Β  Β  Β  Β  1.1100 ← Buy Stop (Level 2)

    1.0950 ← Sell Stop (Level 1)Β  Β  Β  Β  1.1050 ← Buy Stop (Level 1)

    Β  Β  Β  Β  ↓  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  ↑

    Β   ─────────── 1.1000 (CURRENT) ───────────

    Β  Β  Β  Β Β 

    As price moves:

    β€’ Up to 1.1050: BUY position opens

    β€’ Down to 1.0950: SELL position opens

    β€’ Continues to activate levels as price moves

    5.3 POSITION MANAGEMENT FLOW

    ─────────────────────────────

    ONCE POSITIONS ARE OPEN, EA APPLIES (EVERY TICK):

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

    β”‚ POSITION OPENED (from activated pending order)Β  Β  Β  Β  Β  Β  Β  β”‚

    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β   ↓

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

    β”‚ 1. BREAK-EVEN CHECKΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Is profit >= Break-Even Trigger?Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Yes β†’ Move SL to Entry + OffsetΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β”‚Β  Β  β€’ No β†’ Skip to next checkΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β   ↓

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

    β”‚ 2. TRAILING STOP CHECKΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β”‚Β  Β  β€’ Is profit >= Trailing Start?Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Yes β†’ Set SL to Current Price – Trailing StepΒ  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Update SL if price moves further in profitΒ  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ No β†’ Skip to next checkΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β   ↓

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

    β”‚ 3. BASKET PARTIAL CLOSE CHECKΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Calculate average profit across ALL positionsΒ  Β  Β  Β  Β  Β β”‚

    β”‚Β  Β  β€’ Is average >= Partial Min Profit?Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β”‚Β  Β  β€’ Has this position been partially closed already?Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Yes to both β†’ Close X% of volume, mark as partialΒ  Β  Β  Β β”‚

    β”‚Β  Β  β€’ No β†’ Skip to next checkΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β   ↓

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

    β”‚ 4. POSITION AGE CHECKΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Calculate position age (days since open)Β  Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Is age >= Close After Days limit?Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β”‚Β  Β  β€’ Yes β†’ Close position entirelyΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β”‚Β  Β  β€’ No β†’ Skip to next checkΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β   ↓

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

    β”‚ 5. TRIM ENGINE CHECK (GLOBAL, NOT PER-POSITION)Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Count total positions across all gridsΒ  Β  Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Legacy Trim: Count >= Max? β†’ Close X losers/winnersΒ  Β  Β β”‚

    β”‚Β  Β  β€’ AI Trim: Count >= Max? β†’ Close X worst equity-impactΒ  Β  β”‚

    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β   ↓

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

    β”‚ 6. LOCK SYSTEM CHECK (GLOBAL, NOT PER-POSITION)Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Equity Lock: Open P&L >= Target? β†’ Close ALLΒ  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Profit Lock: Total Profit >= Target? β†’ Close ALLΒ  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Drawdown Lock: Equity drop >= Limit? β†’ Close ALLΒ  Β  Β  Β  β”‚

    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β   ↓

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

    β”‚ 7. SMA CROSS CHECK (if enabled)Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  β”‚

    β”‚Β  Β  β€’ Has price closed opposite to SMA?Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β β”‚

    β”‚Β  Β  β€’ BUY positions + price closed below SMA? β†’ Close all BUY β”‚

    β”‚Β  Β  β€’ SELL positions + price closed above SMA? β†’ Close all SELLβ”‚

    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β   ↓

    Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  REPEAT EVERY TICK

    5.4 TRIM ENGINE ACTIVATION

    ───────────────────────────

    LEGACY TRIM ENGINE EXAMPLE:

    Settings:

    β€’ Max Positions: 40

    β€’ Close Count: 10

    β€’ Min Profit: 0.0

    β€’ Close Losers First: Yes

    Scenario:

    β€’ You have 42 open positions

    β€’ Positions P&L ranges from -$15 to +$8

    Activation:

    1. EA counts positions: 42

    2. 42 >= 40 β†’ Trigger Legacy Trim

    3. Collect all 42 positions into array

    4. Sort by profit (losers first):

    Β  Β Position #1: -$15

    Β  Β Position #2: -$12

    Β  Β Position #3: -$10

    Β  Β …

    Β  Β Position #42: +$8

    5. Loop through first 10 positions (Close Count = 10)

    6. For each:

    Β  Β β€’ Check profit >= Min Profit (0.0)

    Β  Β β€’ If yes β†’ Close position

    7. Result: 10 worst losers closed, 32 positions remain

    Next tick:

    β€’ Position count: 32

    β€’ 32 < 40 β†’ No trim needed

    AI TRIM ENGINE EXAMPLE:

    Settings:

    β€’ Max Positions: 45

    β€’ Close Count: 5

    Scenario:

    β€’ You have 47 open positions

    β€’ Legacy Trim already fired (was at 42, closed 10, now at 32)

    β€’ More positions activated, now at 47

    Activation:

    1. EA counts positions: 47

    2. 47 >= 45 β†’ Trigger AI Trim

    3. Record current equity: $1,150

    4. Analyze equity slope (equity trend direction)

    5. Identify positions causing equity drag:

    Β  Β β€’ Position A: Large loss, heavy drag

    Β  Β β€’ Position B: Medium loss, medium drag

    Β  Β β€’ Position C: Small profit, no drag

    Β  Β …

    6. Sort by equity impact (worst first)

    7. Close top 5 worst equity-impact positions

    8. Result: 5 positions closed, 42 remain

    Layered Protection:

    β€’ Legacy Trim (40) β†’ First defense

    β€’ AI Trim (45) β†’ Backup defense

    β€’ Never reaches catastrophic levels

    5.5 LOCK SYSTEM TRIGGERS

    ─────────────────────────

    EQUITY LOCK EXAMPLE:

    Setting: Equity Lock = 110.0 USD

    Scenario:

    β€’ Account balance: $1,000

    β€’ 15 positions open

    β€’ Floating P&L: +$115

    Trigger:

    1. EA calculates open P&L every tick

    2. Open P&L = $115

    3. $115 >= $110 β†’ Equity Lock triggered

    4. EA immediately:

    Β  Β β€’ Closes all 15 positions

    Β  Β β€’ Deletes all pending orders

    Β  Β β€’ Logs event: “Equity Lock triggered at $115”

    5. Realized profit now locked in balance

    6. EA continues monitoring (lock can trigger again)

    PROFIT LOCK EXAMPLE:

    Setting: Profit Lock = 100.0 USD

    Setting: Stop Trading After Profit Lock = Yes

    Scenario:

    β€’ Starting balance (from OnInit): $1,000

    β€’ Current balance: $1,120 (made $120 in closed trades)

    β€’ Open P&L: -$25

    Trigger:

    1. EA calculates total profit:

    Β  Β Total = (Current Balance – Starting Balance) + Open P&L

    Β  Β Total = ($1,120 – $1,000) + (-$25)

    Β  Β Total = $120 – $25 = $95

    2. $95 < $100 β†’ Not triggered yet

    Later:

    β€’ Open P&L improves to -$5

    β€’ Total = $120 – $5 = $115

    3. $115 >= $100 β†’ Profit Lock triggered

    4. EA immediately:

    Β  Β β€’ Closes all positions

    Β  Β β€’ Deletes all pending orders

    Β  Β β€’ Sets g_frozen = true (EA stops trading permanently)

    Β  Β β€’ Logs: “Profit Lock triggered – EA FROZEN”

    5. EA remains on chart but never trades again

    DRAWDOWN LOCK EXAMPLE:

    Setting: Drawdown Lock = 200.0 USD

    Scenario:

    β€’ Account equity peaks at $1,300 (EA records as g_peakEquity)

    β€’ Market moves against you

    β€’ Equity drops to $1,080

    Trigger:

    1. EA updates peak equity every tick:

    Β  Β if (current equity > peak equity):

    Β  Β  Β  peak equity = current equity

    2. Peak = $1,300, Current = $1,080

    3. Drop = $1,300 – $1,080 = $220

    4. $220 >= $200 β†’ Drawdown Lock triggered

    5. EA immediately:

    Β  Β β€’ Closes all positions

    Β  Β β€’ Deletes all pending orders

    Β  Β β€’ Resets peak to current equity ($1,080)

    Β  Β β€’ Logs: “Drawdown Lock triggered – DD: $220”

    6. EA continues trading (not frozen, unlike Profit Lock)

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

    6. STRATEGY SETUPS

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

    6.1 CONSERVATIVE SETUP (LOW RISK)

    ──────────────────────────────────

    ACCOUNT SIZE: $500 – $1,000

    TEMPORAL SETTINGS:

    β€’ Time Slot 1: “07:00” (London open)

    β€’ Time Slot 2: “13:00” (NY open)

    β€’ Time Slot 3: “00:00” (disabled, set to midnight)

    GRID SETTINGS:

    β€’ Buy Levels: 5

    β€’ Sell Levels: 5

    β€’ Grid Spacing: 100 points

    β€’ SL: 0 (use locks instead)

    β€’ TP: 0

    POSITION LIMITS:

    β€’ Max BUY: 10

    β€’ Max SELL: 10

    LEGACY TRIM:

    β€’ Enable: Yes

    β€’ Max Positions: 15

    β€’ Close Count: 5

    β€’ Min Profit: 0.0

    β€’ Losers First: Yes

    AI TRIM:

    β€’ Enable: Yes

    β€’ Trigger Count: 20

    β€’ Close Count: 3

    BREAK-EVEN:

    β€’ Enable: Yes

    β€’ Trigger: 300 points

    β€’ Offset: 20 points

    TRAILING:

    β€’ Enable: No

    PARTIAL CLOSE:

    β€’ Enable: Yes

    β€’ Close Percent: 50.0

    β€’ Min Profit: 400 points

    SMA FILTER:

    β€’ Enable: Yes

    β€’ Period: 50

    β€’ Close on Cross: Yes (strict trend following)

    RISK & LOCKS:

    β€’ Lot Size: 0.01

    β€’ Equity Lock: 20.0 USD

    β€’ Drawdown Lock: 100.0 USD

    β€’ Profit Lock: 50.0 USD

    β€’ Stop After Profit Lock: Yes

    β€’ Close After Days: 14

    MISC:

    β€’ Max Spread: 30 points

    β€’ Magic: 111111

    β€’ Debug: Yes

    EXPECTED BEHAVIOR:

    β€’ Very conservative position sizing

    β€’ Strict trend following (SMA filter + cross-close)

    β€’ Quick profit-taking (Equity Lock at $20)

    β€’ Tight drawdown control ($100 max)

    β€’ Suitable for small accounts

    6.2 MODERATE SETUP (BALANCED)

    ──────────────────────────────

    ACCOUNT SIZE: $2,000 – $5,000

    TEMPORAL SETTINGS:

    β€’ Time Slot 1: “05:00”

    β€’ Time Slot 2: “10:00”

    β€’ Time Slot 3: “15:00”

    GRID SETTINGS:

    β€’ Buy Levels: 10

    β€’ Sell Levels: 10

    β€’ Grid Spacing: 50 points

    β€’ SL: 0

    β€’ TP: 0

    POSITION LIMITS:

    β€’ Max BUY: 20

    β€’ Max SELL: 20

    LEGACY TRIM:

    β€’ Enable: Yes

    β€’ Max Positions: 30

    β€’ Close Count: 10

    β€’ Min Profit: 0.0

    β€’ Losers First: Yes

    AI TRIM:

    β€’ Enable: Yes

    β€’ Trigger Count: 35

    β€’ Close Count: 5

    BREAK-EVEN:

    β€’ Enable: Yes

    β€’ Trigger: 200 points

    β€’ Offset: 10 points

    TRAILING:

    β€’ Enable: No

    PARTIAL CLOSE:

    β€’ Enable: Yes

    β€’ Close Percent: 50.0

    β€’ Min Profit: 300 points

    SMA FILTER:

    β€’ Enable: Yes

    β€’ Period: 50

    β€’ Close on Cross: No (allow positions to manage themselves)

    RISK & LOCKS:

    β€’ Lot Size: 0.05 – 0.10

    β€’ Equity Lock: 100.0 USD

    β€’ Drawdown Lock: 400.0 USD

    β€’ Profit Lock: 200.0 USD

    β€’ Stop After Profit Lock: Yes

    β€’ Close After Days: 7

    MISC:

    β€’ Max Spread: 50 points

    β€’ Magic: 222222

    β€’ Debug: Yes

    EXPECTED BEHAVIOR:

    β€’ Balanced position sizing

    β€’ Moderate grid density

    β€’ Reasonable profit targets

    β€’ Good for medium accounts

    6.3 AGGRESSIVE SETUP (HIGH VOLUME)

    ───────────────────────────────────

    ACCOUNT SIZE: $10,000+

    TEMPORAL SETTINGS:

    β€’ Time Slot 1: “00:00” (daily reset)

    β€’ Time Slot 2: “08:00” (London)

    β€’ Time Slot 3: “14:00” (NY)

    GRID SETTINGS:

    β€’ Buy Levels: 15

    β€’ Sell Levels: 15

    β€’ Grid Spacing: 30 points

    β€’ SL: 0

    β€’ TP: 0

    POSITION LIMITS:

    β€’ Max BUY: 0 (unlimited)

    β€’ Max SELL: 0 (unlimited)

    LEGACY TRIM:

    β€’ Enable: Yes

    β€’ Max Positions: 50

    β€’ Close Count: 15

    β€’ Min Profit: 0.0

    β€’ Losers First: Yes

    AI TRIM:

    β€’ Enable: Yes

    β€’ Trigger Count: 60

    β€’ Close Count: 10

    BREAK-EVEN:

    β€’ Enable: Yes

    β€’ Trigger: 150 points

    β€’ Offset: 10 points

    TRAILING:

    β€’ Enable: Yes

    β€’ Start: 400 points

    β€’ Step: 200 points

    PARTIAL CLOSE:

    β€’ Enable: Yes

    β€’ Close Percent: 30.0 (take smaller profits, let more run)

    β€’ Min Profit: 200 points

    SMA FILTER:

    β€’ Enable: No (trade both directions)

    β€’ Period: 50

    β€’ Close on Cross: No

    RISK & LOCKS:

    β€’ Lot Size: 0.20 – 0.50

    β€’ Equity Lock: 500.0 USD

    β€’ Drawdown Lock: 2,000.0 USD

    β€’ Profit Lock: 1,000.0 USD

    β€’ Stop After Profit Lock: No (keep trading)

    β€’ Close After Days: 0 (disabled)

    MISC:

    β€’ Max Spread: 50 points

    β€’ Magic: 333333

    β€’ Debug: No (reduce log clutter)

    EXPECTED BEHAVIOR:

    β€’ High frequency grid trading

    β€’ Large position counts

    β€’ Larger profit targets

    β€’ Accepts larger drawdowns

    β€’ Only for well-capitalized accounts

    6.4 TREND-FOLLOWING SETUP

    ──────────────────────────

    FOCUS: Ride major trends, avoid counter-trend trades

    TEMPORAL SETTINGS:

    β€’ Time Slot 1: “08:00” (London session)

    β€’ Time Slot 2: “14:00” (NY session)

    β€’ Time Slot 3: “00:00” (disabled)

    GRID SETTINGS:

    β€’ Buy Levels: 12

    β€’ Sell Levels: 12

    β€’ Grid Spacing: 60 points (wider for trends)

    β€’ SL: 0

    β€’ TP: 0

    POSITION LIMITS:

    β€’ Max BUY: 15

    β€’ Max SELL: 15

    LEGACY TRIM:

    β€’ Enable: Yes

    β€’ Max Positions: 25

    β€’ Close Count: 8

    β€’ Min Profit: 0.0

    β€’ Losers First: Yes

    AI TRIM:

    β€’ Enable: Yes

    β€’ Trigger Count: 30

    β€’ Close Count: 5

    BREAK-EVEN:

    β€’ Enable: Yes

    β€’ Trigger: 250 points

    β€’ Offset: 15 points

    TRAILING:

    β€’ Enable: Yes

    β€’ Start: 500 points (let trends develop)

    β€’ Step: 250 points (wide trailing)

    PARTIAL CLOSE:

    β€’ Enable: No (let winners run in trends)

    SMA FILTER:

    β€’ Enable: Yes

    β€’ Period: 100 (slower, major trends only)

    β€’ Close on Cross: Yes (exit when trend reverses)

    RISK & LOCKS:

    β€’ Lot Size: 0.10

    β€’ Equity Lock: 200.0 USD

    β€’ Drawdown Lock: 500.0 USD

    β€’ Profit Lock: 0.0 (disabled, let trends run)

    β€’ Close After Days: 0

    MISC:

    β€’ Max Spread: 40 points

    β€’ Magic: 444444

    β€’ Debug: Yes

    PHILOSOPHY:

    β€’ Wide grid spacing suits trending moves

    β€’ SMA(100) filters out noise, catches major trends

    β€’ Close on Cross exits when trend ends

    β€’ Trailing stop locks in trend profits

    β€’ No partial close (maximize trend capture)

    6.5 RANGE-TRADING SETUP

    ────────────────────────

    FOCUS: Profit from ranging/sideways markets

    TEMPORAL SETTINGS:

    β€’ Time Slot 1: “06:00” (early London)

    β€’ Time Slot 2: “12:00” (London close/NY open overlap)

    β€’ Time Slot 3: “20:00” (Asian session)

    GRID SETTINGS:

    β€’ Buy Levels: 8

    β€’ Sell Levels: 8

    β€’ Grid Spacing: 40 points (tight for ranges)

    β€’ SL: 0

    β€’ TP: 100 points (quick scalping TPs)

    POSITION LIMITS:

    β€’ Max BUY: 12

    β€’ Max SELL: 12

    LEGACY TRIM:

    β€’ Enable: Yes

    β€’ Max Positions: 20

    β€’ Close Count: 6

    β€’ Min Profit: 5.0 (only close profitable ones)

    β€’ Losers First: No (secure winners first in ranges)

    AI TRIM:

    β€’ Enable: Yes

    β€’ Trigger Count: 25

    β€’ Close Count: 4

    BREAK-EVEN:

    β€’ Enable: Yes

    β€’ Trigger: 150 points

    β€’ Offset: 10 points

    TRAILING:

    β€’ Enable: No (ranges don’t trend far)

    PARTIAL CLOSE:

    β€’ Enable: Yes

    β€’ Close Percent: 70.0 (aggressive profit-taking)

    β€’ Min Profit: 200 points

    SMA FILTER:

    β€’ Enable: No (ranges cross SMA frequently)

    RISK & LOCKS:

    β€’ Lot Size: 0.10

    β€’ Equity Lock: 80.0 USD (quick profit-taking)

    β€’ Drawdown Lock: 300.0 USD

    β€’ Profit Lock: 150.0 USD

    β€’ Stop After Profit Lock: No (continue in ranges)

    β€’ Close After Days: 5 (don’t hold range trades long)

    MISC:

    β€’ Max Spread: 30 points

    β€’ Magic: 555555

    β€’ Debug: Yes

    PHILOSOPHY:

    β€’ Tight grid spacing catches small range moves

    β€’ Fixed TP (100 pts) scalps range bounces

    β€’ Aggressive partial close (70%) locks range profits

    β€’ Short position age (5 days) prevents stale range trades

    β€’ No SMA filter (ranges whipsaw around MA)

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

    7. OPTIMIZATION GUIDE

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

    7.1 BACKTESTING BEST PRACTICES

    ─────────────────────────────

    Nb please note that the full complete pdf guide is available on request

    [Click here for Part 3]

    Back testing best practices and the rest of the guide in part 3, wish I could paste the whole thing here but limits.

    www.mql5.com (Article Sourced Website)

    #Grid #Masters #Temporal #Trader #MT5 #Complete #UserGuide #Part