AB Universal Grid. Brief description of Input parameters.

AB Universal Grid. Brief description of Input parameters.

11 December 2025, 07:05
Aleksandr Blinov
0
129

The AB Universal Grid advisor allows you to implement most grid strategies. It's a great tool for those who actively use elements of grid strategies (such as averaging, martingale, and others) in their trading.

Download the demo version and explore AB Universal Grid in test mode.

MT5 version : https://www.mql5.com/en/market/product/145321
MT4 version : https://www.mql5.com/en/market/product/147482


Input parameters.

========== Expert settings

Watch the magic number

Select which magic numbers the advisor will see (drop-down list) :

  • 1) Only My   – UG sees orders and positions only with its own magic number
  • 2) All   – UG sees all orders and positions of the symbol on which it is placed
  • 3) My and Add magic number   – UG sees orders and positions with its own magic number and an additional magic number from another advisor. This should be entered below.
  • 4) My and Manual   – UG sees orders and positions with their magic number and manual ones

___ Magic number (My)
Magik advisor number (your own)
___ Add magic number
Additional magic number for option (3) (see above). Enter the magic number of another advisor here if you're using signals from another advisor.
Maximum spread for opening market orders, pips (0=off)
The advisor will not open a market trade if the spread is >= than this value.
Info Panel On/Off Info Panel

========== Trading strategy settings

Trading strategy

Built-in strategies for opening first positions   (drop-down list) :

  • 0) OFF - Disabled. The Expert Advisor will not open new initial positions. It will only open a "Grid" to complete existing positions. This mode can be used to pick up positions opened manually or by other Expert Advisors.
  • 1) Always on the market – If there are no BUY positions on the market, the EA will open the first position. The same applies to SELL positions.
  • 2) Gold mine - Signal based on the proprietary indicator for trading gold.
    Strategy Time Frame The time frame on which the search for an entry signal is carried out according to the selected strategy
    Opening of the first
    Select trading direction for the first position (drop-down list):
    • Buy and sell
    • only BUY
    • only SELL

      According to the chosen strategy, positions will be opened only in the chosen direction.
    Lot Mode
    Volume calculation mode   first   positions   (drop-down list) :
    • Fixed   – The first position will always be opened with a fixed lot (see the “___ First Lot” parameter)
    • Part of the free margin   – For every full “___ Part of the free margin” a “___ First Lot” will open
    ___ First Lot
    First position lot
    ___ Part of the free margin
    Free margin value for opening “ ___ First Lot
    Stop Loss, pips (0=off)
    Stop loss for the first position. Once set, it is not controlled by the EA until a second position is opened in the same direction. If set to 0, there is no stop loss.
    Take Profit, pips (0=off)
    Take profit for the first position. Once set, it is not controlled by the EA until a second position is opened in the same direction. If set to 0, there is no take profit.


    Risk Management

    Max Lot EA (0=off)
    The maximum lot the advisor will open in one trade
    Close all at Drawdown

    Close all during drawdown   (drop-down list) :

    • Off – Disabled.
    • in the deposit currency   – in the deposit currency. Below, enter the drawdown amount in the deposit currency at which the advisor will close all positions it sees (see the " Watch magic number " parameter).
    • in the percentage of the balance   – As a percentage of balance. Below, enter the drawdown value in % at which the advisor will close all positions it sees (see the " Watch magic number " parameter).
    ___ Drawdown Value The value for the selected mode.
    ___ Stop Trading after Drawdown On/Off . Stop trading after all positions are closed due to drawdown. To resume trading, you must restart the EA.
    Close all at Profit Close all at profit   (drop-down list) :
    • Off – Disabled.
    • in the deposit currency   – in the deposit currency. Below, enter the profit amount in the deposit currency at which the advisor will close all positions it sees (see the " Watch magic number " parameter).
    • in the percentage of the balance   – As a percentage of balance. Below, enter the profit value in % at which the advisor will close all positions it sees (see the " Watch magic number " parameter).
    ___ Profit Value The value for the selected mode.
    ___ Stop Trading after Profit On/Off . Stop trading after all positions are closed with a profit. To restart trading, you must restart the EA.


    ========== Market Position Management

    Trailing stop (TS) Trailing Stop Mode (drop-down list)
    • Off - Disabled.
    • 1) Simple - Simple Trailing Stop from the breakeven point for each direction
    • 2) Compensatory - Only profitable orders and the farthest losing order from their breakeven point are trailed. Allows you to unload your deposit faster. Most effective with aggressive martingale.
    ___ Distance TS, pips Distance in points from the current price for trailing stop
    ___ Start TS, pips
    You can add a starting distance   Trailing stop . In this case, the trailing stop starts not from the breakeven point, but when it reaches the specified value. It's calculated using the formula:
    TS activation distance = Distance TS, pips + Start TS, pips . For the " 2) Compensatory " mode, this only works if there is 1 position in the market.
    ___ Step TS, pips Set the step for trailing stop.
    ===== Breakeven (BE) On/Off. Setting the breakeven point, taking swaps and commissions into account.
    ___ Distance for transfer to BE, pips Distance in points for setting the breakeven point
    ___ Add pips to BE Add a few points to your breakeven if you want to take a small profit and avoid minor slippage.


    Grid settings

    On/Off the settings block "Grid settings" Off   = functions in this settings block are ignored.
    Grid New orders/positions
    On/Off . Disable grid generation. New grid positions will not open. This setting does not affect the opening of the first position for " Trading Strategy ."
    Grid Ban Max number Orders/Positions (0=off)
    Prohibition of opening new grid positions if the specified number of positions in a given direction has been reached.
    Grid Ban Max volume Orders/Positions (0=off)
    Prohibition of opening new grid positions if the specified volume has been reached in a given direction.
    Grid: Next Step Select the next step (drop-down list):
    1) Only for step settings - Only for step settings. The grid step calculation settings located below are used.
    2) Only for strategy - Only for the selected strategy. See the Trading strategy parameter in the "Trading strategy settings" block. Entry occurs with a market order when a new signal from the selected strategy is received. To open a buy position, the price must be lower than the last already opened buy position and no closer than the minimum grid step (see the parameter Min Step ). For the sell position, it's the opposite.
    3) Strategy + step settings - Both options are used, whichever comes first.
    Grid STEP mode

    Grid step calculation mode   (drop-down list) :

    • 1) Fixed   – Fixed pitch
    • 2) First step +/- (Add pips*Number of open orders)   – The next order step is calculated using the specified formula.
    • 3) First step * (Ratio step*Number of open orders) – The step of the next order is calculated using the specified formula.
    • 4) ATR * Ratio step   – The next order step is calculated using the specified formula. For ATR settings, see the =========== Indicators section.
    ___ First Step, pips
    Initial grid step
    ___ Add pips for (2)
    Additional pips for grid mode 2. If you enter a negative value, the next step will decrease, and if you enter a positive value, it will increase.
    ___ Ritio for (3) and (4)
    Coefficient for grid modes 3 and 4. For this type of calculation, if you enter a value < 1, the next step will decrease, and if > 1, it will increase.
    ___ Min Step, pips (0=off)
    Minimum allowed grid step for the advisor.
    ___ Max Step, pips (0=off)
    The maximum allowed grid step for the advisor.
    ===== Grid LOT Mode
    Lot calculation mode   (drop-down list) :
    • 1) Fixed (First Lot)   – Fixed Lot. All orders and positions will be opened based on the value in the " First Lot " parameter.
    • 2) Last lot +/- Add Lot   – The next lot will be calculated according to the specified formula: the last opened lot in this direction +\- Add Lot for (arithmetic progression)
    • 3) Last Lot * Ratio lot   – The next lot will be calculated using the following formula: the last opened lot in a given direction * the lot ratio (geometric progression). This does not depend on the number of positions.
    • 4) Total volume of positions * Ratio lot   – The next lot will be calculated using the formula: Sum of lots of positions in this direction * Lot Ratio . I recommend setting the lot ratio to <1.
    ___ Add Lot for (2)
    Additional lot for lot 2 calculation mode. Can be +\-
    ___ Ratio lot for (3) and (4)
    Lot coefficient for lot calculation modes 3 and 4.
    =====Order TYPE for opening the grid Select the order type to open the next position from the drop-down list:
    • Market - The advisor will open the next grid order at the market price.
    • Limit - A pending order of the Limit type will be placed for the next grid order.
    • Stop - A Stop order will be placed for the next grid order when the price moves the Set distance for "Stop" in pips from the entry point. This ensures that it will be opened if the price reverses. In this mode, the order will also trail the price by the Set trailing distance for "Stop" in pips if the price doesn't reverse. This allows you to improve your entry point!
    ___ Set distance for "Stop", pips Select the distance from the current price to place a Stop order.
    ___ Set trailing distance for "Stop", pips Select the trailing distance for a Stop order.
    Grid Stop Loss Mode
    Stop Loss Calculation Mode for Grid   (drop-down list) :
    • Off   – Stop loss for the grid is disabled. If there are positions with a stop loss, it is removed.
    • Pips from the furthest position   – From the farthest position. For BUY from the lowest, for SELL from the highest
    ___ Stop Loss, pips
    Stop Loss value in pips
    Grid Take Profit Mode
    Take Profit Calculation Mode for the Grid   (drop-down list) :
    • Off   – Take profit is disabled for the grid. If there are positions with take profit, it is removed.
    • Pips from the closest position   – From the closest position. For BUY, from the highest one; for SELL, from the lowest one.
    • Pips from Breakeven   – from the breakeven level taking into account swaps and commissions.
    ___ Take Profit, pips
    Take profit value in pips.
    Pause before opening the next order, min The pause in minutes between opening a new order or position. Calculated separately for buy and sell orders. Starts from the time the last position was opened.
    Close Grid the profit, account currency (0=off) Closing all grid orders in one direction when profit is reached


    ========== Accumulative Buffer (AB)

    ===== Accumulative Buffer
    On/Off
    Choosing a direction to close unprofitable positions
    Selecting the direction for closing unprofitable positions (drop-down list):
    • Buy - buy positions will be closed using the cumulative buffer if their total volume has reached the Threshold to activate AB value.
    • Sell - sell positions will be closed using the cumulative buffer if their total volume has reached the Threshold to activate AB value.
    • Auto - positions in the direction where the total volume has reached the Threshold to activate AB value and the total volume is greater than the opposite volume will be closed using the cumulative buffer.
    Threshold to activate AB
    The activation threshold for the accumulative buffer when the Accumulative Buffer parameter is set to On . If the threshold is not reached, the buffer is disabled.
    Use AB profit for the days Use the specified number of days to calculate AB profit
    Percent use AB A percentage of accumulated profit that will be used to close losing positions. If you'd like to keep a percentage for yourself.
    Lot calculation mode for closing a losing position Lot calculation mode for closing a losing position (drop-down list):
    • Percent of the total volume of the direction - The percentage of the total volume of the losing direction. For example, the buy direction grid is losing money, its total volume is 0.5 lots. If the ___ Value for Lot Calculation Mode parameter is set to 10, then we will close 0.5 * 10/100 = 0.05 lots, or the entire position if its lot size is smaller.
    • Fixed lot - Will close the lot specified in the ___ Value parameter for Lot calculation mode or the entire position if its lot is less.
    ___ Value for Lot calculation mode Value for Lot calculation mode for closing a losing position

    ========== Visualization

    Drawing the Next level Opening
    Show the opening levels of the next order on the chart
    Drawing Breakeven levels
    Show breakeven levels on the chart. Buy direction - blue, Sell direction - orange, overall breakeven for both directions (if possible) - pink.

    ========== Indicators

    --- ATR ---

    Indicator name
    ATR Time Frame The time frame from which the ATR value is taken
    ATR Period
    ATR Period


    Download the demo version and explore AB Universal Grid in the tester

    MT5 version : https://www.mql5.com/en/market/product/145321
    MT4 version : https://www.mql5.com/en/market/product/147482