Trade advisor GS grid using the advanced grid algorithm and constrained Martingale

Trade advisor GS grid using the advanced grid algorithm and constrained Martingale

1 February 2019, 12:15
Aleksander Gladkov
1
1 012

GS grid  is a fully automated Expert Advisor using a grid and constrained Martingale.

Version GS grid for MT4: https://www.mql5.com/en/market/product/29110.

Version GS grid5 for MT5:https://www.mql5.com/en/market/product/34924.

Advisor who is not afraid to lose, so wins: 100% of transactions in plus.

Works on accounts with a leverage of 1:500 and a Deposit from 200USD EURUSD M15 currency pair.

Real-time results can be seen on the signals:

The Martingale idea works best in the market when the trend direction changes several times a day.

If there is a significant trend for a day without refusals, everything will depend on the amount of the deposit - whether this will be enough to cover the drawdown.

In versions older than 9.0, the Use Auto Direction Trade = true mode is provided; in which the advisor itself determines the direction of the trend and accordingly switches the trading parameters.

The advantage of the Martingale algorithm is that it allows you to quickly respond to changes in the market situation and ensures a rapid growth of the deposit.

The task of the user is to turn this increase into profit by fixing it with the help of withdrawals.

GS grid v9.0 solves the problem of trend direction trading in the following ways:
  1. The algorithm for determining and controlling the current trend allows you to automatically adjust the trading parameters (Use Auto Direction Trade = true;)
  2. The Hedge algorithm uses an order in the opposite direction to the loss and tries to close all orders at breakeven (Use Hedge = true;)
  3. DD Reduction Algorithm closes extreme orders of a losing series at breakeven (Max orders for DD Reduction Algorithm (0 -not use) = 5;)
  4. News filter to prevent trading during news release ( Filter News Forex Factory=true; ).

These measures can significantly reduce the risk of losing your deposit.

GS grid was developed to ensure the earliest growth of the deposit while optimizing the risk:

  1. Adjustment and adaptation for a specific currency pair and interval: EURUSD M15. The use of indicators and the development of signal generation algorithms in such a way as to ensure the early closure of the transaction to minimize risk. Parameters: Maximum number of orders = 13, Lot increment ratio = 1.5, Minimum distance between orders Ashi (cents) = 45, Minimum distance between order grid (cents) = 120, Target profit (cents) = 90
  2. Testing in 2018 showed the advantage of trading only SELL orders. Parameters: Use orders SELL = true, Use orders BUY = true
  3. Separate accounting of orders SELL and BUY. The ability to close a transaction by the amount of profit, the SELL and BUY order, or separate accounting of profits for each group. Parameter: close ALL orders = false *
  4. A unique closing algorithm was developed when the maximum possible profit was achieved. Parameter: Take Maximum profit = true. According to the test, the algorithm allows you to receive up to 140% deposit increment per day (for example: 2018.06.14 https://youtu.be/SPyyF0OPO0c)
  5. Use Stop Loss Orders. Parameter: Stop Loss order = 600
  6. Restriction of trading days. Parameter: Final Day = Friday
  7. Limit trading time. Parameters: Start Time = "00:00", End Time = "23:59"
  8. Optimize your deposit size to start trading. For starting lots = 0.01, the recommended deposit is $ 200 (1: 500)

* Simultaneous work with SELL and BUY orders for one currency pair on the MT5 terminal is supported only for hedging accounts.

For EURUSD 1cent=1point, for XAGUSD 5cent=1point, I think it is convenient to set the parameters in cents, so as not to take into account the different cost of Point in different currency pairs.

Setting set parameter contains the basic parameters for the autotuning of the parameters of the adviser's operation mode (No, Safety, Night, Work1, Work2, Work3, Risky).

Parameters \ Modes Security Nightly_GMT
Work1
Work2
Work3
Work4
Risky
Maximum number of orders
max_9  max_10
max_11 max_12  max_13 max_13 max_13
Number of steps increase lot
 max_7  max_7  max_7  max_7  max_7  max_8  max_9
Take maximum profit
false true false false  true true true
Stop Loss
0 0 600 0  0 0 0
Use orders SELL
true true true true  true true true
Use orders BUY
false
true false false  false true true
Close ALL orders
true true false false  false false false
The last day
Friday Friday
Friday
Friday  Friday Friday Saturday
Start time (Local) "23:00" GMT "20:00" GMT
"00:00"
"00:00"
 "00:00" "00:00"
"00:00"
End time (Local) "06:00" GMT "08:00" GMT
"23:59"
"23:59"
 "23:59" "23:59"
"23:59"

The Start Time and EndTime parameters are set in local time. For Safety and Nightly_GMT modes, the specified time in GMT is recalculated to local. Thus, advisers working in these regimes in Australia and Europe will receive similar results.

By default, the parameters are set to the corresponding mode "Work2", only Setting Set=NO, which allows you to change each parameter individually.

IMPORTANT: Individual adjustment of the parameters should be done with the Setting Set = NO.

For example: if you set Setting=Work3 to set value of the Final day=Thursday, and it will never work, because the value of Friday predefined mode Work3.

The current values of the parameters are displayed in the table on the chart.

If you use the preset Setting set you only need to set the Setting set. But if you want to change at least one of the preset parameters, you must Setting set=NO and enter all the parameters in accordance with the set and the new one. The choice Setting set does not populate the input fields of parameters in accordance with your list!

GS grid settings allow you to adapt it to any market, only you need to use the "NO" mode and not trade against the global trend.

To find a suitable set of parameters for any period (no more than a year), you can use the "optimization" mode of the tester. To do this, set the Setting set=NO, Order Stop Loss (cents) = 0, and opposite the parameters responsible for the modes put a tick (Take Maximum profit, Use orders SELL, Use orders BUY, Close ALL orders ).

You can change the parameters of the adviser with open orders.

There are provisions for selective closing of orders manually. It is not recommended to close the last order in the SELL and BUY groups, as they set the boundary condition of the transaction to open the next order.

For emergency closing of orders, the buttons CloseSELL and CloseBUY of the expert Advisor is used.


Grid5 Advisor dated January 30, 2009, during the decision on the Fed rate:


This is for hedging. There is no need to place orders for SELL or BUY orders only. As a result, a deposit of 18% per day was recorded.

According to my observations, almost all highly profitable advisers on the Market use the idea of the Martingales to admit that it is or not.

Since this is probably the best way to increase the Deposit in a short time.

And everyone is faced with the problem: What to do when the market movement leads to a significant drawdown?

  • You can just close the deal on Stop Loss, but it will kill the profitability.
  • You can use hedging algorithms and open positions in the opposite direction, which also does not solve the problem, as it only slows down the rate of loss growth, giving a chance to improve the situation. However, if there is no improvement, the same Stop Loss is triggered.

Questions: "Why give the EA more money than it can spend? Where is the guarantee that it will not spend more after the stop Loss is triggered?"

The GS grid5 advisor decides as follows:

Significant drawdown and opening of increasing losing positions - this is a potential opportunity to get a high profit at the same time (the EA has a unique algorithm for closing positions when the maximum local profit is reached)

And the risk of losing the Deposit remains and depends on the size of the Deposit and the starting lot used.

On the test graph of 2018

 

General criteria for evaluating advisors in my blog:

Recommendations for choosing an expert Advisor on the Market: https://www.mql5.com/en/blogs/post/724722

Share it with friends: