ITComplex
- librerie
- Versione: 1.0
- Attivazioni: 10
Need to calculate the MT5 Complex Criterion outside the Strategy Tester, for example, for Expert Advisor auto-optimization? ITComplex is exactly what you need! No more, no less.
The ITComplex library provides a calculation of the Complex Criterion that is as close as possible to the one built into MT5.
To use the library, include the following snippet at the beginning of your code:
#import "ITComplex.ex5" double GetComplex(double profit, int trades, int profitTrades, double profitFactor, double drawdownPercent, double recoveryFactor, double expectedPayoff, double sharpeRatio); #import
Usage example. To verify that the calculation matches the built-in Complex Criterion, insert the following code into your EA:
double OnTester() { double compl = GetComplex(TesterStatistics(STAT_PROFIT), (int)TesterStatistics(STAT_TRADES), (int)TesterStatistics(STAT_PROFIT_TRADES), TesterStatistics(STAT_PROFIT_FACTOR), TesterStatistics(STAT_EQUITYDD_PERCENT), TesterStatistics(STAT_RECOVERY_FACTOR), TesterStatistics(STAT_EXPECTED_PAYOFF), TesterStatistics(STAT_SHARPE_RATIO)); return MathAbs(compl - TesterStatistics(STAT_COMPLEX_CRITERION)); }
Next, run optimization using the Custom max criterion. The Result column should contain all zeros.
