Read this first: risk
  • A grid EA with growing lots can lose your whole deposit. By default every new position of a side is 1.2 times the size of the last one. A side that keeps losing builds a stack: 34 positions starting at 0.01 lot add up to about 24.5 lots, and the next order would be 4.92 lots. One long move in one direction can do that.
  • A bigger deposit does not make it safe. A strong trend can wipe a 10,000 USD account as well as a small one.
  • There is no fixed stop loss on a position. The only stop the EA sets is a trailing stop that follows the price once a position is in profit. A position that is losing has no stop at the broker.
  • The close target does not include the commission charged when the positions are closed unless you switch on "Count the closing commission in the targets". With a big stack that commission can be tens of USD, so a close at +2.00 can end in a loss. Slippage while the positions are closed one by one can take a little more.
  • The three guards (day target, drawdown stop, trading days and hours) are OFF by default. You switch them on yourself. They are limits for you, not a guarantee: a drawdown stop closes at market, and a gap or a fast market can take it past the limit you set.
  • Past results do not predict the future. Other brokers have other prices, spreads, commissions, swaps and server times.
  • Not safe, not passive income, nothing guaranteed. No setting turns this EA into either.
  • Start on a demo account for 2-4 weeks. Check that the EA trades and that you can live with the size of the losing stacks you see.
  • Then start small. The floor for learning is a cent account with 50-100 USD (5,000-10,000 USC). It is money to learn how the EA behaves, not to make a profit. On a cent account every money input and every money figure on the panel counts in USC (1 USD = 100 USC).
  • Ask support before you change any setting: https://m.me/forexreviewth
  • Keep the terminal running. Use a VPS that is on 24/5. The EA manages its positions only while the terminal runs.
  • Removing the EA does not close anything. Open positions and waiting orders stay at the broker, and the positions have no stop. Close them by hand before you remove the EA or stop the terminal for long.
No setting makes this EA safe, and it is not an income you can count on.
Gold EA

Hedging Grid Pump Lot

Free Expert Advisor for MetaTrader 5, gold (XAUUSD) only, for hedging accounts. It is a grid EA: it keeps trading both the BUY side and the SELL side, adds positions when the market moves against a side, and every new position of a side is larger than the one before. It closes the whole set when the combined result reaches a money target, and it trails a stop on open positions. A panel on the chart shows what it is doing.

Version 2.40 | Updated 2026-11-18 | Written for non-technical users

1What you need

▼
  1. MetaTrader 5 and a hedging account. A netting account is refused: the EA stops at start with a message in the Experts tab.
  2. A chart of your broker's gold symbol (XAUUSD, or with a suffix such as XAUUSDm), any timeframe. The EA is tested on gold only. On a gold symbol the distances below mean the same price on a 2-digit and a 3-digit quote (50 points = 0.50).
  3. WebRequest allowed for the licence check: Tools > Options > Expert Advisors > tick "Allow WebRequest for listed URL" and add all three:
    • https://zab-license.bangzeed.workers.dev
    • https://zab-license.vercel.app
    • https://license.forexreviewth.com
  4. A licence for your account number (see Licence below). A demo account needs none.

2Install

▼
  1. Copy HedgingGridPumpLot.ex5 into MQL5\Experts\ (File > Open Data Folder in MT5), then right-click Experts > Refresh.
  2. Open a gold chart and drag Hedging Grid Pump Lot onto it.
  3. In the Common tab tick "Allow Algo Trading", set the inputs (below), press OK.
  4. Turn on the Algo Trading button in the toolbar. The panel appears on the chart.
  5. Press START on the panel. Until you do, the EA places no order (new in 2.20; see the input "Start trading when the EA is attached" to make it start by itself).
  6. Run one copy per account and symbol. A second copy on the same account needs its own Magic number.

3Inputs (as shown in MT5)

▼

Distances are in points: on gold 1 point = 0.01 price units (50 points = 0.50). Money inputs (targets, loss limits, commission) are typed as on a USD account. On an account in another currency (THB, EUR, JPY ...) the EA converts them for you at start and writes the factor in the Experts tab, so a target of 2.0 closes at the same price move everywhere. On a USD or cent account nothing is converted (see "Account money" below).

Start (new in 2.20)

InputDefaultWhat it does
Start trading when the EA is attached (off = press START on the panel)falseOff: the EA waits and places no order until you press START on the panel, so a copy dropped on the wrong chart or with the wrong settings does nothing. On: it trades from the first tick, as versions up to 2.10 did. Once you have pressed START (or PAUSE), that choice is kept across restarts of the terminal and changes of the inputs; it is forgotten when you remove the EA from the chart. A Strategy Tester run without the chart (visual mode off) always starts by itself; a visual test follows this input, so press START on its panel or set it to true
Run engine onOnTick (every tick)OnTick: the EA checks prices and moves its orders on every new price, as all earlier versions did. OnTimer: it does the same on a fixed clock instead (the next input), which caps how often it can send requests in a fast market; while the market is closed or no price has come for 5 minutes it does nothing. Tester results differ between the two
Timer period in seconds when Run engine on = OnTimer (0.05-60)0.5How often the EA works when "Run engine on" is OnTimer. Ignored on OnTick

Sides and lot

InputDefaultWhat it does
Trade the BUY sidetrueSwitch a side off. A side that is off places no new order; what it already has stays managed
Trade the SELL sidetrueSame for the SELL side
Lot of the first order0.01Lot of the first order of a side
Lot growth per position of a side1.2Each new position of a side is this many times larger than the last. 1.0 = no growth
Extra lot added per position0.0A fixed extra lot added for every position the side already has
Lot rounding digits2Decimals the lot is rounded to before the broker's volume step is applied

Grid (points)

InputDefaultWhat it does
Stop distance when the side has no position50How far from the market the first order of a side is placed
Stop distance, first set of positions80Distance for the next orders while the side is in its first set
Extra gap before the next order, first set80How far the market must move against the side before it adds again, on top of the distance above
Positions in the first set (the deep set applies after)5How many positions belong to the first set
Stop distance, deep set30Distance for the orders of a deep stack
Extra gap before the next order, deep set80The same gap rule for a deep stack
A pending stop moves only when off target by more than this5Smaller changes are ignored, which keeps the number of requests down
Follow-up stop after a fill (approximate)falseOptional extra order after a fill. It does not follow the main rules exactly; leave it off
No add while the side's floating loss is beyond this (0 = off)0Stops a side from adding while it is losing more than this amount. 0 = no limit

Exit (account currency)

InputDefaultWhat it does
Net of the whole book that closes everything (above 0)2.0When both sides together are this much in profit after costs, everything is closed
Net loss of the whole book that closes everything (0 = off)0A loss limit for the whole book. 0 = off. Closing at market can slip past it
Floating loss of a side that switches on side targets (0 = off)0Switches to the side targets below once a side floats this deep. 0 = off
Net of one side that closes that side (side targets)30.0Used only with the setting above
Basket target grows with the first order's lot (x lot / 0.01)falseOn: the target above follows your first lot. First lot 0.05 = 5 x 2.0 = 10.0. Off = the target as typed
Basket target grows with the open lots of the bookfalseOn: the target rises while more lots are open (see the next line), never below the target above. Off = as typed
Grows with open lots: target per 0.01 lot open1.0Example: 0.07 lot open on both sides together = 7 x 1.0 = 7.0
Highest basket target when it grows (0 = no limit)100.0A grown target never goes above this. Used only when one of the two switches is on

A higher target with many lots open means the book waits longer for a close, and the floating loss can go deeper meanwhile. Try it on a demo first and keep the highest target low.

Trailing stop (points)

InputDefaultWhat it does
Stop distance behind the price5How far behind the price the trailing stop is kept
Move the stop only when it improves by more than this0Ignores smaller improvements
The average must lie this far inside the stop10The stop is set only after the price is this far in profit beyond the side's average

Some brokers do not accept a stop or a pending order closer to the price than a minimum distance ("stops level" in the symbol's specification). Where a distance you typed is closer than that, the EA places the stop at the broker's minimum plus 10 points instead and says so once in the Experts tab at start. On a broker without a minimum (most raw-spread gold accounts) nothing changes. A wider stop trails later and gives back more before it closes: with a large minimum the EA does not trade like the test results of a broker without one.

Costs

InputDefaultWhat it does
Commission per lot, open + close together, used only when the broker reports none7.0What your broker quotes for 1 lot, open and close together (for example 7 USD): type that number, the EA halves it for one deal. Used only when your broker's deal history shows no commission on the opening deal; most raw-spread accounts show it, then this input is not used. No commission at all: enter 0. If the broker charges it all when the position closes, switch on the next input
Count the closing commission in the targetsfalseOff: the close targets and the loss limit count the commission paid when positions were opened, and swap. On: they also subtract the commission that will be charged when the positions are closed (estimated as the same amount as on opening), so a target of 2.00 means about 2.00 really kept

Account money (new in 2.00)

InputDefaultWhat it does
Money inputs are written for a USD account: convert them for this accounttrueOn: every money input (the close targets, the loss limits, the add loss limit, the commission per lot, the day target, a drawdown limit in money) is multiplied by what 0.01 lot earns on your account when gold moves 1.00. On a USD account and on a cent account that is exactly 1, so nothing changes. On a THB account it is about 33: a target of 2.0 becomes about 66 baht, the same price move as 2 USD. The Experts tab shows the factor at start. Off: the numbers are used as typed, in your account's money (on a THB account a target of 2.0 is then 2 baht: far too small). The factor is read once at start; restart the EA after a large move of the exchange rate. Gold symbols only

Day target (off by default)

InputDefaultWhat it does
Day target in account currency (0 = off)0Reached for the day: no new orders until the next server day
Day target countsClosed deals onlyOr closed deals + the floating result of the open book
After the day targetKeep managing the open bookOr close all and stop

Drawdown stop (off by default)

InputDefaultWhat it does
Drawdown limit of this EA (0 = off)0Limit on this EA's own equity below its highest value. Other EAs and deposits do not count
Drawdown unitPercentOr account currency
Drawdown counted fromSince startOr since the start of the server day
Trading resumesNext dayOr manual: the stop stays until you use the input below
Clear a manual stop at start (set back to false after)falseClears a manual drawdown stop once when the EA starts. Set it back to false afterwards

Trading days and hours (off by default)

InputDefaultWhat it does
Trade only in the window belowfalseOff = all days, all hours
Monday ... SundayMon-Fri onDays the EA may place new orders
Window start, hour (0-23) / minute8 / 0Start of the window
Window end, hour (0-24, end not included) / minute20 / 0End of the window. A start later than the end is a window over midnight; 00:00-24:00 is all day
Window timeServer timeOr GMT, or New York time
At the end of the windowKeep managing the open bookOr close all

Server load (off by default, new in 2.00)

This EA sends a lot of trade requests: on a busy market tens of thousands a day (moving its pending stops and its trailing stops). Some brokers limit that. These four inputs make it send about half as many without changing its rules. With all of them off the EA works exactly like version 1.00.

InputDefaultWhat it does
Move a pending stop on the server only when the price comes near itfalseOn: the EA still follows the market tick by tick, but moves the order at the broker only when the price turns towards it
Near = within this percent of the stop distance (1-100)50How close "near" is. Lower = fewer requests, but less time for the order to arrive
Shortest time between two stop requests of one position, ms (0 = every tick)0500 = the trailing stop of one position is sent at most twice a second. The first stop of a position is always sent at once
Check the basket close before the trailing stopsfalseOn: the close of the whole set is never kept waiting by stop requests

Tested in the Strategy Tester only (recorded ticks, with a 200 ms execution delay): requests fell to 44-49 % of version 1.00's, and the results were not worse. They have not run on a live broker yet. Try them on a demo account first: set the first and the last to true and the third to 500. When the EA stops it writes one line to the Experts tab that starts with HGPL-REQ: the number of requests it sent, by kind.

Look and identity

InputDefaultWhat it does
Panel at startOpenOpen or Collapsed (header and footer only). A click on the header folds and opens it at any time; the panel remembers it
Magic number of this EA's orders618024Marks this EA's orders and positions. Change it only when another EA on the account uses the same number
Order commentHGPLText on the orders

4The three guards

▼

All three are off by default. When a guard stops new orders the EA still manages the open positions (trailing stop and the close targets), unless you chose "close all". Several at once: licence, then drawdown stop, then day target, then schedule.

  • Day target. When today's result reaches your target, pending orders are deleted and no new order is placed until the next server midnight. The open positions keep being managed. Choose "close all and stop" if you want them closed too.
  • Drawdown stop. Measured on this EA only. When the drop reaches your limit, the EA deletes its pending orders and closes every position at market, and trades again the next day (or only when you clear it, with "Manual"). The next day starts from a fresh high, so it does not trip again at once.
  • Trading days and hours. Outside the window no new order is placed and pending orders are deleted; open positions stay managed. "Close all" at the end of the window closes them as well.

5The panel

▼

The panel shows numbers; only two buttons on it act on the EA (new in 2.20): START / PAUSE / RESUME and CLOSE ALL, described below. If the panel cannot be drawn, the EA carries on without it. It is one wide panel; A- and A+ in the header make it smaller or larger, and a click on the header folds it to its header and footer.

  • Header: the product name, the symbol and the version; the licence badge in the middle (LICENSED, TRIAL with the end date, CHECKING, NOT LICENSED, or STRATEGY TESTER); the status pill on the right (RUNNING, MARKET CLOSED, TARGET HIT, DD STOP, OFF SESSION, NOT STARTED, PAUSED, NOT LICENSED), with an extra ADDING chip while a stack is growing.
  • This month: the closed result of the month, in money and in percent of the balance at the start of the month, how many of the traded days closed in profit, and the lots and trades of the month.
  • Balance: the closed balance of this EA over the last week, month or 90 days (click WEEK, MONTH or 90 D).
  • Four tiles: TODAY (closed result and lots closed today), DD TODAY (the deepest floating loss of this EA's open positions today, in money and in percent of the balance at the start of the day), LOTS TOTAL (lots closed since the EA was first attached), MAX DD (the deepest day since then).
  • Close target: the net of the book after costs against the target that closes everything, and how many positions and lots the BUY and the SELL side hold.
  • Guards: day target, drawdown and trading days/hours against the limits you set. A guard that is off shows "off" or "no limit".
  • Calendar, MONTH: one box per trading day with four numbers: the closed result (loss days are red), DD = the deepest floating loss of this EA's open positions inside that day, LOT = the lots closed that day, and TRADES = how many positions were closed that day (new in 2.20). The WEEK column adds up the week: result, the deepest DD of one of its days, lots, trades. The arrows move month by month.
  • Calendar, YEAR: twelve boxes with each month's result, winning and losing days, one bar per trading day, the worst day and the lots. A click on a month opens it.
  • PAUSE / RESUME and CLOSE ALL (new in 2.20): two buttons in the title row of the calendar. is off and nobody has pressed it yet). The status pill says NOT STARTED. One click and the EA trades. their trailing stops and the close targets keep working. The button then reads RESUME and the status pill says PAUSED. RESUME lets the EA trade again. A pause survives a restart of the terminal; removing the EA from the chart forgets it. of this EA at market and deletes its pending orders; the EA then stays paused until you press RESUME. Waiting, or a click anywhere else on the panel, cancels. CLOSE ALL turns the floating loss of the open positions into a real loss.
    • START: shown instead of PAUSE while the EA has not been started (the input "Start trading when the EA is attached"
    • PAUSE: the EA deletes its pending orders and opens nothing new. Positions that are already open are still managed:
    • CLOSE ALL: the first click turns the button into CONFIRM ?. A second click within 4 seconds closes every position
    • The buttons never overrule a guard or the licence: RESUME does not restart trading that a guard has stopped.
    • They act on the next price tick, so nothing happens while the market is closed. A folded panel does not show them.
  • Footer: balance, equity, margin level, spread, server time; one sentence about what the EA is doing when there is something to say (a growing stack, a stop-out warning, which guard has stopped new orders); the standing risk reminder; and CONTACT US, which shows the support link.

How the two new numbers are counted.

  • LOT is the volume of the positions closed that day. A position opened and closed with 0.01 lot counts 0.01 (not 0.02).
  • DD of a day is the deepest floating loss of this EA's open positions (profit + swap) during that day, in your account's money; closed results never move it. It is the number to plan your capital with: on that day the account had to carry at least that much open loss. The percent of DD TODAY is against the balance at the day's first reading. It is measured on every tick while the panel is shown and kept in a small file, MQL5\Files\HGPL_<account>_<magic>_<symbol>_flt.csv. Deleting that file erases the drawdown history, not the results. (Up to 2.20 DD was the fall of closed + floating below the day's highest point, kept in ..._days.csv; that rule counted a close twice on the tick it happened and showed falls that never were. The old file is no longer read.)
  • MAX DD is the deepest day since the panel began measuring, in money; the percent beside it is that day's percent.
  • DD* (with a star) means the EA was started inside that day, so the number covers only the time it ran. - means that day was not measured: days before version 2.00 was installed show their lots but no drawdown, and so does a day on which the terminal was off.

The figures count this EA only (its magic number on this symbol), starting from the day it was first attached.

Trade arrows on the chart. MT5 can draw an arrow on the chart for every trade of the account ("Show trade history"). This EA closes thousands of positions a day, so those arrows pile up and the chart becomes slow. While the EA runs it keeps that chart option switched off; there is no input for it. Your trade history itself is untouched (tab History of the terminal). To see the arrows again, remove the EA first, then tick "Show trade history" in the chart's Properties (F8), tab Show. In a visual Strategy Tester run the tester draws its own arrows, which that option does not control: there the EA removes them every 4 hours of tester time, so you still see the latest trades.

6Licence

▼
  • A demo account needs no licence.
  • On a real account the first start gives a 3-day trial; the panel shows TRIAL with its end date. After that the account needs a licence: send your account number to support (https://m.me/forexreviewth). The licence belongs to the account number and works at any broker.
  • Without a licence the EA places no new order. Positions already open are still managed to the end.
  • The Strategy Tester does not check the licence.
  • What the licence check sends: your account number, your broker's company name, the product name and the trial length, over HTTPS to the three addresses above; like any web request, the server also sees the internet address it comes from. Your name, your password, your trades and your balance are not sent (version 1.00 also sent the account holder's name; 2.00 no longer does). Do not use the EA if you are not happy with that.

7Messages at start

▼

The EA refuses to start, with the reason in the Experts tab, when:

MessageWhat to do
this EA needs a HEDGING accountOpen a hedging account
the volume limits of the symbol are not available yetWait for the symbol's data and attach again
the money value of a price move of the symbol is not available yetThe terminal has no exchange rate for your account currency yet. Wait until it is connected and attach again
is quoted with too few digits for the distancesUse a gold symbol with 2 or 3 digits
an input is out of range (the message names it)Correct that input
the trade or guard setup failed (global variable name too long?)Use a shorter symbol name or ask support

Two lines at start are information, not errors: money inputs x <factor> for this account (your account is not in USD, see "Account money") and this broker's minimum stop distance is ... (see "Trailing stop").

Requests the broker refuses (market closed, stops level, too many requests) are logged at most once a minute and tried again shortly; the panel's status bar shows the last one.

8Strategy Tester

▼

Use "Every tick based on real ticks" and the broker's real spreads. A grid EA tested on bars only (open prices or 1-minute OHLC) gives results that are not realistic. The licence is not checked in the tester and the panel does nothing in a normal (non-visual) test.

9Support

▼

https://m.me/forexreviewth - ask before you change settings, and send your account number for a licence.