Alpha Grid:   GRID Settings

Alpha Grid: GRID Settings

10 March 2024, 07:09
Aliaksandr Charkes
0
446

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

Description of GRID settings

This section describes the main capabilities of the advisor related to grid trading.

To quickly get the necessary information on the desired setting, you can use the page search. It is usually called by pressing F3 or Ctrl+F

The EA can support 4 different grid types (simultaneously or separately). Each grid consists of grid levels, where each grid 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 advisor continues to monitor them as market positions. Types of supported grids:

  • BuyUp - a grid of pending orders of the BUY type, which unfolds UP from the initial price
  • BuyDown - a grid of pending orders of the BUY type, which unfolds DOWN from the initial price
  • SellUp - a grid of pending orders of the SELL type, which unfolds UP from the initial price
  • SellDown - a grid of pending orders of the SELL type, which unfolds DOWN from the initial price

Initial prices are determined manually or generated automatically using several different algorithms. All grids can operate completely independently of each other, and each of them has its own set of settings that can be changed at any time during trading. Below is a description of the settings only for the BuyUp grid. For other types of grids they are fundamentally identical.



>>  Restore BuyUp orders after closing their market positions

A separate section has been created to describe this setting.  Read here >>

>>  Quantity of BuyUP grid levels from Initial Price
The number of grid levels of the BUY type placed UP of the initial price (can be equal to 0).

Pending orders of the BuyStop type are placed ABOVE the current market Ask price
Pending orders of the BuyLimit type are placed UNDER the current market Ask price

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 advisor will issue a warning about this situation and place this order only when the market price goes beyond the freezing limits. This will happen automatically, and after all orders have been placed, the advisor will generate a corresponding report about this.

Automatic editing of grid levels

Enlargement or reduction available. Pending orders of the advisor that no longer correspond to the current settings are deleted automatically. Market positions of the advisor that no longer correspond to the current settings are NOT automatically deleted, but separate statistics begin to be kept on them. You can also enable separate controls for them with mass editing of their properties or use a separate button for their mass deletion. See the description of the corresponding settings section (Settings for Old-Grid expert's positions).

Manual editing of grid levels

The location of already placed pending orders can be changed manually (by simply dragging them on the chart, or by editing their properties). In this case, the advisor will not try to return the displaced order to its place or place a new one in its place (at a given price level) and will retain all other control over it. This can be used for any tactical changes to the selected strategy and actually build a grid of any configuration, but new orders will be placed in accordance with the current settings.

However, it should be taken into account that when manually moving a pending order, its stop-loss and take-profit are automatically moved after it. And if, for example, a pending order of the BuySTOP type is moved so that its stop loss is higher than the current Ask level, the advisor will no longer control either the stop-loss or take-profit.

>>  TYPE OF TRADING for BuyUp GRID

Selecting the MAIN Trading Mode. 3 modes available:

[ STANDART_TRADING ] - Default Trading Mode
Trading is carried out in the classical way, without the use of hidden algorithms.

[ PHANTOM_GRID ] - Phantom Mode  
A separate section has been created to describe this setting.  Read here >>

[ INITIAL_PRICE_BINDING_to_MARKET ] - Modes of BINDING initial prices 
>>  AskUP Binding Range, if BINDING_to_MARKET selected
>>  AskDOWN Binding Range, if BINDING_to_MARKET selected
A separate section has been created to describe this setting.  Read here >>

>>  Price Initial MODE Select for BuyUp GRID

Selecting the initial price setting method:

[ PRICE_INITIAL_AUTO ] 
Automatic generation of initial price

[ PRICE_INITIAL_MANUAL ] 
Manually setting the initial price

[ BuyDownPIN_under_STEP_of_BuyUpPIN ] 
Semi-automatic setting of the initial price (only for Down type grids)

>>  Manual Initial Price value for BuyUp Grid
>>  Distance from Ask for Initial Price in AUTO mode  ( +  or  - )

A separate section has been created to describe these settings.  Read here >>

Block of settings related to grid STEP
All settings related to the grid step can be changed at any time. If you change them after the start of trading, the grid will be rebuilt in accordance with them. In this case, new orders (at new grid levels) will be placed automatically, and old ones (which no longer correspond to the current settings) will be automatically deleted.

Market positions of the advisor that no longer correspond to the current settings are NOT automatically deleted, but separate statistics will be kept on them. It will also be possible to enable separate controls for them with mass editing of their properties or use a separate button to mass delete them. See the description of the corresponding settings section (Settings for Old-Grid).
>>  Step change FACTOR TYPE for BuyUp GRID

This setting allows you to enable the ability to use the grid step coefficient, when each subsequent grid level will be located with a specified increase or decrease relative to the previous level. There are 4 types of coefficients available: addition, subtraction, multiplication and division. If the value of a factor type is [ STEP_Size_Factor_OFF ], it is considered disabled. 

>>  Step change FACTOR VALUE for BuyUp GRID

This setting determines the VALUE of the grid step coefficient. That is, it is this value that will be used to change each next grid step if any type of coefficient for the grid step is selected. And here the main logic is that the first size will always be the full step (specified in a separate setting) and the change factor starts to be taken into account only after it.

The value cannot be negative or equal to 0. If the coefficient TYPE for the grid step is not defined, the value of this setting is not taken into account.

>>  LIMIT change FACTOR for BuyUp GRID step

This setting defines the LIMIT of the grid step change when using the selected coefficient. That is, when setting any value in this field, the grid step cannot be greater or less (depending on the coefficient type) than the specified one.

Example:

-- initial step:   500 points
-- step reduction coefficient:   subtraction or division
-- step change limit value:   100 points

Result: as soon as the calculated step becomes less than 100, it and all subsequent steps (in the direction of grid unfolding) will be equal to 100 points

Additional information:

The change limit setting is expressed in points, and is taken into account only when any coefficient of grid step change is selected. If the coefficient of change is selected, but the change limit value is less than or equal to 0, the minimum step value will be considered 1 point (the maximum can actually be ignored). If no coefficient of change is selected, this setting will be considered disabled at any value.

>>  Step SIZE VALUE for BuyUp GRID

The grid step size, which is calculated in points of the selected tool. That is, it is this value that will be used to calculate the location of each next grid level when the grid step coefficient is NOT specified. Or this value will be INITIAL if the step factor is to be taken into account. The value cannot be negative or equal to 0.

Block of settings related to Take-Profit for each grid order or position
All settings related to the TP grid can be changed at any time. The specified Take-Profit value is set for all new orders + it is possible to mass or manually change TP 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 TP control is enabled or disabled. 
>>  Take-Profits change FACTOR TYPE for BuyUp GRID

This setting allows you to enable the ability to use the Take-Profit coefficient, when for each next grid level TP will be calculated with a specified increase or decrease relative to the previous level. There are 4 types of coefficients available: addition, subtraction, multiplication and division. If the value of a factor type is [ Take-Profit_Factor_OFF ], it is considered disabled. 

>>  Take-Profits change FACTOR VALUE for BuyUp GRID

This setting determines the VALUE of the Take-Profit coefficient. That is, it is this value that will be used to change each next TP if any type of coefficient for TP is selected. The Take-Profit of the first grid order or position will always remain full-size (specified in a separate setting) and the change coefficient begins to be taken into account only after this order or position.

The value cannot be negative or equal to 0. If the TP coefficient TYPE is not defined, the value of this setting is not taken into account.

>>  LIMIT change FACTOR for BuyUp GRID TP

This setting defines the LIMIT of Take-Profit change for each subsequent grid order or position when using the selected coefficient. That is, when setting any value in this field, Take-Profit cannot be greater or less (depending on the coefficient type) than the specified one.

Example:

-- initial Take-Profit:   500 points
-- TP reduction coefficient:   subtraction or division
-- TP change limit value:  100 points

Result: as soon as the calculated TP becomes less than 100, it and all subsequent TP values ​​(in the direction of grid unfolding) will be equal to 100 points

Additional information:

The change limit setting is expressed in points, and is taken into account only when any Take-Profit change coefficient is selected. If the change coefficient is selected, but the change limit value is less than or equal to 0, the minimum TP value will be considered the minimum value allowed by the broker (the maximum can actually be ignored). If no change factor is selected, this setting will be considered disabled at any value.

>>  Take-Profit VALUE for each BuyUp order or position

Take-Profit value, which is calculated in points of the selected instrument. That is, it is this value that will be used to calculate TP for each next grid level when the TP coefficient is NOT specified. Or this value will be INITIAL if the TP factor is to be taken into account. The value cannot be negative BUT it can be 0 and this will mean that TP is not used. 

>>  Take-Profits CONTROL for BuyUp GRID

Enabling or disabling Take-Profit control. If Take-Profit control is ENABLED (true), the set value is checked and adjusted(!) with each time frame change and any changes in the settings. In this case, any manual change to TP for the selected grid order or position will be reset!

DISABLING Take-Profit Control allows you to change the TP value for each individual order or position manually, and these values will be maintained as long as the order or position remains active. In this case, new orders will be placed in accordance with the current settings. When you re-enable TP control, all changed values will return to those stated in the settings.

Important: When take-profit control is turned on, they are calculated not from established orders and positions, but from the grid levels at which orders must be placed. That is, if you manually drag an order from its level on the chart (and its take profit follows it), this will not mean that the TP will remain in the new place. As soon as the advisor receives a signal to check the levels (for example, when switching the time-frame), the take-profit of the shifted order will move to its initial place, and the order itself will not be affected. To avoid this, when moving an order manually, you need to disable take-profit control.

Block of settings related to Stop-Loss for each grid order or position

All settings related to the SL grid can be changed at any time. The specified Stop-Loss value is set for all new orders + it is possible to mass or manually change 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 change FACTOR TYPE for BuyUp GRID

This setting allows you to enable the ability to use the Stop-Loss coefficient, when for each next grid level SL will be calculated with a specified increase or decrease relative to the previous level. There are 4 types of coefficients available: addition, subtraction, multiplication and division. If the value of a factor type is [ Stop-Loss_Factor_OFF ], it is considered disabled.

>>  Stop-Losses change FACTOR VALUE for BuyUp GRID

This setting determines the VALUE of the Stop-Loss coefficient. That is, it is this value that will be used to change each next SL if any type of coefficient for SL is selected. The Stop-Loss of the first grid order or position will always remain full-size (specified in a separate setting) and the change coefficient begins to be taken into account only after this order or position.

The value cannot be negative or equal to 0. If the SL coefficient TYPE is not defined, the value of this setting is not taken into account.

>>  LIMIT change FACTOR for BuyUp GRID SL

This setting defines the LIMIT of Stop-Loss change for each subsequent grid order or position when using the selected coefficient. That is, when setting any value in this field, Stop-Loss cannot be greater or less (depending on the coefficient type) than the specified one.

Example:

-- initial Stop-Loss:  500 points
-- SL reduction coefficient:  subtraction or division
-- SL change limit value:  100 points

Result: as soon as the calculated SL becomes less than 100, it and all subsequent SL values ​​(in the direction of grid unfolding) will be equal to 100 points

Additional information:

The change limit setting is expressed in points, and is taken into account only when any Stop-Loss change coefficient is selected. If a change factor is selected, but the change limit value is less than or equal to 0, the minimum SL value will be considered the minimum value allowed by the broker (the maximum can actually be ignored). If no change factor is selected, this setting will be considered disabled at any value.

>>  Stop-Loss VALUE for each BuyUp order or position

Stop-Loss value, which is calculated in points of the selected instrument. That is, it is this value that will be used to calculate SL for each subsequent grid level when the SL coefficient is NOT specified. Or this value will be INITIAL if the SL factor is to be taken into account. The value cannot be negative BUT it can be 0 and this will mean that SL is not used.

>>  Stop-Losses CONTROL for BuyUp GRID

Enabling or disabling Stop-Loss control. If Stop-Loss control is ENABLED (true), the set value is checked and adjusted(!) with each time-frame change and any changes in the settings. In this case, any manual change in SL for the selected order or position will be reset! And this, for example, will not make it possible to normally use the classic Trailing Stop for a selected position.

DISABLING Stop-Loss Control allows you to change the SL value for each individual order or position manually, and these values will be maintained as long as the order or position remains active. The classic Trailing-Stop (from a metatrader), in this case, can be used without restrictions. But, new orders will be placed in accordance with the current settings. When you re-enable SL control, all changed values will return to those stated in the settings.

Important: When stop-loss control is turned on, they are calculated not from established orders and positions, but from the grid levels at which orders should be placed. That is, if you manually drag an order from its level on the chart (and its stop-loss will follow it), this will not mean that the SL will remain in the new place. As soon as the advisor receives a signal to check the levels (for example, when switching the time-frame), the stop-loss of the shifted order will move to its initial place, and the order itself will not be affected. To avoid this, when moving an order manually, you need to disable stop-loss control.

Block of settings related to LOT for each grid order or position

All settings related to lot sizes can be changed at any time.

>>  Lot change FACTOR TYPE for BuyUp GRID

This setting allows you to enable the ability to use the lot size coefficient, when for each next grid level the LOT will be calculated with a specified increase or decrease relative to the previous level. There are 4 types of coefficients available: addition, subtraction, multiplication and division. If the value of a factor type is [ LOT_Size_Factor_OFF ], it is considered disabled.

>>  Lot change FACTOR VALUE for BuyUp GRID

This setting determines the VALUE of the lot size coefficient. That is, it is this value that will be used to change the size of each next lot, if any type of coefficient is selected for this. The lot of the first grid order or position will always remain full-size (specified in a separate setting) and the change coefficient begins to be taken into account only after this order or position.

The value cannot be negative or equal to 0. If the lot size coefficient TYPE is not defined, the value of this setting is not taken into account.

>>  LIMIT change FACTOR for BuyUp GRID Lot

This setting defines the LOT change LIMIT for each subsequent grid order or position when using the selected coefficient. That is, when setting any value in this field, the lot size cannot be larger or smaller (depending on the coefficient type) than the specified one.

Example:

-- initial lot size:   1.0
-- lot size reduction coefficient:   subtraction or division
-- lot size change limit value:   0.3

Result: as soon as the calculated lot becomes smaller than 0.3, it and all subsequent lot values ​​(in the direction of grid unfolding) will be equated to the size of 0.3

Additional information:

The change limit setting is taken into account only when any change coefficient is selected for lots. If the change coefficient is selected, but the change limit value is smaller or equal to 0, the minimum lot value will be considered the minimum value allowed by the broker (similarly for the maximum limit). If no change factor is selected, this setting will be considered disabled at any value.

>>  Lot size VALUE for each BuyUp order

Lot size value. That is, it is this value that will be used to calculate the lot size for each subsequent network level when the lot size coefficient is NOT specified. Or this value will be INITIAL if the lot size factor is to be taken into account. The value cannot be negative or equal to 0.

>>  Lots CONTROL for Pending Orders of BuyUp GRID

If the lot control mode is enabled, the size of the lots will be under constant control. That is, the specified value will be relevant not only for new pending orders, but also for already placed orders (by automatically replacing them when the setting is changed). The check occurs every time the time frame changes and any changes in the settings.

Lots of market positions cannot be edited.

Control of outdated positions and orders

These settings are in no way related to the current grid. Using them, you can control the properties of only those market positions that could remain after changing the grid step, the number of grid levels, or the initial prices. With such changes, only pending orders are automatically replaced, but market positions (which no longer correspond to the settings) are not deleted by the advisor, leaving the decision to the trader. 

This is done so that the trader maintains maximum control over the situation. These positions will be considered outdated, and if the trader wants, he can manually delete these positions individually or do it en masse using a special button that will appear on the chart if the display of the button for closing market positions is enabled in the advisor settings.

And in order to massively change Take-Profit or Stop-Loss for outdated positions, this section was created. Its settings are also important because with their help you can visually highlight in the general list of market positions which of them are relevant and which are no longer relevant. To do this, for example, you can reset the Take-Profit for outdated market positions of the selected type.

Also, if the general information panel is enabled and outdated market positions appear, a special button panel is automatically created for them, which displays the total number of outdated positions remaining. If you click on this panel, a separate report will be generated with a complete list of these positions and their properties. This reporting panel can be moved separately with the mouse along the chart, its transparency can be adjusted, scaled, and its data can be saved in a separate file.

Important note: if you 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 NO longer be considered either current or outdated, and in this case the advisor will simply deploy a completely new grid in accordance with the current settings.



>>  Old-Grid positions management

Activating the ability to change the properties of outdated market positions

>>  Take-Profit for each BUY old-grid position

Take-Profit value for each individual legacy position (calculated in points).

A value of -1 allows you to disable Take Profit control even when the overall control of all legacy positions is active. In this case, it will be possible to set different TP for these positions manually.

Take-Profit for each SELL old-grid position - the principle of operation of this setting is identical to the setting for outdated BUY positions.

>>  Stop-Loss for each BUY old-grid position

Stop-Loss value for each individual legacy position (calculated in points).

A value of -1 allows you to disable Stop Loss control even when general control of all legacy positions is active. In this case, it will be possible to set different SL for these positions manually.

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

Top panel (information capabilities)

The top panel is designed to display the most basic information about the current trading state. In the central part of the panel there is an inscription with the number of defined and active network levels. At the same time, clicking on this inscription brings up an additional reporting panel, with various statistical information about network levels. This additional panel can be moved with the mouse, its transparency can be adjusted, scaled, and its data can be saved into a separate file.

When certain special trading events occur, different system messages (instead of the number of network levels) may be displayed in the central part of the top panel. This may change the background color of the panel. For example, this happens when placing or editing orders, any errors, prohibitions, closed market, lack of funds, etc.

The panel also displays a special checkbox that serves to reset the location of all other possible panels and information about how many orders have already been placed out of the total number allowed (by the broker). 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 specified in the MQL5 language specifications). This data may be important in overall strategy planning. For example, the advisor will not even start trading if the total number of its price levels in the settings exceeds the specified limit. It is important to remember that these restrictions are created by the broker, not the advisor!

The color settings of the top panel can be used to quickly visually separate a running Expert Advisor while simultaneously using it on different charts. When you hover your mouse over various panel labels, in different situations, tooltips may appear.

>>  Enable Top Panel

Enabling or disabling the display of the top panel on the chart

>>  Top Panel scale

Scaling the top panel (increase or decrease)

>>  Text color

Top panel text color

>>  Background color

Top panel background color

General information panel 

Using the general information panel, additional useful information is displayed on the chart, allowing you to better control the trading situation. For example, the current total market lot (for the advisor grid + for the entire instrument), server time, time remaining until the end of the current time frame, the number of market positions in various categories, etc... It also displays the initial prices for the current advisor grid, which It may be important when at the beginning of trading these prices were generated automatically, but it became necessary to enter them into the settings manually.

The panel has its own color indicator for various events, which also serves as a button for collapsing and expanding the panel. The panel can be easily moved around the chart with the mouse, and after collapsing the panel, the remaining indicator button can be placed in any place convenient for you, for example, on the top panel. In this case, using the combination Shift + Left Mouse Click you can always bring the panel (or its button) to the foreground. 

Panel color settings can be used to quickly visually separate a running Expert Advisor while simultaneously using it on different charts. When you hover your mouse over various panel labels, in different situations, tooltips may appear.

More information about general panel  >>

>>  Enable General Panel

Turn on or off the display of the general information panel on the chart

>>  General Panel scale

 Scaling the general information panel (zoom in or out)

>>  Titles text color

Text color of various headings in the general panel

>>  Basic text color

Color of ordinary text inside the general panel

>>  Text color for recounting positions

Text color for lines associated with market position quantity calculations  

>>  Background color

General information panel background color

Using an Expert Advisor on Multiple Charts