For the consideration of professionals. - page 2

 
Integer:

The red lines show the drawdowns, you need to find the maximum.

Why do you need to find the maximum drawdown? What does that tell you?
 
Andrei01:

The tester measures the maximal drawdown of equity correctly but it does not take into account the balance state at this moment which makes no sense.

In other words, if the open order went up and then went down by 100 pips, the tester will show a 100 pips drawdown of equity while the real drawdown that logically determines the strategy risk is equal to zero. It is clear that such calculations are useless for estimating the strategy risks.


Andrei01:
And why look for the maximum drawdown? What does that tell you?
Well, if you don't need it or don't understand what it's for, why join the conversation, and even impose your opinion?
 
Andrei01:

The tester measures the minimum and maximum drawdown correctly, but it does not take into account the balance state at that moment which makes this measurement nonsense.

That is, if the open order rises and then falls by 100 pips, the tester will show a 100 pips drawdown of equity while the real drawdown that logically determines the strategy risk is equal to zero. It is clear that such calculations are useless for strategy risk estimation.

Please explain where you found such a parameter as minimum drawdown, in which report. I have not come across it. I don't think the balance is worthless for me, I don't care if it is on the ground as long as my equity is good.) Or am I misunderstanding something? It always seemed to me that only pending orders may go down and up. Was I mistaken? If I knew it earlier, I would have started to raise or lower Sell and Buy orders in the direction I was interested in.) I believe the maximum fall of equity found during the test run may repeat itself in real trading; therefore I think it is correct to count it from the maximum.

 
Integer:

In general, maximum drawdown is not the difference between maximum and minimum equity. At the start, MaxEquity=Equity, MinEquity=Equity, Drawdown=0. If Equity>MaxEquity, we calculate drawdown as MaxEquity-MinEquity. If the obtained value is higher than the drawdown calculated earlier, we store the higher value and reset minimum - MinEquity=MaxEquity and store new maximum MaxEquity=Equity.
Could you please tweak the code I posted? Thank you.
 

Here's how it worked out for me:

double MaxEq;
double MaxDD;

void DD_Init(){ // Вызываем из init
   MaxEq=AccountEquity();
   MaxDD=0;
}

void DD_Start(){ // Вызываем из start


   if(!IsTesting()){
      return;
   }      
   if(AccountEquity()>MaxEq){
      MaxEq=AccountEquity();
   }
   else{
      MaxDD=MathMax(MaxEq,MaxEq-AccountEquity());
   }
}
void DD_Deinit(){ // Вызываем из deinit

      if(!IsTesting()){
         return;
   }      
   Print("Просадка: "+DoubleToStr(MaxDD,2));
}
 
khorosh:
Could you please tweak the code I posted? Thank you.


Didn't really get into it, but at first glance it seems fine, with a new maximum the minimum is reset...
 
Andrei01:
Why look for maximum drawdown? What does that tell you?


Indicates whether the deposit, in case of the most unfortunate circumstance (the EA starts at the moment shown by the green line), will be enough.

 
Integer:

I didn't get into it too much, but at first glance it looks fine, with a new maximum the minimum is reset...
Well, if it wasn't OnGoing, I wouldn't have doubted it, as the result calculated by my code matched the result in the tester.
 

pictures here https://www.mql5.com/ru/forum/136747/page696

Advisor opens only 1 trade at a certain time (and does not close it), check the maximum drawdown in the tester - test in visual mode:

1. not until the end of 3 February (press stop earlier)

2. by the end of 3 Feb

Files:
 
serferrer:

pictures here https://www.mql5.com/ru/forum/136747/page698

Advisor opens only 1 trade at a certain time (and does not close it), check the maximum drawdown in the tester - test in visual mode:

1. not until the end of 3 February (press stop earlier)

2. by the end of 3 Feb

The purpose of your post is to show how to calculate drawdown correctly or to show that the tester calculates drawdown incorrectly? Please give a detailed answer, don't be so laconic, not everyone here is a professional. Thanks for the tip. It only seems to me that your code, if included in the real EA, will determine the drawdown of one or more open trades from the moment of opening until the closing of these trades, but it will not search for the maximum drawdown of the whole time the EA is working. Or did I get it wrong? Can you criticize my code? Does it correctly perform its task of finding the maximal drawdown?
Reason: