# calc. of MaxDD ?

6670
2014.04.07 10:46

Hi,

does anybody know how the MT4 calculates the maxDD as I see a difference between Drawdown \$ of the Optimization and the 'Maximal Drawdown of the back-test result (both 309 \$)?

My set: I select one result of an optimization process (DD = 309 \$) and made a backtest so that at its end the line in OnTester() is printed.

My calculation:

```double maxBalance, currPrft, iniBalance, maxDD;
// set at OnInit(){..}
void MyTester(){
maxBalance = MathMax(maxBalance,AccountBalance());
currPrft   = AccountBalance() - iniBalance;
maxDD = MathMax(maxDD,maxBalance - AccountBalance());
}

double OnTester()  {
//---
//Print(idEA,"  Sharp Ratio: ",DoubleToStr( TesterStatistics(STAT_SHARPE_RATIO),5)); // not implemented :(
MyTester();
Print("OnTester iniBal: ",DoubleToStr(TesterStatistics(STAT_INITIAL_DEPOSIT),3),
"  Prof: ",DoubleToStr(currPrft,3),"  OnT-Prof: ",DoubleToStr(TesterStatistics(STAT_PROFIT),3),
"  maxDD: ",DoubleToStr(maxDD,3),"  OnT-maxDD: ",DoubleToStr(TesterStatistics(STAT_BALANCE_DD),3),
"  recoF: ",DoubleToStr(currPrft/maxDD,8),"  OnT-recoF: ",DoubleToStr(TesterStatistics(STAT_RECOVERY_FACTOR),3)
);
}```

writes 181 \$ the same amount as TesterStatistics(STAT_BALANCE_DD)?

STAT_BALANCE_DD is described as:

```"Maximum balance drawdown in monetary terms.
In the process of trading, a balance may have
numerous drawdowns; here the largest value is taken"
```

From where are the 309 \$ how is it calculated?

Gooly