Description of GRID settings

Description of GRID settings

15 May 2023, 21:46
Aliaksandr Charkes
0
878

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

General information about GRID settings

(this section may be progressively refined)
It describes all the settings related to the grid configurations that my Expert Advisors are able to create and control.
To get quicker information on the desired setting, you can use the page search function. This is normally accessed by pressing F3 or Ctrl+F 

It should be taken into account that the names of settings and some concepts may change over time (as the project develops).

Each EA can create and maintain 4 types of grids (simultaneously or individually).

Each of these grids can consist of one or more price levels, spaced at a given step from the initial price. 

Each price level can include either 1 pending order or 1 market position with its own Take-Profit and/or Stop-Loss.

Initially pending orders are placed, but the EA continues to monitor them as market positions as well. 

At the moment(!) none of my grid EAs, in any situation, open real market positions by themselves!



The types of grids supported:

  •  BuyUP       -  price levels for BUY orders and positions set UP from the initial price 
  •  BuyDOWN  -  price levels for BUY orders and positions set DOWN from the initial price  
  •  SellUP       -  price levels for SELL orders and positions set UP from the initial price  
  •  SellDOWN  -  price levels for SELL orders and positions set DOWN from the initial price  

Price levels (in this concept) are the prices on the chart where orders or positions of the EA can be located. Initially, these are pending orders, but after they are touched by the market price, the orders turn into market positions. After closing positions at these price levels, pending orders appear again (if so specified in the settings).




In fact, the basic strategy can be considered as automatic reopening of pending orders, after closing their market positions (by take profit, stop loss or manually). However, the more functional an EA is, the more actions it can perform additionally.

A grid of pending orders has the advantage over the virtual orders, because the pending orders can open market positions as quickly as possible and can do so even when the terminal is off. In this case, when the terminal is turned on, the Expert Advisor quickly regains control of the situation, giving a report on the events that have occurred. 

The broker's limit on the number of pending orders can be bypassed in semi-automatic mode (for Expert Advisors above the Magic Grid level). To do this, you need to manually change the initial price, observing the specified step, and in fact, this method implements the ability to move the entire grid following the market price at any time convenient for you.

For example, if the initial price is 1.2525 and the step is 25 points, then you can set a new price of 1.2550 and then 1 order will be added from above and 1 order (if it is a pending order) will be deleted from below. If the original price is moved up by 10 steps, the entire grid will move up by these 10 steps and the lower pending orders will be automatically deleted. At the same time, separate statistics will be maintained for market positions, which in this case will already be outside the grid, and separate management will become available.

General additional information: 

For all versions of EAs above the Magic Grid level, an overall report is generated after changing any settings.

Current GRID Settings

Below are descriptions of the settings for BUY grid only 
For SELL grid the settings are similar
>>    Initial price for BUY orders  (common setting for BuyUp and BuyDOWN grids) 

 General description: Initial price (reacting to market Ask) to create a grid with BUY orders    

For a grid with SELL orders, the initial price will be the price reacting to the market Bid  


Common features for all advisers:

Pending orders are placed in set increments from the initial price and can be entered manually or generated automatically (once at the start of the trade).

If the value is 0, the initial price will be selected automatically (one time). In this case, this price will be considered as the starting price until the trade is completed or another value is manually set. The automatic selection is based on the minimum tolerance values (from the current market prices) for pending orders (at the start of the trade) + some additional corrections that may change from version to version.

In this case, if at the same time as the automatic setting you set any custom indent in another setting (Distance from Ask for Initial Price in auto mode), the mechanism of automatic generation of initial prices (by default) will be disabled..

Note: Changing the starting price after you start trading will rebuild the entire grid. For the Magic Grid, orders and positions which have become out of grid will not be deleted, only new ones will be added. Outdated pending orders will be deleted for all other EAs, and separate accounting and separate management will be available for obsolete market positions. 

After the first start, the Expert Advisor will generate a separate report on the success of the operations performed.

>>    Distance from Ask for Initial Price in auto mode  ( +  or  - )  common setting for BuyUp and BuyDOWN grids

This setting is only available for Expert Advisors starting from the Elastic Grid level (inclusive).

General description: Offset for the initial price from the Ask market value at the moment of unfolding the grid with BUY orders in automatic mode (if Initial price for BUY orders = 0). If the initial price generation mode is NOT automatic or Distance = 0, this setting is ignored. After the grid is deployed (when the initial price is already fixed), changes to this setting also do not affect anything.

The value is expressed in points. You can set both positive and negative values. This can be useful when you need to quickly or automatically deploy the grid at some distance from the current market prices (for example, when trading on the news or in any other situations). At the same time, if the Expert Advisor is used simultaneously on several charts of ONE currency instrument, on each chart you can deploy only one grid of the chosen type, and set its own initial price with an indent for it (for this you need to use different magic numbers for each chart).

Note: If this setting is set to at least some value other than zero, the automatic generation of initial prices described in the <Initial price for BUY orders> setting is completely disabled.

For a grid with SELL-type orders, a similar setting will be < Distance from Bid for Initial Price in auto mode >, where the distance is measured from the Bid value (at the time of grid deployment).

>>   AskUP Range for linking Initial price to Ask (if Ask > Initial)
>>   AskDOWN Range for linking Initial price to Ask (Ask < Initial)
>>   BidUP Range for linking Initial price to Bid (if Bid > Initial)
>>   BidDOWN Range for linking Initial price to Bid (Bid < Initial)

These settings are intended to enable and control a mode in which only 4 pending orders may be sufficient to fully support all types of EAs trading grids (of any size). And also to implement some additional strategies not related to grid trading.

Details here:  https://www.mql5.com/en/blogs/post/754560

Available only for Master Grid MT5

>>   Quantity of BuyUP price levels from Initial Price  (separate setting for BuyUP grid)
Number of BUY price levels to be placed UP from initial price (can be 0)

>>   Quantity of BuyDOWN price levels from Initial Price  (separate setting for BuyDOWN grid)
Number of BUY price levels to be placed DOWN from initial price (can be 0)

    General description (for settings Quantity of BuyUP price levels and Quantity of BuyDOWN price levels):

    Above the current market Ask price pending orders of BuyStop type are placed
    Under the current market Ask price pending orders of BuyLimit type are placed

    The concept of order placement for SELL grids:
    Above the current market Bid price pending orders of SellLimit type are placed
    Under the current market Bid price pending orders of SellStop type are placed

    Common features of these settings: 

    If when placing a pending order its location is too close to the current market price (falls within the broker's freeze range), the order will NOT be placed immediately. The Expert Advisor will display a warning about this situation and will only place this order when the market price moves out of the freezing range. This will happen automatically, and once all orders have been placed, the Expert Advisor will generate a report about it.

    The location of already placed pending orders can be changed manually (by simply dragging and dropping them on the chart, or by editing their properties). The Expert Advisor will not try to move the pending order back or replace it with a new one (at a given price level) and will retain all other control over it.  This can be used to make any tactical changes to the chosen strategy and actually set up a grid of any configuration, but the new orders will be placed according to the current settings.

    Additional information: If the value for UP orders is greater than zero, then the countdown for DOWN orders will only start from the second price level. This is done to make sure that the total value of all the set orders is equal to their real number. Otherwise the initial order for both grids (up and down) will be considered common, and the total amount of orders will be lower than the stated amount. If the value for an up order is equal to zero, then the countdown for an order down will start from the initial price, as it should be.

    Table of differences between different EAs: 
    (for Quantity of BuyUP price levels and Quantity of BuyDOWN price levels)

    Magic Grid MT4
    Magic Grid MT5
    Editing options after unfolding the grid:

    Only an increase. Pending orders and EA market positions that no longer correspond to the current settings are completely ignored (not deleted or edited).
    User Grid MT4
    Elastic Grid MT4

    User Grid MT5
    Elastic Grid MT5
    Master Grid MT5
    Editing options after unfolding the grid:

    Increase and decrease are available. Pending orders of the adviser that no longer correspond to the current settings are deleted automatically.

    Market positions of the EA that do not meet the current settings are NOT automatically deleted, but separate statistics are kept for them. You can also enable separate management with mass editing of their properties or use a separate button for their mass deletion. See the description of the relevant settings section (Settings for Old-Grid).
      >>   Grid Step for BUY orders   (common setting for BuyUp and BuyDOWN grids) 

      General description: Grid step between orders of BUY type for the current grid (calculated in points for the selected instrument)
      For the grid with SELL orders, the step is selected in exactly the same way

      The location of already placed pending orders can be changed manually (by simply dragging and dropping them on the chart, or by editing their properties). The Expert Advisor will not try to move the pending order back or replace it with a new one (at a given price level) and will retain all other control over it.  This can be used to make any tactical changes to the chosen strategy and actually set up a grid of any configuration, but the new orders will be placed according to the current settings.

      Table of differences between different EAs for this setting:

      Magic Grid MT4
      Magic Grid MT5
      Editing options after unfolding the grid:

      Only new orders are placed. Pending orders and market positions that no longer correspond to the current settings are NOT deleted!
      User Grid MT4
      Elastic Grid MT4

      User Grid MT5
      Elastic Grid MT5
      Master Grid MT5
      Editing options after unfolding the grid:

      New orders are placed automatically. The EA pending orders, which no longer correspond to the current settings, are also automatically deleted. 
      Market positions of the Expert Advisor that do not meet the current settings are NOT automatically deleted, but separate statistics are kept on them. It's also possible to enable separate management with mass editing of their properties or use the separate button for mass deletion. See the description of the relevant settings section (Settings for Old-Grid).
      >>   Take-Profit for each BUY order   (common setting for BuyUp and BuyDOWN grids) 

      General description: Take-Profit value for each pending order or BUY position (can be zero, calculated in points)
      For the grid with SELL orders and positions, Take-Profit is set in the same way

      Table of differences between different EAs for this setting:

      Magic Grid MT4
      Magic Grid MT5
      Editing options after unfolding the grid:

      The specified Take-Profit value is only set for new orders. It is possible to modify TP for each individual order or position manually, but there is no possibility of mass modification for already placed orders and positions!  
      User Grid MT4
      Elastic Grid MT4

      User Grid MT5
      Elastic Grid MT5
      Master Grid MT5
      Editing options after unfolding the grid:

      The specified Take-Profit value is set for all new orders + there is an option of mass or manual TP change for already placed orders and positions, which can significantly expand the arsenal of tactical options. Details on this can be found in the TP control setting description. 
      >>   Take-Profits CONTROL for BUY Grid  (common setting for BuyUp and BuyDOWN grids) 

      General description: Enabling Take-Profit control for each pending order or BUY position
      For the grid with SELL orders and positions, this permission works in the same way

      Table of differences between different EAs for this setting:

      Magic Grid MT4
      Magic Grid MT5
      Editing options after unfolding the grid:

      There is no such setting 
      User Grid MT4
      Elastic Grid MT4

      User Grid MT5
      Elastic Grid MT5
      Master Grid MT5
      Editing options after unfolding the grid:
      Enable or disable TP control.

      If Take-Profit Control is ON (true), the set value is checked and adjusted(!) each time you change the timeframe and any changes in the settings. Then any manual TP changes for the selected order or position will be reset at those times! 

      Disabling Take-Profit Control allows you to manually modify the TP value for each individual order or position and these values will be retained as long as the order or position remains active. In this case, new orders will be placed according to the settings you have made.

      If TP control is reactivated, all of their values will revert to their stated values in the settings.
      >>   Stop-Loss for each BUY order   (common setting for BuyUp and BuyDOWN grids) 

      General description: Stop-Loss value for each pending order or BUY position (can be zero, calculated in points)
      For the grid with SELL orders and positions, Stop-Loss is set in the same way

      Table of differences between different EAs for this setting:

      Magic Grid MT4
      Magic Grid MT5
      Editing options after unfolding the grid:

      The Stop-Loss value is only set for new orders. It is possible to modify the SL for each individual order or position manually, but there is no mass modification option for already placed orders and positions!  
      User Grid MT4
      Elastic Grid MT4

      User Grid MT5
      Elastic Grid MT5
      Master Grid MT5
      Editing options after unfolding the grid:

      The specified Stop-Loss value is set for all new orders + there is the possibility of mass or manual change of SL for already placed orders and positions, which can significantly expand the arsenal of tactical possibilities. Details about this can be found in the description of the setting that controls whether SL control is enabled or disabled.
      >>   Stop-Losses CONTROL for BUY Grid  (common setting for BuyUp and BuyDOWN grids) 

      General description: Enabling Stop-Loss control for each pending order or BUY position
      For the grid with SELL orders and positions, this permission works in the same way

      Table of differences between different EAs for this setting:

      Magic Grid MT4
      Magic Grid MT5
      Editing options after unfolding the grid:

      There is no such setting 
      User Grid MT4
      Elastic Grid MT4

      User Grid MT5
      Elastic Grid MT5
      Master Grid MT5
      Editing options after unfolding the grid:
      Enable or disable SL control.

      If Stop-Loss control is ON (true), the set value is checked and adjusted(!) each time the timeframe is changed and any changes in the settings are made. In this case, any manual change of SL for the selected order or position will, at those moments, be reset! This will not allow you, for example, normal use of the classic trailing stop for the selected position.

      Disabling Stop-Loss Control allows manual modification of the SL value for each individual order or position and the values will be retained as long as the order or position remains active. A classic trailing stop (from the Metatrader) can then be used without restrictions. In this case new orders will be placed according to the specified settings.

      If the SL control is enabled again, all of their values will return to the values specified in the settings.
      >>   Lot size for each BUY order  (common setting for BuyUp and BuyDOWN grids) 

      General description: Lot size for each individual BUY pending order
      For the grid with orders and positions of the SELL type, the lot size is configured in the same way

      Table of differences between different EAs for this setting:

      Magic Grid MT4
      Magic Grid MT5
      Editing options after unfolding the grid:

      The specified lot value is relevant only for new orders.
      The lot size for already placed pending orders and market positions is NOT editable!
      User Grid MT4
      Elastic Grid MT4

      User Grid MT5
      Elastic Grid MT5
      Master Grid MT5
      Editing options after unfolding the grid:
      The size of the lots is under constant control. That is, the set value is relevant not only for new pending orders, but can also change the lot for already placed orders (by automatically replacing them when the setting is changed). The check occurs every time the timeframe changes and any changes in the settings. Lots of market positions are not editable.

      >>   Lot change factor for each BuyUp order  ( +  or  - )  separate setting for the BuyUP grid
      Coefficient of change in lot size (when moving away from the initial price) for BuyUp orders 

      >>   Lot change factor for each BuyDOWN order  ( +  or  - )  separate setting for the BuyDOWN grid
      Coefficient of change in lot size (when moving away from the initial price) for BuyDOWN orders  

      For SellUp, SellDown grids, the relevant settings work on the same principle

      Table of differences between different EAs for this setting:

      Magic Grid MT4
      Magic Grid MT5
      Editing options after unfolding the grid:

      There is no such setting 
      User Grid MT4
      Elastic Grid MT4

      User Grid MT5
      Elastic Grid MT5
      Master Grid MT5
      Editing options after unfolding the grid:
      The coefficient can be either positive or negative. Division and multiplication NO!
      That is, if this value is different from 0, the lot of each next order (further from the original price) will increase or decrease by the specified value. At the same time, if this value is set to 0, the lot size will not change.

      This setting controls the grid permanently! That is, the specified value changes the size of lots not only for new pending orders, but also for those already placed (by automatically replacing them when the setting is changed). The check occurs every time the timeframe changes and any changes in the settings. Lots of market positions are not editable.
      >>   Restore BUY orders after closing their market positions  (common setting for BuyUp and BuyDOWN grids) 

      For the grid with SELL orders and positions, this setting works identically

      This setting is available for all grid EAs except Magic Grid (MT4)

      General description: Enable or disable automatic restoring of pending orders at specified price levels (after closing their market positions by Take-Profit, Stop-Loss or manually). 

      This setting can be changed at any time, both at the beginning of trading and during it. For example, you can deploy the entire grid with auto-restoring of orders disabled, and then the Expert Advisor will work in script mode. If some orders (positions) are then deleted (closed) and Autorun is enabled afterwards, the Expert Advisor will fill all set price levels with orders again.

      TOP Panel Settings

      General description:

      The top panel is available in all versions of Expert Advisors and is designed to display the most basic information about the current state of the trade. The central part of the panel displays information with the number of set and active price levels. At the same time, various system messages can also be displayed here when some special trading events occur. The panel background color may change depending on current market conditions. For example, when placing or editing orders, any errors, a closed market, lack of funds, etc.

      The panel also displays information about how many orders have already been placed out of their total allowed (by the broker) number:

      for MT5 versions - this is the limit of the total number of only pending orders for the entire account. But it should be taken into account that some brokers additionally include the number of market positions in this value. And some use this value, in general, only for market positions instead of pending orders (as it is specified in the MQL5 language specifications).

      for MT4 versions - this is a limit on the total number of pending and market (!) orders for the entire account

      This data can be important in the overall planning of the strategy. For example, the EA will not even start trading if the total number of its price levels in the settings exceeds the specified limit. At the same time, it is important to remember that these restrictions are created by the broker, and not by the adviser!

      In versions above Magic Grid, a special checkmark is displayed on the panel, which serves to reset the location of all other possible panels and buttons to their default values. There are simply no other panels for Magic Grid.

      Panel color settings can be used to quickly visually separate a running Expert Advisor while using it on different charts at the same time.

      Separate description of panel settings:

      >>   Enable Top Panel
      Enable or disable the display of the Top Panel on the chart
      >>   Top Panel scale
      Top Panel scaling (increase or decrease)
      >>   Text color
      The default text colour of the Top Panel
      >>   Background color 
      The default background colour of the Top Panel

      MAIN Panel Settings 

      General description: 

      The main information panel (Left Panel) is available in all versions of Expert Advisors above the Magic Grid level. It displays on the chart various useful information that allows you to better control the trading situation. For example, current total market lot (for EA grid + for instrument as a whole), server time, time left till the end of working time-frame, amount of market positions of different categories, etc.. It also displays initial prices for the active grid of the EA, which can be important when at the beginning of trading, these prices were generated automatically, but it became necessary to enter them into settings manually.

      The panel has its own colour indicator for different events, which also serves as a button to minimise and maximise the panel. The panel can be easily moved around the graph by simply dragging it with the mouse, and once the panel is minimised, the remaining indicator button can be placed wherever you like, for example on the top panel. Shift + Left Mouse Click can always bring the panel (or its button) to the foreground. 

      The colour settings of the panel can be used for quick visual separation of the running EA when it is used on different charts at the same time.

      Separate description of panel settings:

      >>   Enable Main Panel
      Enable or disable the display of the Main Panel on the chart
      >>   Main Panel scale
      Main Panel scaling (increase or decrease)
      >>   Titles text color
      Text color of various headings in the main panel
      >>   Basic text color
      The colour of the plain text within the main panel 
      >>   Text color for recounting positions

      Text color for lines related to calculations of the number of market positions

      >>   Background color
      Background colour of the main information panel


      Settings for Old-Grid expert positions

      General description:  

      This group of settings is available for all versions of Expert Advisors above the Magic Grid level. Using them, you can control the properties of market positions that could remain after changing the grid spacing, the number of price levels, or the original prices. With such changes, only pending orders are automatically replaced, but the EA does not delete market positions (which cease to correspond to the settings), leaving the decision on them to the trader.

      This is done so that the trader retains the most complete control over the situation. These positions will be considered obsolete, and if the trader wants to, he can manually delete these positions individually or do it in bulk using a special button that will appear on the chart if the display of the button for closing market positions is enabled in the EA settings.

      And in order to massively change the take profit or stop loss for outdated positions, this section was created. Its settings are also important because they can be used to visually highlight in the general list of market positions which of them are relevant and which are no longer. To do this, for example, you can reset the take profit for outdated market positions of the selected type.

      Also, if the main information panel is enabled and obsolete market positions appear, a special button panel is automatically created for them on the chart, which displays the total number of remaining obsolete positions. Clicking on this panel will generate a separate report with a complete list of these positions and their properties. This panel-button can be separately moved by the mouse on the chart.

      Important note: if you also change the magic number in the settings, then orders and positions with the old magic number will be considered completely foreign! That is, they WILL NOT be considered either relevant or obsolete, and in this case, the adviser will simply deploy a completely new network according to the specified settings.

      These settings are in no way related to the actual grid (which corresponds to the current settings).

      Separate description of the settings in this section:

      >>   Old-Grid positions management 
      Activating the ability to change the properties of obsolete market positions
      >>   Take-Profit for each BUY old-grid position 
      Take-Profit value for each separate obsolete BUY position (calculated in points)

      For MT5 EAs above the Magic Grid version, there is an additional option to disable take profit control separately, even when the overall management of all old positions is active. To do this, you need to set the value to -1 in this setting, and then you can set a different TP for these positions manually.

      Take-Profit for each SELL old-grid position - the principle of this setting is identical to the setting for old BUY positions
      >>   Stop-Loss for each BUY old-grid position 
      Stop-Loss value for each separate obsolete BUY position (calculated in points)

      For MT5 Expert Advisors above the Magic Grid version, there is an additional option to disable stop loss control separately, even when the overall control of all old positions is active. To do this, you need to set the value to -1 in this setting, and then you can set a different SL for these positions manually.

      Stop-Loss for each SELL old-grid position - the principle of this setting is identical to the setting for old BUY positions

      Share it with friends: