"Lowest Margin Seen in %" as custom optimization criterion
When I optimize my EAs, I tend to use the "Lowest Margin Seen in %" as an optimization criterion, as the drawdown does not always reflect how close the setting is from blowing up the account (margin call).
Could you add an extra value in the DropDown menu, and the following piece of code (or similar) to allow exporting the "Lowest Margin Seen in %" during the backtest as the OnTester return value?
cp-margin-level-min.png
During the backtests, MT4/MT5 store this information in the variable "TesterStatistics(STAT_MIN_MARGINLEVEL)", see readme here
So that's an example of code that I use in my EAs:
=====
double OnTester() {
<...> // existing code
else if (InpEquityRecorderType == 2) // or any other enum integer that would match the value in the dropdown menu
return (TesterStatistics(STAT_MIN_MARGINLEVEL));
}
}
=====
Thanks !
Could you add an extra value in the DropDown menu, and the following piece of code (or similar) to allow exporting the "Lowest Margin Seen in %" during the backtest as the OnTester return value?
cp-margin-level-min.png
During the backtests, MT4/MT5 store this information in the variable "TesterStatistics(STAT_MIN_MARGINLEVEL)", see readme here
So that's an example of code that I use in my EAs:
=====
double OnTester() {
<...> // existing code
else if (InpEquityRecorderType == 2) // or any other enum integer that would match the value in the dropdown menu
return (TesterStatistics(STAT_MIN_MARGINLEVEL));
}
}
=====
Thanks !
Will be available with the next update.