Hedging Grid Pump Lot - User Manual

30 November 2026, 23:44
Mr Adisorn Mayang
0
8

User manual of Hedging Grid Pump Lot for MetaTrader 5, version 1.0.

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 drawdown stop is ON by default at 50 %; the day target and the trading days and hours are OFF until you switch them on. 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 the author before you change any setting: private message on MQL5.
  • 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.

1. What you need

  1. MetaTrader 5 and a hedging account (recommended; the EA was designed for it). On a netting account the EA trades one side at a time, because opposite positions are not possible there, and the results differ from a hedging account.
  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).

2. Install

  1. Install the product from the Market section of your MetaTrader 5 terminal (log in with your MQL5 account). It then appears in the Navigator under Expert Advisors > Market.
  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 (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.

3. Inputs (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

Input Default What it does
Start trading when the EA is attached (off = press START on the panel) false Off: 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. 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 on OnTick (every tick) OnTick: the EA checks prices and moves its orders on every new price. 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.5 How often the EA works when "Run engine on" is OnTimer. Ignored on OnTick

Sides and lot

Input Default What it does
Trade the BUY side true Switch a side off. A side that is off places no new order; what it already has stays managed
Trade the SELL side true Same for the SELL side
Lot of the first order 0.01 Lot of the first order of a side
Lot growth per position of a side 1.2 Each new position of a side is this many times larger than the last. 1.0 = no growth
Extra lot added per position 0.0 A fixed extra lot added for every position the side already has
Lot rounding digits 2 Decimals the lot is rounded to before the broker's volume step is applied

Grid (points)

Input Default What it does
Stop distance when the side has no position 50 How far from the market the first order of a side is placed
Stop distance, first set of positions 80 Distance for the next orders while the side is in its first set
Extra gap before the next order, first set 80 How 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) 5 How many positions belong to the first set
Stop distance, deep set 30 Distance for the orders of a deep stack
Extra gap before the next order, deep set 80 The same gap rule for a deep stack
A pending stop moves only when off target by more than this 5 Smaller changes are ignored, which keeps the number of requests down
Follow-up stop after a fill (approximate) false Optional 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) 0 Stops a side from adding while it is losing more than this amount. 0 = no limit

Exit (account currency)

Input Default What it does
Net of the whole book that closes everything (above 0) 2.0 When both sides together are this much in profit after costs, everything is closed
Net loss of the whole book that closes everything (0 = off) 0 A 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) 0 Switches to the side targets below once a side floats this deep. 0 = off
Net of one side that closes that side (side targets) 30.0 Used only with the setting above
Basket target grows with the first order's lot (x lot / 0.01) false On: 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 book false On: 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 open 1.0 Example: 0.07 lot open on both sides together = 7 x 1.0 = 7.0
Highest basket target when it grows (0 = no limit) 100.0 A 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)

Input Default What it does
Stop distance behind the price 5 How far behind the price the trailing stop is kept
Move the stop only when it improves by more than this 0 Ignores smaller improvements
The average must lie this far inside the stop 10 The 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

Input Default What it does
Commission per lot, open + close together, used only when the broker reports none 7.0 What 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 targets false Off: 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

Input Default What it does
Money inputs are written for a USD account: convert them for this account true On: 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)

Input Default What it does
Day target in account currency (0 = off) 0 Reached for the day: no new orders until the next server day
Day target counts Closed deals only Or closed deals + the floating result of the open book
After the day target Keep managing the open book Or close all and stop

Drawdown stop (on by default: 50 %)

Input Default What it does
Drawdown limit of this EA (0 = off) 50 Limit on this EA's own equity below its highest value. Other EAs and deposits do not count
Drawdown unit Percent Or account currency
Drawdown counted from Since start Or since the start of the server day
Trading resumes (Market default: stays stopped) Manual (ClearStop) Manual: the stop stays until you use the input below. Or next day
Clear a manual stop at start (set back to false after) false Clears a manual drawdown stop once when the EA starts. Set it back to false afterwards

Trading days and hours (off by default)

Input Default What it does
Trade only in the window below false Off = all days, all hours
Monday ... Sunday Mon-Fri on Days the EA may place new orders
Window start, hour (0-23) / minute 8 / 0 Start of the window
Window end, hour (0-24, end not included) / minute 20 / 0 End of the window. A start later than the end is a window over midnight; 00:00-24:00 is all day
Window time Server time Or GMT, or New York time
At the end of the window Keep managing the open book Or close all

Server load (off by default)

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 nothing changes.

Input Default What it does
Move a pending stop on the server only when the price comes near it false On: 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) 50 How 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) 0 500 = 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 stops false On: 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 the number with the options off, 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

Input Default What it does
Panel at start Open Open 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 orders 618024 Marks this EA's orders and positions. Change it only when another EA on the account uses the same number
Order comment HGPL Text on the orders

4. The three guards

The drawdown stop is on by default (50 %, manual resume); the other two are off. 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: 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. With "Manual" (the default) it stays stopped until you clear it: set "Clear a manual stop at start" to true once. With "Next day" it trades again the next day. 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.

Safety checks that are always on:

  • A pending order is not placed when the free margin cannot cover it.
  • No order is sent while the symbol's trading session is closed.
  • Orders inside the broker's freeze level are not modified or closed.

5. The panel

The panel shows numbers; only two buttons on it act on the EA: 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; a badge in the middle; the status pill on the right (RUNNING, MARKET CLOSED, TARGET HIT, DD STOP, OFF SESSION, NOT STARTED, PAUSED), 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. 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.
  • START / PAUSE / RESUME and CLOSE ALL: two buttons in the title row of the calendar.
    • START: shown instead of PAUSE while the EA has not been started (the input "Start trading when the EA is attached" is off and nobody has pressed it yet). The status pill says NOT STARTED. One click and the EA trades.
    • PAUSE: the EA deletes its pending orders and opens nothing new. Positions that are already open are still managed: 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.
    • CLOSE ALL: the first click turns the button into CONFIRM ?. A second click within 4 seconds closes every position 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.
    • The buttons never overrule a guard: 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); and the standing risk reminder.

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.
  • 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, for example 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.

6. Messages at start

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

Message What to do
the volume limits of the symbol are not available yet Wait for the symbol's data and attach again
the money value of a price move of the symbol is not available yet The 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 distances Use 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 the author

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.

7. Strategy 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 panel does nothing in a normal (non-visual) test.

8. Support

Questions about the settings: send me a private message on MQL5 or write in the Comments tab of the product page. Ask before you change the settings.