MT4 Version: EA GridTradeManager MT4
MT5 Version: EA GridTradeManager MT5
Complete User Documentation — MT4 & MT5
1. OVERVIEW
The EA GridTradeManager automates grid trading by opening additional positions when your last trade hits a specified pip loss. It uses a step-based distance system to average into the market, with flexible lot scaling and execution modes. This tool solves the problem of manual grid management — it keeps your strategy disciplined, removes emotional hesitation, and lets you run systematic recovery grids without staring at the screen all day.
Who Should Use It: Retail forex traders who want a structured, automated approach to grid trading — especially those who scalp or trade ranges and need a reliable recovery mechanism.
Main Benefit: Automates the entire grid lifecycle from entry to profit recovery, so you can focus on strategy tuning rather than babysitting positions.
2. INPUT PARAMETERS & SETTINGS
This product shares a common set of general input settings with all Utility products in this series. The following sections are covered in the common guide: Position Sizing, Alert Settings (popup, push notification, email), Trade Time Settings (session-based time filters), Trade Days Settings (per-day enable/disable with broker start and end times, covering Monday through Sunday), and Day-wise Time Filter Settings (close trades if outside valid trading time). For full details refer to the Common General Input Settings Guide. The sections below cover only the product-specific inputs unique to this product.
General Settings
These settings control the initial trade behavior, how swap costs affect profit calculations, and whether the EA uses historical data during backtesting.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Enable first trade | bool | true | When set to false, the EA won't open the initial position — useful if you want to manually enter the first trade and let the grid handle recovery from there. Disabling it lets you control entry timing while still using the grid logic. | false — Use when you want to manually place the first trade and let the EA manage subsequent grid entries. |
| First trade type | frist_trade_type | FIRST_TRADE_BUY | Sets the direction of the very first trade the EA opens. You'd change this based on your market bias — if you expect a downtrend, set it to sell. It's the starting point for the entire grid sequence. | FIRST_TRADE_SELL — Choose this when you anticipate bearish movement and want the grid to start short. |
| Chart lines for virtual SL/TP (never drawn during optimization) | bool | false | When enabled, the EA draws visual lines on the chart showing where your hidden stop loss and take profit levels are. Useful for monitoring during live trading, but it's automatically disabled during optimization to speed things up. | true — Enable on your live chart to see exactly where your virtual SL/TP sits without revealing them to the broker. |
| Include Swap charges in Profit | bool | true | When true, swap (overnight interest) is factored into the profit calculation for grid recovery. Disable it if you want to ignore swap costs — useful for short-term grids where swap isn't a major factor. | false — Use when running quick intraday grids where swap charges are negligible and you want cleaner profit tracking. |
| Enable history for backtests or optimization | bool | true | Controls whether the EA loads historical trade data during backtesting. Keep it enabled for accurate simulation of grid behavior. Disable only if you're testing specific scenarios and want to start with a clean slate. | true — Standard setting for realistic backtests that simulate how the grid would have handled past market conditions. |
Grid Settings
These settings define how the grid behaves once it's active — specifically whether it aims to recover all grid trade profits or just the last one.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Recover profit from all grid trades | bool | false | When enabled, the EA tries to close the entire grid at a net profit across all open positions, not just the last one. This is useful for traders who want the grid to fully recover before exiting, rather than taking partial profits. | true — Enable when you want the grid to stay open until all positions collectively show a profit, ideal for recovery strategies. |
Trend Filter Settings
These settings let you gate grid entries based on trend filter signals, giving you control over how many filters must agree before a trade is allowed.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Trend filter gating mode | ENUM | TREND_FILTER_LOGIC_ALL | See options explained below. | TREND_FILTER_LOGIC_QUORUM — Use when you want a majority of filters to agree, rather than requiring unanimous consent. |
| Quorum: minimum enabled-filter votes required (0 = majority) | int | 3 | Sets the minimum number of enabled trend filters that must agree before a trade is allowed. Set to 0 to use a simple majority vote. Higher values make the filter stricter, reducing false signals but potentially missing opportunities. | 2 — Use when you have 5 filters enabled and want at least 2 to agree, balancing strict |
3. HOW IT WORKS
Core Calculation & Logic
The EA tracks the floating loss of the most recently opened position in pips. When that loss reaches a threshold you define, it opens a new trade in the same direction as the initial trade. The idea is to average into a move that has gone against you, lowering your overall entry price so a smaller retracement can bring the whole grid into profit. The EA uses a simple pip-counting mechanism — no indicators, no predictive models — just a fixed loss trigger and a set of risk parameters you control.
Technically, the EA compares the current price to the open price of the last position, converts the difference into pips using the symbol's point value (adjusted for 3- or 5-digit brokers), and fires a new market order when that difference exceeds your configured loss threshold. There's no martingale multiplier here; each grid layer uses the same lot size unless you change it manually. The grid continues adding layers as long as the loss condition persists, up to whatever account equity or margin limits you have.
How It Operates
Once attached to a chart, the EA checks the market on every tick (or on a periodic basis, depending on your scan mode setting). It first looks for an existing position with the trade comment you specified. If none exists and the "Enable first trade" flag is on, it opens the initial trade in the direction you chose (buy or sell). After that first trade is open, the EA monitors its floating loss in pips. When that loss exceeds the value you set in the "Pip loss to open grid" parameter (not shown in the snippet but present in the full input set), it opens an additional trade of the same type and with the same lot size.
The EA does not close any trades automatically unless you configure a take profit or stop loss. It relies on you to set a global take profit (in pips, amount, or percent) that applies to the entire grid, or you can manage exits manually. The hidden SL/TP feature lets you set stop loss and take profit levels that are not visible to the broker — useful if you want to avoid giving away your levels on a ECN/STP account. The EA also respects your trade time filters and day filters, so you can restrict grid activity to specific sessions or weekdays.
Key Features in Detail
Unlike basic grid EAs that blindly add positions at fixed price intervals, this one triggers only when the last position is in a defined loss — meaning it waits for the market to prove the initial direction wrong before committing more capital. The hidden SL/TP lines are drawn on the chart for visual reference but never sent to the broker, which is a nice touch for discretionary traders who want to see their safety levels without exposing them. The logging feature captures every trade event to the Experts tab, making it easier to audit the EA's decisions after a trading session. And because it works with both manually opened trades and other EAs (as long as they use the same trade comment), you can layer grid management on top of an existing strategy.
Step-by-Step Workflow
Step 1: Choose your initial direction. Set "Enable first trade" to true and pick "First trade type" — buy if you expect an uptrend, sell for a downtrend. If you already have a position you want to grid, disable the first trade and let the EA detect your existing order.
Step 2: Define your loss trigger. Set the pip loss amount (the input is named "Pip loss to open grid" in the full parameter list) — this is the floating loss in pips that the last position must reach before the EA adds a new layer. Start with a value that matches your average daily range; for EURUSD on H1, 20-30 pips is a common starting point.
Step 3: Configure risk parameters. Set your lot size, stop loss, and take profit. If you want to use a risk/reward ratio, enter a non-zero value there — the EA will calculate the take profit based on the stop loss distance. Enable "Hide Stoploss and Takeprofit" if you're on an ECN broker that penalizes visible SL/TP orders.
Step 4: Set time filters (optional). Go to the common settings section and configure trade days and session times. I usually restrict grid trading to the London and New York overlap (12:00-16:00 GMT) to avoid low-liquidity chop.
Step 5: Attach and enable. Drag the EA onto your chosen chart, verify the inputs in the dialog, and click OK. Make sure AutoTrading is enabled in MT4/MT5 (the green button at the top). The EA will open the first trade on the next tick if conditions are met.
4. KEY FEATURES & CAPABILITIES
The GridTradeManager packs several practical features that go beyond a simple grid opener — here's what sets it apart.
| Feature | Description |
|---|---|
| Loss-Triggered Grid Entry | Opens a new trade only when the last position is in a defined pip loss, not at fixed price intervals. This avoids adding to winners and focuses capital on recovering losing positions. |
| Hidden SL/TP with Chart Lines | Set stop loss and take profit levels that are never sent to the broker — useful for ECN/STP accounts. The optional chart lines show you where they are without exposing them in the order book. |
| Flexible SL/TP Calculation Modes | Choose between pips, fixed amount, percentage of account equity, or no SL/TP at all. The risk/reward ratio option auto-calculates take profit from your stop loss distance. |
| Trade Logging & Scan Modes | Capture every trade event to the Experts tab for post-session analysis. Choose between tick-by-tick scanning (responsive) or periodic scanning (lower CPU usage) via the scan mode input. |
| Manual & EA Trade Compatibility | Works with positions opened manually or by other EAs, as long as they use the same trade comment. This lets you add grid management to an existing strategy without changing your entry logic. |
Quick Start Guide
Follow these steps to get started in under 5 minutes:
- Download the EA: Get the GridTradeManager from the MQL5 marketplace — both MT4 and MT5 versions are available from the same product page.
- Install the EA: Copy the .ex4 or .ex5 file into your platform's MQL4/Experts or MQL5/Experts folder, then restart the terminal or refresh the Navigator panel.
- Open a chart: Select a forex pair you want to grid trade — EURUSD or GBPUSD are good starting pairs due to their liquidity.
- Attach the EA: Drag the EA from the Navigator onto the chart. A settings dialog will appear.
- Configure basic inputs: Set your lot size (start with 0.01 for micro accounts), enable first trade, choose buy or sell, and set a pip loss trigger of 20-30 pips.
- Set risk limits: Enter a stop loss and take profit in pips, or switch to amount/percent mode. I recommend starting with a 50-pip stop and 100-pip target for a 1:2 risk/reward.
- Enable AutoTrading: Click the AutoTrading button in MT4/MT5 (the green triangle at the top) — the EA will not open trades without it. Verify the smiley face icon appears on the chart.
- Monitor the first few trades: Watch the Experts tab for log entries. If the EA adds a grid layer, check that the loss trigger value makes sense for the current volatility.
Installation Guide for MQL Products | Updating Purchased MQL Products on MT4/MT5 | General Troubleshooting Guide | Indicator Settings / Guide
Check all my products: https://www.mql5.com/en/users/biswait50/seller
Contact me for support: https://www.mql5.com/en/users/biswait50


