Alpha Grid MT5:   Virtual GRID (Details)

Alpha Grid MT5: Virtual GRID (Details)

3 December 2026, 11:27
Aliaksandr Charkes
0
8

VIRTUAL_GRID in Detail: Mechanics, Slippage, Scalping, and FAQ

This section covers the nuances essential to understand when configuring the virtual grid on live accounts.




1. How the slippage reaction corridor works (
Reaction EA slippage)

If Reaction EA slippage in points for opening (0 - crossing only) is set to a value greater than 0 (e.g., 10 points for buy level 1.10000):

  • Instant entry on exact hit. If at the moment of EA launch or grid recalculation the current market price is sitting exactly at the calculated level price (1.10000), the deal opens immediately (provided spread, margin, and stop distances are normal).

  • Corridor construction in the direction of movement. When price approaches the level from either side, the EA builds a working zone in the direction of price movement:

    • approaching from below (from 1.09950) — corridor upwards: 1.10000 .. 1.10010;

    • approaching from above (from 1.10050) — corridor downwards: 1.09990 .. 1.10000.

  • Waiting for normal spread. If the price enters the corridor but spread exceeds Max spread at that moment, the EA skips the entry without errors. If the spread narrows while price is still inside the corridor, the deal opens immediately.

  • Protection against sharp spikes (corridor flip). If price jumps in a single tick from 1.09950 to 1.10050 during news (skipping past the 1.10010 boundary):

    • the EA does not buy at an inflated price;

    • the corridor flips to the opposite side of the level ( 1.09990 .. 1.10000);

    • the deal will only open when price pulls back to 1.10000 (or better). This also prevents adjacent levels from "clustering" and opening all at once during a single spike.

At a value of 0 (crossing only), the spike depth is not filtered: on an exact starting hit, the deal opens immediately; when approaching from the side, it opens on the very first crossing of the level.




2. How initial prices are generated in auto mode (
PRICE_INITIAL_AUTO)

The behavior of initial price auto-generation (when PRICE_INITIAL_AUTO is selected and both Manual Initial Price and Distance from Ask/Bid are 0) depends on which trading directions are enabled:

  • One-way trading (only BUY or only SELL in VIRTUAL_GRID):
    The broker does not allow standard pending orders to sit right at the current price due to minimum stop distances, so in STANDART_TRADING the EA offsets by 20–40 points from the market. In VIRTUAL_GRID this restriction does not exist: with a one-way start, the initial price is set directly at the current Ask (for buys) or Bid (for sells) — the first level opens immediately at market. If a lower grid is connected alongside the upper grid via BuyDownPIN_under_STEP_of_BuyUpPIN or SellDownPIN_under_STEP_of_SellUpPIN, it is placed exactly one step below the starting price.

  • Two-way trading (BUY and SELL simultaneously, e.g., all 4 grids):
    Here the EA deliberately maintains a symmetric half-step shift around the midpoint of the spread. If both BUY and SELL were placed directly at the current market price with all 4 grids enabled, the EA would open an immediate opposite hedge (lock) in the very first second with a double spread loss and almost identical level prices on both sides. A half-step stagger ensures a neutral start without directional bias.

  • Custom starting point at any time:
    If you need to shift the grid or enter both sides from a specific price, you can always switch to PRICE_INITIAL_MANUAL or set your custom offset (+ or - in points) in the Distance from Ask/Bid for Initial Price in AUTO mode field.




3. Stop-Loss / Take-Profit policy and scalping behavior

In both modes (VIRTUAL_GRID and STANDART_TRADING), Take-Profit and Stop-Loss levels are always calculated from the theoretical price of the grid level, rather than the actual execution price of the deal:

  • with positive slippage (BUY filled cheaper or SELL filled higher than the level), the planned Take-Profit yields more profit than the calculated target;

  • with negative slippage, the actual distance to Take-Profit shrinks, while the distance to Stop-Loss widens.

What happens during scalping (tight TP/SL and high slippage)

  • In VIRTUAL_GRID:

    • Before sending an order, the EA verifies whether the calculated TP/SL have already been violated and checks minimum broker distance — an invalid order is not sent.

    • If the price overshoots TP/SL while the order is in transit to the server (on Market Execution), with Take-Profits CONTROL = true and Stop-Losses CONTROL = true enabled, the built-in grid control immediately detects the violation and forcibly closes the position at market, not leaving it without stops. (Disabling stop control on Market Execution when scalping is strongly discouraged.)

  • In STANDART_TRADING:

    • TP and SL are attached to the pending order on the server in advance. If strong slippage overshoots the TP/SL boundary, the broker's server either cancels order activation or opens the position and immediately closes it at the reached stop level (with negative slippage larger than TP, an instant loss equal to the difference and spread is possible).

  • Important for scalpers: do not set TP and SL smaller than your broker's typical floating spread and market noise (10–25 five-digit points can easily slip on news); for VIRTUAL_GRID, always use a low-ping VPS and a non-zero Max spread filter.




4. Frequently Asked Questions (FAQ)

1. Why did a position in VIRTUAL_GRID open 2–4 points (or even 15–25 points on an impulse) away from the level, even though Reaction EA slippage = 10 and Server slippage = 10 are set?
Two market factors combine here:

  • Tick step within the corridor: on 5-digit quotes, even in a calm market, a single tick often jumps by 2–5 points at once. As long as the price is inside the Reaction EA slippage corridor, the deal opens normally on the current tick. If desired, the corridor can be narrowed to 1–3 points (then larger jumps will wait for a pullback to the level).

  • Market Execution at the broker and network ping: when the terminal sends a market order (market buy / market sell), the request travels over the network to the broker's server (50–200 ms or more). During fast moves, the price on the server shifts within those milliseconds. Under Market Execution rules, the server always executes the trade at the server's current market price and ignores Server slippage in points for open positions (this parameter works only on Instant Execution accounts).

  • How to reduce this slippage: place the terminal on a VPS close to the broker's server (1–5 ms ping instead of 100–200 ms) or use STANDART_TRADING with pending orders located directly on the server.

2. Do real pending orders slip in STANDART_TRADING?
During normal movement without gaps — they typically slip less because they already reside on the server and require no network transit time. However, stop orders (BuyStop/SellStop) on Market Execution / Exchange accounts and during gaps also become market orders upon execution on the server and can experience slippage (and limit orders on some forex Market Execution accounts are also routed at the nearest available price during sharp moves).

3. Why doesn't the EA update the calculated initial grid price to the actual fill price at the broker after opening the first trade with slippage?
The initial price is defined before the first order is sent — from it, the entire coordinate grid and unique digital tags (Magic) are built, by which the EA recognizes each of its positions (the tag of an already opened position cannot be changed in MetaTrader 5). If the EA shifted the initial price to the actual fill price after server slippage, the first position would immediately cease to be recognized as a grid level, and a duplicate position would immediately open at the newly shifted coordinate.

4. If a deal opened away from the level line, will a duplicate order or second position appear at that level?
No. The EA recognizes level occupancy by its calculated digital tag, not by the actual execution price in the terminal. Even with significant slippage, the level remains marked as occupied, and a duplicate is impossible.

5. What happens if spread exceeds Max spread on the very first start?
The initial price is locked immediately upon launch, and the entry for the first level waits until spread returns to normal (while price remains at the level or inside the corridor) or until price returns to the level under a normal spread.

6. What happens when the terminal is turned off?
When the terminal is turned off: new virtual levels are not opened, but opened positions will continue to work with server-side TP and SL. After turning the terminal back on, the EA will resume trading from the current state in full.

7. What happens if a position is closed manually exactly at the level?
When closing a position manually right at the level price: if Restore ... = true is enabled and the price remains exactly at that level on the next tick, the EA will restore the position according to the grid rules. If restoration is not desired, use the single-use level mode (Restore = false).