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

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

19 January 2026, 15:56
Tola Moses Hector
0
26


═══════════════════════════════════════════════════════════════════════════════
    GRID MASTERS TEMPORAL EA MT5
    COMPLETE USER MANUAL AND GUIDE
    Version 1.12 | Copyright 2026, Hector Moses @ Grid Masters
═══════════════════════════════════════════════════════════════════════════════

TABLE OF CONTENTS
═════════════════

1. INTRODUCTION
   1.1 What is Grid Masters Temporal EA?
   1.2 How Does It Work?
   1.3 Who Is This EA For?
   1.4 System Requirements

2. INSTALLATION
   2.1 Downloading the EA
   2.2 Installing on MT5
   2.3 First-Time Setup
   2.4 Verifying Installation

3. CORE CONCEPTS
   3.1 Temporal Trading Explained
   3.2 Grid Trading Fundamentals
   3.3 SMA Directional Filter
   3.4 Trim Engines Overview
   3.5 Risk Management Philosophy

4. INPUT PARAMETERS EXPLAINED
   4.1 Temporal Settings
   4.2 Grid Settings
   4.3 Position Limits
   4.4 Legacy Trim Engine
   4.5 AI Trim Engine
   4.6 Single Position Trailing
   4.7 Break-Even Engine
   4.8 SMA Direction Filter
   4.9 Partial Close Engine
   4.10 Risk & Locks
   4.11 Miscellaneous Settings

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
13. DISCLAIMER & LEGAL

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


═══════════════════════════════════════════════════════════════════════════════
1. INTRODUCTION
═══════════════════════════════════════════════════════════════════════════════

1.1 WHAT IS GRID MASTERS TEMPORAL EA?
──────────────────────────────────────

Grid Masters Temporal EA is a professional automated trading system that combines:

• TIME-BASED TRADING: Deploys grids at specific server times (temporal triggers)
• GRID STRATEGY: Places multiple pending orders above and below current price
• DIRECTIONAL FILTERING: Uses SMA to trade only in trend direction
• INTELLIGENT MANAGEMENT: Dual trim engines and advanced risk controls

Unlike traditional grid EAs that run 24/7, this EA activates only at your chosen times,
allowing you to target specific market sessions and avoid unfavorable trading periods.


1.2 HOW DOES IT WORK?
─────────────────────

STEP 1: WAIT FOR TRIGGER TIME
The EA monitors server time and waits for one of your configured time slots
(e.g., 05:00, 10:00, 15:00).

STEP 2: CHECK SMA FILTER
When trigger time arrives, EA checks if price is above or below the SMA:
• Price > SMA → Place BUY grid only
• Price < SMA → Place SELL grid only
• Filter disabled → Place both BUY and SELL grids

STEP 3: DEPLOY GRID
EA places pending orders (Buy Stop above price, Sell Stop below price) at 
configured spacing intervals.

STEP 4: MANAGE POSITIONS
As orders activate and become positions, EA applies:
• Break-even engine (protect profits)
• Trailing stops (lock gains)
• Partial closes (take profits incrementally)
• Trim engines (reduce grid size when too large)

STEP 5: APPLY RISK LOCKS
EA constantly monitors:
• Equity Lock: Close all if open P&L reaches target
• Profit Lock: Protect realized profits
• Drawdown Lock: Close all if equity drops from peak
• Position Age: Close positions older than X days

STEP 6: RESET DAILY
Each new trading day, the trigger flags reset, allowing fresh grid placement
at your configured times.


1.3 WHO IS THIS EA FOR?
────────────────────────

✓ IDEAL FOR:
• Traders who understand grid trading mechanics
• Users who prefer time-based trading over 24/7 systems
• Those seeking professional risk management tools
• Traders comfortable with drawdown-heavy strategies
• Users who can monitor and adjust settings regularly

✗ NOT IDEAL FOR:
• Complete beginners to forex trading
• Users expecting "set and forget" with no monitoring
• Traders unwilling to accept temporary drawdowns
• Very small accounts (under $500 recommended minimum)
• Users who cannot handle emotional stress during drawdown


1.4 SYSTEM REQUIREMENTS
───────────────────────

MINIMUM:
• MetaTrader 5 build 3640 or higher
• VPS or stable internet connection (recommended for 24/7 operation)
• Account balance: $500+ (conservative settings)
• Broker with low spreads (max 2-3 pips on majors)
• Leverage: 1:100 or higher recommended

RECOMMENDED:
• MetaTrader 5 latest build
• VPS with low latency to broker server (<50ms ping)
• Account balance: $1,000+
• ECN/STP broker with tight spreads
• Leverage: 1:200 to 1:500

BROKER REQUIREMENTS:
• Supports pending orders (Buy Stop, Sell Stop)
• Allows modification of SL/TP
• Minimal restrictions on minimum distance for pending orders
• Hedging account mode (positions can be both BUY and SELL simultaneously)


═══════════════════════════════════════════════════════════════════════════════
2. INSTALLATION
═══════════════════════════════════════════════════════════════════════════════

2.1 DOWNLOADING THE EA
──────────────────────

After purchase from MQL5 Market:

1. Open MetaTrader 5
2. Go to: Toolbox → Market → My Products
3. Find "Grid Masters Temporal EA MT5"
4. Click "Install" or "Download"
5. EA will auto-install to: MQL5/Experts/ folder


2.2 INSTALLING ON MT5
─────────────────────

If manually installing .ex5 file:

1. Open MT5 Data Folder:
   File → Open Data Folder

2. Navigate to:
   MQL5 → Experts

3. Copy "Grid_Masters_Temporal_EA.ex5" here

4. Restart MetaTrader 5 OR
   Right-click Navigator → Refresh


2.3 FIRST-TIME SETUP
────────────────────

STEP 1: ENABLE ALGO TRADING
• Click "AutoTrading" button in MT5 toolbar (should turn green)
• Go to: Tools → Options → Expert Advisors
• Check: "Allow automated trading"
• Check: "Allow DLL imports" (not required but good practice)
• Check: "Allow WebRequest for listed URL" (not required for this EA)

STEP 2: ATTACH EA TO CHART
• Open a chart (e.g., EUR/USD M15)
• In Navigator panel, expand "Expert Advisors"
• Drag "Grid Masters Temporal EA" onto chart
• Input parameters window will appear

STEP 3: CONFIGURE BASIC SETTINGS
Minimal required changes:
• Temporal Settings: Set your 3 trigger times (server time format HH:MM)
• Grid Settings: Set grid spacing (start with 50 points)
• Risk & Locks: Set lot size (start with 0.01)
• Click "OK"

STEP 4: VERIFY EA IS RUNNING
• Top-right corner of chart should show: "Grid Masters Temporal EA" with a smiley face ☺
• If you see ✗ or ☹, check:
  - AutoTrading is enabled
  - Account allows algo trading
  - No broker restrictions


2.4 VERIFYING INSTALLATION
───────────────────────────

QUICK TEST (on demo account):

1. Set Time Slot 1 to current server time + 2 minutes
   (e.g., if server time is 14:35, set "14:37")

2. Set:
   • Grid Spacing: 50 points
   • Buy Levels: 3
   • Sell Levels: 3
   • Lot Size: 0.01
   • Max Spread: 50 points

3. Wait 2-3 minutes

4. Check "Trade" tab in Terminal:
   • You should see 6 pending orders appear (3 Buy Stop, 3 Sell Stop)
   • If yes: Installation successful! ✓
   • If no: Check "Experts" log for error messages

5. Delete test orders manually or let them stay (they'll activate if price hits them)


═══════════════════════════════════════════════════════════════════════════════
3. CORE CONCEPTS
═══════════════════════════════════════════════════════════════════════════════

3.1 TEMPORAL TRADING EXPLAINED
───────────────────────────────

WHAT IS TEMPORAL TRADING?
Instead of running continuously 24/7, temporal trading activates only at specific
times of day. This allows you to:

• Target high-liquidity sessions (London open, NY open, Asian session)
• Avoid low-liquidity periods (late Friday, Sunday open)
• Skip news events by not trading during those hours
• Reduce exposure by limiting daily trading windows

HOW IT WORKS IN THIS EA:
• You set 3 time slots (e.g., "05:00", "10:00", "15:00")
• Each day, when server time matches a slot, the EA places a grid
• Once triggered, that slot won't fire again until next day
• Grids remain active until closed by position management engines

EXAMPLE SCHEDULE:
Time Slot 1: "07:00" → Target London open (high volatility)
Time Slot 2: "13:00" → Target NY session start
Time Slot 3: "21:00" → Target Asian session

IMPORTANT NOTES:
• Times are in BROKER SERVER TIME (check MT5 "Market Watch" time)
• Most brokers use GMT+2 or GMT+3 (depends on DST)
• To find your broker's timezone:
  - Check broker website
  - Compare MT5 time to your local time
  - Use an online broker time converter


3.2 GRID TRADING FUNDAMENTALS
──────────────────────────────

WHAT IS GRID TRADING?
Grid trading places multiple pending orders at fixed intervals above and below
the current price, creating a "grid" pattern.

GRID STRUCTURE:
Price is currently at 1.1000

SELL GRID (below price):
1.0950 ← Sell Stop (50 points below)
1.0900 ← Sell Stop (100 points below)
1.0850 ← Sell Stop (150 points below)

── 1.1000 ← Current Price ──

BUY GRID (above price):
1.1050 ← Buy Stop (50 points above)
1.1100 ← Buy Stop (100 points above)
1.1150 ← Buy Stop (150 points above)

ACTIVATION:
• If price rises to 1.1050, the first Buy Stop activates (becomes a BUY position)
• If price falls to 1.0950, the first Sell Stop activates (becomes a SELL position)
• Price can activate multiple levels, creating multiple positions

PROFIT MECHANISM:
Grid profits come from:
1. MEAN REVERSION: Price returns to original level, closing profitable positions
2. TREND CAPTURE: Multiple positions in trend direction accumulate profit
3. PARTIAL CLOSES: Taking profits incrementally as grid fills

RISK:
• Drawdown occurs when price moves strongly in one direction
• Many positions can open on one side (all in drawdown)
• Requires adequate margin to sustain drawdown periods


3.3 SMA DIRECTIONAL FILTER
───────────────────────────

WHAT IS SMA FILTER?
Simple Moving Average (SMA) acts as a trend direction indicator:
• Price > SMA = Uptrend → Only place BUY grid
• Price < SMA = Downtrend → Only place SELL grid

WHY USE IT?
Traditional grids place orders both directions, which means:
• Trading against the trend (counter-trend SELL orders in uptrend)
• Higher risk of drawdown
• Lower win rate

With SMA filter:
• You trade WITH the trend
• Reduced counter-trend exposure
• Better alignment with market momentum

EXAMPLE:
EUR/USD at 1.1000, SMA(50) at 1.0950

Analysis: Price is ABOVE SMA = Uptrend

EA Action: Places only BUY grid (1.1050, 1.1100, 1.1150...)
Result: Only BUY positions can open, all aligned with trend

OPTIONAL CROSS-CLOSE:
If enabled ("Close on SMA Cross"), EA will:
• Monitor for candle close below SMA (in uptrend)
• Close all BUY positions immediately when cross confirmed
• Prevents holding counter-trend positions

RECOMMENDED SETTINGS:
• SMA Period: 50 (balanced trend detection)
• Fast trends: Use SMA 20-30
• Slow trends: Use SMA 100-200
• Enable Cross-Close: Yes (for strict trend following)


3.4 TRIM ENGINES OVERVIEW
──────────────────────────

WHY TRIM?
Grid trading can accumulate many positions. Without management:
• Margin can be exhausted
• Drawdown becomes unmanageable
• Account risk escalates

SOLUTION: Trim engines automatically reduce position count when thresholds are hit.

LEGACY TRIM ENGINE:
• Rule-based system
• Triggers when position count exceeds "Max Positions" (e.g., 40)
• Closes "Close Count" positions (e.g., 10) per cycle
• Can prioritize losers-first or winners-first
• Applies minimum profit filter (only close profitable ones)

Example:
• You have 42 positions
• Legacy Trim Max = 40
• Close Count = 10
• Close Losers First = Yes
→ EA closes the 10 most losing positions (if profit > min filter)

AI TRIM ENGINE:
• Equity-slope based algorithm
• Triggers when position count exceeds "AI Max Positions" (e.g., 45)
• Closes "AI Close Count" positions (e.g., 5) per cycle
• Prioritizes positions dragging equity down
• Works alongside Legacy Trim for layered protection

Example:
• You have 47 positions
• AI Trim Max = 45
• AI Close Count = 5
→ EA analyzes equity impact and closes 5 worst performers

RECOMMENDED USAGE:
Enable BOTH trims:
• Legacy Trim: First line of defense (triggers at 40 positions)
• AI Trim: Second line (triggers at 45 positions)
• Provides dual-layer protection


3.5 RISK MANAGEMENT PHILOSOPHY
───────────────────────────────

Grid trading is inherently high-risk. This EA provides multiple safety mechanisms:

LAYER 1: POSITION LIMITS
• Max BUY Positions: Hard cap on long side
• Max SELL Positions: Hard cap on short side
→ Prevents unlimited position accumulation

LAYER 2: TRIM ENGINES
• Legacy + AI Trim: Reduce position count before catastrophic drawdown
→ Manages grid size dynamically

LAYER 3: BREAK-EVEN + TRAILING
• Break-Even: Protects individual positions once profitable
• Trailing Stop: Locks in gains as price moves favorably
→ Converts open profit to protected profit

LAYER 4: PARTIAL CLOSE
• Basket Partial Close: Takes profit on entire grid proportionally
→ Reduces exposure while keeping positions alive

LAYER 5: LOCK SYSTEMS
• Equity Lock: Emergency brake if open P&L hits target
• Drawdown Lock: Stops losses if equity drops from peak
• Profit Lock: Protects realized account gains
→ Account-level circuit breakers

LAYER 6: POSITION AGE
• Auto-Close After X Days: Prevents stale positions
→ Forces position turnover

RECOMMENDED APPROACH:
1. Start conservative (small lots, tight locks)
2. Monitor drawdown patterns in backtest
3. Gradually increase risk only after profitable forward test
4. NEVER risk more than 1-2% per grid level
5. Always use stop-loss on account level (broker SL or equity lock)


═══════════════════════════════════════════════════════════════════════════════
4. INPUT PARAMETERS EXPLAINED
═══════════════════════════════════════════════════════════════════════════════

4.1 TEMPORAL SETTINGS (SERVER TIME)
────────────────────────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Time Slot 1: "05:00" │
│ Time Slot 2: "10:00" │
│ Time Slot 3: "15:00" │
└─────────────────────────────────────────────────────────────────┘

DESCRIPTION:
Three daily time slots when the EA will place grids.

FORMAT: "HH:MM" (24-hour format)
• "05:00" = 5:00 AM server time
• "13:30" = 1:30 PM server time
• "21:00" = 9:00 PM server time

IMPORTANT:
• Uses BROKER SERVER TIME (check MT5 Market Watch)
• Once a slot triggers, it won't trigger again until next day
• All three slots are independent (you can use 1, 2, or all 3)

EXAMPLE CONFIGURATIONS:

LONDON SESSION FOCUS:
Slot 1: "07:00" (London open)
Slot 2: "09:00" (London mid-session)
Slot 3: "12:00" (London close)

NEW YORK SESSION FOCUS:
Slot 1: "13:00" (NY open)
Slot 2: "15:00" (NY mid-session)
Slot 3: "20:00" (NY close)

ASIAN SESSION FOCUS:
Slot 1: "21:00" (Tokyo open)
Slot 2: "01:00" (Asian mid-session)
Slot 3: "05:00" (Asian close)

24-HOUR COVERAGE:
Slot 1: "00:00" (Daily reset)
Slot 2: "08:00" (London)
Slot 3: "14:00" (NY)

TIP: Leave slots at different times (minimum 1 hour apart) to avoid conflicts.


4.2 GRID SETTINGS
─────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Buy Levels: 10 │
│ Sell Levels: 10 │
│ Grid Spacing (points): 50 │
│ Stop Loss (points): 0 │
│ Take Profit (points): 0 │
└─────────────────────────────────────────────────────────────────┘

BUY LEVELS:
Number of Buy Stop orders to place above current price.
• Default: 10
• Range: 1-50
• Higher = More coverage, more positions, more margin needed

SELL LEVELS:
Number of Sell Stop orders to place below current price.
• Default: 10
• Range: 1-50
• Higher = More coverage, more positions, more margin needed

GRID SPACING (POINTS):
Distance between each grid level.
• Default: 50 points (5 pips on 5-digit broker)
• Range: 10-500
• Smaller spacing = Tighter grid, more positions activate
• Larger spacing = Wider grid, fewer activations, more stability

EXAMPLES:
30 points = Very tight (scalping style, high frequency)
50 points = Moderate (balanced, good for majors)
100 points = Wide (conservative, less frequent activations)

STOP LOSS (POINTS):
Individual SL for each position.
• Default: 0 (disabled, managed by locks instead)
• Range: 0-1000
• 0 = No SL (rely on equity lock for protection)
• >0 = Fixed SL per position (reduces max drawdown)

TAKE PROFIT (POINTS):
Individual TP for each position.
• Default: 0 (disabled, managed by partial close instead)
• Range: 0-1000
• 0 = No TP (grid stays open, managed by engines)
• >0 = Fixed TP per position (auto-close at profit target)

RECOMMENDED:
• Leave SL and TP at 0
• Use Equity Lock for overall SL
• Use Partial Close for TP management
• This gives EA full control via intelligent engines


4.3 POSITION LIMITS
───────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Max BUY Positions: 0 │
│ Max SELL Positions: 0 │
└─────────────────────────────────────────────────────────────────┘

MAX BUY POSITIONS:
Hard limit on total BUY positions allowed.
• Default: 0 (unlimited)
• Range: 0-100
• When limit reached, EA skips placing BUY grid
• Prevents over-exposure to long side

MAX SELL POSITIONS:
Hard limit on total SELL positions allowed.
• Default: 0 (unlimited)
• Range: 0-100
• When limit reached, EA skips placing SELL grid
• Prevents over-exposure to short side

EXAMPLE USAGE:

SMALL ACCOUNT ($500):
Max BUY: 10
Max SELL: 10
→ Maximum 20 total positions

MEDIUM ACCOUNT ($2,000):
Max BUY: 20
Max SELL: 20
→ Maximum 40 total positions

LARGE ACCOUNT ($10,000+):
Max BUY: 0 (unlimited)
Max SELL: 0 (unlimited)
→ Rely on Trim Engines instead

TIP: Use position limits on accounts under $1,000 for strict risk control.


4.4 LEGACY TRIM ENGINE
──────────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Enable Legacy Trim: Yes │
│ Max Positions Before Trimming: 40 │
│ Positions to Close Per Trim: 10 │
│ Minimum Profit Filter: 0.0 │
│ Close Losers First: Yes │
└─────────────────────────────────────────────────────────────────┘

ENABLE LEGACY TRIM:
Master on/off switch.
• Yes = Active
• No = Disabled (dangerous on small accounts)

MAX POSITIONS BEFORE TRIMMING:
Trigger threshold.
• Default: 40
• When total positions >= 40, trim activates
• Lower = More aggressive trimming
• Higher = More lenient

POSITIONS TO CLOSE PER TRIM:
How many to close each cycle.
• Default: 10
• Range: 1-50
• Higher = Faster reduction (can close all at once if aggressive)
• Lower = Gradual reduction

MINIMUM PROFIT FILTER:
Only close positions with profit > this value.
• Default: 0.0 (close any position, even losers)
• Range: -100.0 to +100.0 (USD)
• Positive value = Only close profitable ones
• 0 = Close regardless of P&L

CLOSE LOSERS FIRST:
Prioritization logic.
• Yes = Close most losing positions first
• No = Close most profitable positions first

RECOMMENDED:
• Yes = Reduces drawdown (get rid of losers)
• No = Lock in gains (secure winners)

TYPICAL SETUP:
Enable: Yes
Max Positions: 40
Close Count: 10
Min Profit: 0.0
Losers First: Yes
→ When 40 positions reached, close 10 worst losers


4.5 AI TRIM ENGINE
──────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Enable AI Trim: Yes │
│ Trigger Position Count: 45 │
│ Close Count Per Cycle: 5 │
└─────────────────────────────────────────────────────────────────┘

ENABLE AI TRIM:
Master on/off switch.
• Yes = Active (recommended)
• No = Disabled

TRIGGER POSITION COUNT:
Threshold for AI activation.
• Default: 45
• Should be HIGHER than Legacy Trim (acts as backup)
• When total positions >= 45, AI trim activates

CLOSE COUNT PER CYCLE:
Positions closed per AI trim.
• Default: 5
• Range: 1-20
• Usually smaller than Legacy Trim (fine-tuning)

HOW IT WORKS:
AI Trim uses equity slope analysis:
1. Calculates current equity
2. Identifies positions dragging equity down
3. Closes worst equity-impact positions
4. Prioritizes losers creating slope drag

RECOMMENDED SETUP:
Enable: Yes
Trigger Count: 45 (5 higher than Legacy)
Close Count: 5 (half of Legacy)
→ Acts as secondary defense after Legacy Trim


4.6 SINGLE POSITION TRAILING (INDEPENDENT)
───────────────────────────────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Enable Per-Position Trailing: No │
│ Start Trigger (points): 400 │
│ Trailing Step (points): 200 │
└─────────────────────────────────────────────────────────────────┘

ENABLE PER-POSITION TRAILING:
Master on/off switch.
• Yes = Each position trails independently
• No = Disabled (use basket management instead)

START TRIGGER (POINTS):
Profit threshold to begin trailing.
• Default: 400 points (40 pips)
• Position must be in profit by this amount before trailing starts
• Prevents premature SL adjustments in ranging markets

TRAILING STEP (POINTS):
Distance to trail behind current price.
• Default: 200 points (20 pips)
• SL follows price at this distance
• Smaller = Tighter trailing (more protection, more likely to hit)
• Larger = Looser trailing (more breathing room)

EXAMPLE:
BUY position at 1.1000
Price rises to 1.1040 (400 points profit)
→ Trailing activates
→ SL set to 1.1040 - 0.0020 = 1.1020

Price rises to 1.1060
→ SL moves to 1.1060 - 0.0020 = 1.1040
→ Locked in 40 pips profit

RECOMMENDED:
• Disable for grid trading (use basket partial close instead)
• Enable only if you want individual position protection
• Use wide settings (400/200) to avoid premature stops


4.7 BREAK-EVEN ENGINE
─────────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Enable Break-Even: Yes │
│ Trigger (points in profit): 200 │
│ Offset (points beyond entry): 10 │
└─────────────────────────────────────────────────────────────────┘

ENABLE BREAK-EVEN:
Master on/off switch.
• Yes = Active (highly recommended)
• No = Disabled

TRIGGER (POINTS IN PROFIT):
Profit threshold to activate break-even.
• Default: 200 points (20 pips)
• When position profits reach this level, SL moves to break-even
• Lower = More aggressive protection
• Higher = More breathing room before locking

OFFSET (POINTS BEYOND ENTRY):
Safety buffer beyond entry price.
• Default: 10 points (1 pip)
• SL is set to entry price + offset
• Protects against spread/slippage hitting exact entry
• Small buffer ensures you capture some profit

EXAMPLE:
BUY position at 1.1000 (entry)
Current price: 1.1020 (200 points profit)
→ Break-even triggers
→ SL set to 1.1000 + 0.0010 = 1.1010

If price reverses:
→ Position closes at 1.1010
→ Small profit locked (10 points)

RECOMMENDED SETUP:
Enable: Yes
Trigger: 200 points (adjust based on pair volatility)
Offset: 10 points (safe buffer)
→ Protects profits without being too tight


4.8 SMA DIRECTION FILTER
─────────────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Enable SMA Filter: Yes │
│ SMA Period: 50 │
│ Close on SMA Cross: No │
└─────────────────────────────────────────────────────────────────┘

ENABLE SMA FILTER:
Master on/off switch.
• Yes = Only trade in SMA direction
• No = Trade both directions (traditional grid)

SMA PERIOD:
Number of bars for SMA calculation.
• Default: 50
• Range: 10-200
• Lower (20-30) = Fast, responsive to recent price
• Medium (50-100) = Balanced trend detection
• Higher (100-200) = Slow, major trend only

CLOSE ON SMA CROSS:
Force-close positions on SMA crossback.
• No = Let positions run (default)
• Yes = Close all when candle closes opposite SMA

EXAMPLE (Close on Cross = Yes):
BUY positions open (price was above SMA)
Price falls below SMA
→ Wait for candle close below SMA
→ If confirmed, close all BUY positions immediately

RECOMMENDED SETUPS:

STRICT TREND FOLLOWING:
Enable: Yes
Period: 50
Close on Cross: Yes
→ Very disciplined, exits on trend change

RELAXED TREND FILTER:
Enable: Yes
Period: 100
Close on Cross: No
→ Filters entry direction, lets positions manage themselves

NO FILTER (TRADITIONAL GRID):
Enable: No
→ Places both BUY and SELL grids regardless of trend


4.9 PARTIAL CLOSE ENGINE
─────────────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Enable Partial Close: No │
│ Close Percent: 50.0 │
│ Minimum Profit (points): 300 │
└─────────────────────────────────────────────────────────────────┘

ENABLE PARTIAL CLOSE:
Master on/off switch.
• Yes = Basket partial close active
• No = Disabled

CLOSE PERCENT:
Percentage of each position to close.
• Default: 50.0 (close half)
• Range: 10.0 - 90.0
• 50.0 = Close 50% of volume, keep 50% running

MINIMUM PROFIT (POINTS):
Basket average profit threshold.
• Default: 300 points
• EA calculates average profit across ALL positions
• If average >= 300 points, partial close triggers
• Executes ONCE per position (tracked via comment)

HOW IT WORKS:
1. EA sums profit of all positions in points
2. Calculates average: Total Profit Pts / Position Count
3. If average >= 300 points:
   → Close 50% of each position
   → Mark position as "partially closed" (won't trigger again)

EXAMPLE:
10 positions open

Total profit: 3,500 pointsAverage profit: 3,500 / 10 = 350 points

Threshold: 300 points

→ Average exceeds threshold

→ EA closes 50% of EACH position (basket-wide partial close)

→ 5 positions remain at half volume

RECOMMENDED SETUPS:

AGGRESSIVE PROFIT-TAKING:

Enable: Yes

Close Percent: 70.0

Min Profit: 200 points

→ Takes most profits early

BALANCED APPROACH:

Enable: Yes

Close Percent: 50.0

Min Profit: 300 points

→ Half out at moderate profit

CONSERVATIVE (Let Winners Run):

Enable: No

→ Rely on other management instead

TIP: Partial close is excellent for grids - locks in profits while keeping exposure.

4.10 RISK & LOCKS

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

┌─────────────────────────────────────────────────────────────────┐

│ Lot Size: 0.10 │

│ Equity Lock (open PnL): 110.0 │

│ Drawdown Lock: 0.0 │

│ Profit Lock: 0.0 │

│ Stop Trading After Profit Lock: Yes │

│ Close After Days: 0 │

└─────────────────────────────────────────────────────────────────┘

LOT SIZE:

Base volume for each grid level.

• Default: 0.10

• Range: 0.01 - 10.0 (broker dependent)

• All pending orders use this volume

• Critical for position sizing - start small!

POSITION SIZING GUIDE:

$500 account: 0.01 lots

$1,000 account: 0.01 - 0.02 lots

$2,000 account: 0.05 - 0.10 lots

$5,000 account: 0.10 - 0.20 lots

$10,000+ account: 0.20 - 0.50 lots

EQUITY LOCK (OPEN PNL):

Auto-close all positions when open P&L reaches this level.

• Default: 110.0 USD

• Range: 0.0 - 10,000.0

• 0.0 = Disabled

• This is FLOATING PROFIT (unrealized)

EXAMPLE:

Equity Lock: 110.0

Open positions show +$115 floating profit

→ EA immediately closes ALL positions

→ Locks in profit, clears grid

RECOMMENDED:

Set to 1-2% of account balance

$1,000 account: 10-20 USD

$5,000 account: 50-100 USD

$10,000 account: 100-200 USD

DRAWDOWN LOCK:

Auto-close all when equity drops from peak.

• Default: 0.0 (disabled)

• Range: 0.0 - 10,000.0

• Tracks peak equity, closes if drop exceeds threshold

EXAMPLE:

Account equity peaks at $1,200

Drawdown Lock: 200.0

Equity drops to $995 (drop = $205)

→ EA closes all positions (limit reached)

RECOMMENDED:

Set to 10-20% of account

$1,000 account: 100-200 USD

$5,000 account: 500-1,000 USD

$10,000 account: 1,000-2,000 USD

PROFIT LOCK:

Protect REALIZED profits (account balance gains).

• Default: 0.0 (disabled)

• Range: 0.0 - 100,000.0

• Calculated as: (Current Balance - Starting Balance) + Open P&L

EXAMPLE:

Starting balance: $1,000

Current balance: $1,150 (made $150)

Profit Lock: 100.0

Open P&L: -$30

Total profit: $150 - $30 = $120

→ Exceeds $100 lock

→ Close all positions, lock gains

STOP TRADING AFTER PROFIT LOCK:

Controls EA behavior after Profit Lock triggers.

• Yes = EA freezes, no more trading (one-shot protection)

• No = EA continues placing grids (lock resets)

RECOMMENDED: Yes (safer)

CLOSE AFTER DAYS:

Auto-close individual positions after X days.

• Default: 0 (disabled)

• Range: 0 - 365

• Each position tracks its own age

• Closes when age >= limit

EXAMPLE:

Close After Days: 7

Position opened Monday 10:00

Next Monday 10:00 → Position is 7 days old

→ EA closes this position

→ Other positions unaffected

RECOMMENDED:

7-14 days for active management

30+ days for long-term holds

0 = Let other engines handle closing

4.11 MISCELLANEOUS SETTINGS

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

┌─────────────────────────────────────────────────────────────────┐

│ Max Spread (points): 50 │

│ Slippage: 5 │

│ Trade Comment: "GMTemporal" │

│ Magic Number: 20251201 │

│ Debug Mode: Yes │

└─────────────────────────────────────────────────────────────────┘

MAX SPREAD (POINTS):

Refuse to place grids if spread exceeds this.

• Default: 50 points (5 pips)

• Range: 10 - 500

• Prevents trading during high-spread periods (news, low liquidity)

BROKER SPREAD EXAMPLES:

ECN broker EUR/USD: 1-2 pips → Set 30 points

Standard broker EUR/USD: 2-3 pips → Set 50 points

Exotic pairs: 10+ pips → Set 150+ points

SLIPPAGE:

Maximum allowed price deviation when executing trades.

• Default: 5 points

• Range: 1 - 100

• Higher = More lenient (orders fill easier but worse price)

• Lower = Strict (better price but more rejections)

TRADE COMMENT:

Text label for all trades.

• Default: "GMTemporal"

• Appears in trade history and terminal

• Useful for tracking EA trades vs manual trades

• Max 31 characters

MAGIC NUMBER:

Unique identifier for this EA's trades.

• Default: 20251201

• Range: 0 - 2,147,483,647

• Allows running multiple EAs on same account

• EA only manages trades with matching magic

IMPORTANT: If running multiple instances:

Chart 1 (EUR/USD): Magic 111111

Chart 2 (GBP/USD): Magic 222222

→ Each EA manages only its own trades

DEBUG MODE:

Enable detailed logging in Experts tab.

• Yes = Verbose logging (recommended during setup)

• No = Minimal logging (for live trading after testing)

DEBUG OUTPUT INCLUDES:

• Grid placement notifications

• Trim engine activations

• Lock trigger events

• Margin guard warnings

• Position management actions

RECOMMENDED:

Yes = During backtesting and forward testing

No = Live trading (reduces log clutter)

Continues in Part 2

https://www.mql5.com/en/blogs/post/766856

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