Discussion of article "Developing a cross-platform grid EA (Last part): Diversification as a way to increase profitability"

 

New article Developing a cross-platform grid EA (Last part): Diversification as a way to increase profitability has been published:

In previous articles within this series, we tried various methods for creating a more or less profitable grid Expert Advisor. Now we will try to increase the EA profitability through diversification. Our ultimate goal is to reach 100% profit per year with the maximum balance drawdown no more than 20%.

If we do not alter the underlying trading system, there are two possible ways, which might help us increase profitability.

  1. The first method is to decrease the time period, in which the EA parameters are optimized. This can allow us to accurately adjust the EA to the current market cycle and receive the maximum profit.
    However, this method has a significant drawback. Past profit does not guarantee future profits. The lower the time interval used for EA testing, the higher the risk of that a strategy can be destroyed by market changes.
  2. The second method implies multi-currency trading (diversification). Lot size for each financial instrument will be lower than with single-currency trading. With such loss management, even if you hit drawdown or stop loss on any of the instruments, the maximum balance drawdown will be less than with single-currency trading. In addition, profit on other symbols can help in recovering the deposit faster.

Author: Roman Klymenko

Roman Klymenko
Roman Klymenko
  • www.mql5.com
Published article Developing a cross-platform grider EA (part III): Correction-based grid with martingale In this article, we will make an attempt to develop the best possible grid-based EA. As usual, this will be a cross-platform EA capable of working both with MetaTrader 4 and MetaTrader 5. The first EA was good enough, except that it could...
 

The problem of grids is that the optimiser selects settings so that to get to an unfavourable chart with a minimum lot. This is not how it happens in life. At first, positions are accumulated on the middle market, then a very unfavourable chart comes for a short time and hello to the Margin Call.

It has been proven many times that without a profitable trading system, nets and martins will not improve trading performance.

 
Tried to run on EURUSD. I have not made a single trade on M15 in the tester for 2 years of history. There are no errors and warnings in the log. There are a lot of settings. It is difficult to understand from the first time which ones are responsible for what and why nothing works.
 
The Expert Advisor does not start, it smiles but does not open trades. Can you tell me how to start it, or a description of settings, sets?
 
Optimising for a year with a number of deals in the region of 50-odd is a fit to history.
 
itanprom:
The Expert Advisor does not start, it smiles but does not open trades. Can you tell me how to start it, or a description of settings, sets?

You need to enter a pair to smile and open positions.

Snapshot

and there are 11 pairs in the settings.

 

Can anyone provide a setting set ? I'm running this EA and it's not even opening normal trades... I'd really like to try this.


Thank you, sir.

 
Liu Jeff:

Can anyone provide a setting set ? I'm running this EA and it's not even opening normal trades... I really want to try this.


Thank you, sir.

I don't feel like I can set the parameters, it always says timer not set, can anyone help?

 

Thank you for your articles, I have thoroughly studied your code and borrowed some ideas for my robot. I would like to wish you to treat your code more carefully, at least to think up clear and logical names for variables, so that one could immediately understand why a variable is needed. Especially if you post your code for public viewing. And you should comment the code more.

They wrote about the small number of trades and fitting to history - I optimised your robot on the M1 timeframe, which gave from 4 thousand trades for 3 years, the best instances gave quite stable results.

It is absolutely inconvenient to work with the absolute amount of money as the goals of the Expert Advisor, it would be a thousand times better if you chose to set the number of pips as goals, and in addition to a static lot, as an option - a percentage of the maximum allowable lot. Otherwise, even just moving from one budget in the tester to another is a big problem, you have to restart optimisation.

By the way, somewhere it was written about gradual increase of lot - I have not found anything about it in the code, maybe not the latest version.

I was also very confused by the strategy of entering by MA, which usually considers either increasing or decreasing of MA value. In the code it looks like this:

if (buf0[0] > buf0[6]) {
   //--- MA grows
} else if (buf0[0] < buf0[6]) {
   //--- MA drops
}

Why is the value of the seventh bar compared to the current bar? Where is the logic? What if it is a flat and between the 1st and 7th bar the MA was rising and falling? It seems that you didn't care much about this point, perhaps you wanted to finish the article quickly. In my opinion, it is necessary to consider a stable growth for several bars in a row to confirm it. I have written a code to catch confirmed reversals or stable growth/decline of array values for several bars and I am sharing it with you:

//+------------------------------------------------------------------+
//| Catching the indicator reversal|
//+------------------------------------------------------------------+
bool getReverse(double & object [], string direction, int repeatsIn, int repeatsOut) {
   bool reverseCorrect = true;
   
   if (direction == "up") {
      if (repeatsOut > 0) {
         for(int i = 0; i <= (repeatsOut - 1); i++) {
            if (!(object[i] > object[i+1])) reverseCorrect = false;
         }
      }
      
      if (repeatsIn > 0) {
         for(int i = repeatsIn; i <= (repeatsIn + repeatsOut - 1); i++) {
            if (!(object[i] < object[i+1])) reverseCorrect = false;
         }
      }   
   } else {
      if (repeatsOut > 0) {
         for(int i = 0; i <= (repeatsOut - 1); i++) {
            if (!(object[i] < object[i+1])) reverseCorrect = false;
         }
      }
      
      if (repeatsIn > 0) {
         for(int i = repeatsIn; i <= (repeatsIn + repeatsOut - 1); i++) {
            if (!(object[i] > object[i+1])) reverseCorrect = false;
         }
      }
   }
      
   return reverseCorrect;
}

Use it like this:

getReverse(MA1Val, "up", 0, 7);

In this example, the function will return true if the MA1 value has been rising for 7 consecutive bars. If you replace 0 with, for example, 3, it will look for a pattern where MA first fell 3 bars in a row and then rose for 7 bars in a row.

I will not comment on other indicators, there is also something to think about. Even when using standard indicators you can add more logic.

Good luck!

 
There is no billing procedure in the code, only a levelling procedure, a lot of repetitive parameters and procedures, useless misjudgements and creation of objects, this is the most rubbish code I've ever seen!
 

gsc:
代码里没有开单程序,只有平单程序,大量重复的参数和程序,毫无用处的错误判断和创建物件,这是我见过的最垃圾的


Can you help write an ea thanks