Alpha Grid MT5:   Automatic shift of initial prices following market levels

Alpha Grid MT5: Automatic shift of initial prices following market levels

10 March 2024, 07:11
Aliaksandr Charkes
2
240

<<   Back to the General Section with a description of the settings

Settings:  TYPE OF TRADING  [ INITIAL_PRICE_BINDING_to_MARKET ]

For each grid, in the settings you can set a range for binding the initial grid price to current market levels. That is, as soon as the market price moves away from the initial price by a given distance, and this distance will accommodate an entire grid step (or several steps), the initial price will automatically move as close as possible to the current market price. At the same time, if there is no existing pending order or market position at the new location, the advisor will place a new pending order. To make it easier to understand how this works in practice, below are several video examples.

The entire grid will be rebuilt following the initial price - unnecessary pending orders will be deleted, and grid market positions that fall out of it will be considered obsolete. It is important to take into account that in this case the grid will work correctly only if no coefficients are used in the settings (since all settings of grid orders depend on the initial price, and it is the initial price that will change in this mode). If you plan to use coefficients, it is better to use phantom mode.

Also, using this functionality, you can implement some non-grid strategies. For example, if you specify only 1 grid order in the settings, then when moving the original price, the advisor will place a new pending order each time and delete the old one (except for market positions). This is exactly how, for example, you can organize a trailing stop of a single pending order (by grid steps) until it turns into a market position.

Explanation of the general concept of settings
The initial price of the BUY grid is tied to the Ask value (the selling price of the base currency of the instrument)
The initial price of the SELL type grid is tied to the Bid value (the purchase price of the base currency of the instrument)

To control the initial prices of BUY type grids, the AskUP Binding Range and AskDOWN Binding Range settings are used

To control the initial prices of SELL type grids, use the BidUP Binding Range and BidDOWN Binding Range settings

These settings control specified binding ranges, dividing the control zone:
UP type settings control the range when the market price is ABOVE the current initial grid price
DOWN type settings control the range when the market price is BELOW the current initial grid price

That is, you can set different binding ranges for moments when the current market price is above or below, relative to the current reference price. At the same time(!) in these settings there are additional subsettings that allow you to clearly determine what type the new initial price should be and this may be important when implementing any strategies related directly to the trend.

Value > 0 means that a new pending order with a new initial price can only be of the STOP type
Value < 0 means that a new pending order with a new initial price can only be of the LIMIT type
Different-signed values for the same grid type are prohibited (to avoid confusion)

If the value for any of these settings is 0, it means that range tracking is OFF for that situation.

Settings logic

When using the [ INITIAL_PRICE_BINDING_to_MARKET ] mode, consider at least the following parameters:

1. Initial price setting mode

2. Value for the upper binding range (when market price > initial price)

3. Value for the upper binding range (when market price < initial price)

4. Grid step size (important for calculating the required distance for the appearance of a new pending order from the current market price)

Analysis of the setup logic using the BUY grid as an example:

The initial price is tied to the current market price Ask and remains in place as long as it remains at a given distance from it. Once the market price moves outside of this range, the initial price automatically moves back as close to the market price as possible. In this case, this movement will be performed only in full grid steps. That is, if the distance to the market grid is 2.5 steps, the initial price will move only 2 steps and half a step will remain to the current Ask value. Moreover, if the binding ranges are indicated by positive values, new pending orders at the initial price location (if there is no market position there) will only be BuySTOP orders.

Highlighting binding ranges

To improve trading control in this mode, special graphical support has been developed, which greatly facilitates the selection of the correct settings that correspond to the intended goals. At the same time, this graphic is optional, and can be turned on and off at will at any time (in the general information panel).

The following options are available: There is a shaded area - this is the range itself, if you go beyond it, a signal is given to move the initial price. And there are lines that indicate the nearest levels where this movement will occur. The lines also have tooltips to make it even easier to navigate the situation.

The solid line indicates where the initial price will shift once the market price moves outside the shaded range

The broken line indicates where the initial price will shift if the market price moves beyond the line itself (due to the type of order selected)

To avoid confusion, the binding range highlight is automatically turned on if this mode is selected for only one grid. You can see how this looks in practice in the video:



Additional Information

  • For binding mode to work fully for a selected grid, auto-restore of orders must be enabled in its settings. This setting is optional, but without it new orders will not be placed at any levels.

  • When starting this type of trading, it is important to consider that, depending on the settings, a shift (by the required number of steps) may occur immediately after the start of trading and you may not have time to understand why the new price does not correspond to your forecast! For example, in the settings you will set only BuySTOP orders, and set the initial price (or it will be generated in some auto mode) under the current market Ask level. In this case, immediately when you start trading, the initial price will move up the required number of steps so that the pending order type is exactly BuySTOP.

  • This mode should not be used blindly on a real account. It's best to understand how this all really works (and before acquiring the necessary skills) to first practice in the visual mode of the strategy tester. It's perfect for this workout. The graphical capabilities of the advisor's binding mode allow you to select the desired settings even by simply searching through. At the same time, it should be taken into account that pressing buttons in the tester does not work.

Video examples:

Four grids in BINDING mode at the same time


Trailing-stop of one BuyStop pending order