Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1516

 

Which criterion should I test if I want to get the highest income and the highest profit with minimal drawdowns?


I think I need to select "Maximum of complex criterion", I did that, but what does the number 40 in the yellow coloured result mean, with a drawdown of 26% and a profit of 675?

I understand that this is the coefficient of the current starting capital as a percentage of income?

 
AkaEdie #:

What criteria should I use for testing if I want to get the highest income and the highest profit with minimal drawdowns?

I think I need to select "Maximum Comprehensive Criterion",

Select "Maximum user criterion".

Add something like this to the EA code.

double OnTester(void)
  {
   double ret = TesterStatistics(STAT_PROFIT) / TesterStatistics(STAT_EQUITY_DD);

   return(ret);
  }
 
AkaEdie # I think I need to select "Maximum of complex criterion", I did so, but what does the number 40 in the yellow colour result mean, with a drawdown of 26% and a profit of 675?

I take it this is the current coefficient of the starting capital as a percentage of income?

Probably not. It is just a number calculated by some formula from several calculated characteristics of the drawdown in the tester. This formula is written in such a way that its maximum value is 100. Accordingly, the closer to 100 the result is, the better. If you get 40, it means that the results are not very good, below average.

 
Vitaly Muzichenko ChartSetSymbolPeriodand checking that the MA did not return a result

It only starts working like this

I don't know what's wrong with your design.


I can't get a good picture of it. Poke it.

 
Alexey Viktorov #:

I don't know what's wrong with the way it's working.


I can't get a decent gif. Click on it.

Click on it, it's also a gif.

As you can see, it doesn't work without ChartSetSymbolPeriod.

works only with the native period on which MA is created: hMA1=iMA(Symbol(), PERIOD_H1, MA1, 0, Metod_MA, Price_MA);


 
Vitaly Muzichenko #:

Here you go, it's a gif too.

As you can see, it doesn't work without ChartSetSymbolPeriod

works only with the native period on which the MA is created: hMA1=iMA(Symbol(), PERIOD_H1, MA1, 0, Metod_MA, Price_MA);


Vitaly, I only noticed that in the code on the image.

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
  if(rates_total-prev_calculated==0)
    return(rates_total);
  int res=Start(rates_total); // если "0" - то данные от МА не получены
  if(fl && res==0) {
    ChartSetSymbolPeriod(0,Symbol(),PERIOD_CURRENT);
    ChartRedraw();
    fl=false;
    return(0);
  }
  return(rates_total);
}

There is such crap.

Delete these lines and try again.

I don't understand why you need to make your own corrections and say that the advice doesn't work....

then on the image you have the wrong indicator that you show here....

 
Aleksandr Slavskii #:

Select "Maximum user criterion"

Add something like this to the EA code.

Wow, thank you very much.

 
Alexey Viktorov #:

Vitaly, I only noticed in the gif that in the code.

That's bullshit.

Delete these lines and try again.

I don't understand why you have to make your amendments and say the advice doesn't work....

then you have the wrong indicator in the image that you are showing here....

if(rates_total-prev_calculated==0)

It will fail if there is an error of receiving data from MA and return(0); will return 0.

The same indicator is on the image.

You can remove it, but it won't solve the problem, it will only recalculate the indicator on each tick, which is not necessary.

PS. And yes, I removed it and checked - the problem did not go away, only ChartSetSymbolPeriod(0,Symbol(),PERIOD_CURRENT);

 
Vitaly Muzichenko #:

This will fail if there is an error receiving data from MA and return(0); returns 0

The same indicator is on the image.

You can remove it, but it will not solve the problem, it will only recalculate the indicator on each tick, and it is not necessary.

PS. And yes, I removed it and checked - the problem did not go away, only ChartSetSymbolPeriod(0,Symbol(),PERIOD_CURRENT);

Suit yourself. If you can't live without it, then so be it....

How can you say that the indicator is the same, if the example is just a printout of the value, and the graphical elements are built on the gif...


Well, yes... The bigger problem is this line.

  int res=Start(rates_total); // если "0" - то данные от МА не получены

Take it down and check it again. You don't even need to redraw the graph.


Yes, Vitaly, sorry, it was my mistake and printing was coming from another place.

 
Alexey Viktorov # :

Suit yourself. If you can't live without it, so be it.

How can you say that the indicator is the same, if the example is just a printout of the value, and the gif has graphical elements...


Well, yes... The bigger problem is this line

Take it down and check it again. You don't even need to redraw the graph.


Yes, Vitaly, sorry, it was my mistake and printing was coming from another place.

objects are built according to MA calculations

Reason: