fix
logo

"Lowest Margin Seen in %" as custom optimization criterion

Avatar
  • updated
  • Completed
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 !

Avatar
0
Andrey Khatimlianskyi
  • Planned (collecting votes)

Sure, this could be helpful!

Avatar
0
Andrey Khatimlianskyi
  • Started
Avatar
1
Andrey Khatimlianskyi
  • Completed

Will be available with the next update.

Avatar
0
tib

hi is it possible to add some other criterions for ONTESTER

Like: STAT_PROFIT_TRADES

thanks

Avatar
0
Andrey Khatimlianskyi
Quote from tib

hi is it possible to add some other criterions for ONTESTER

Like: STAT_PROFIT_TRADES

thanks

What exactly do you want to add?

Avatar
0
Andrey Khatimlianskyi
Quote from tib

hi is it possible to add some other criterions for ONTESTER

Like: STAT_PROFIT_TRADES

thanks

If the number of trades is important to you, you can use the Min trades per year parameter.

Avatar
0
tib

hi 


i want to find which optimization has the best winning trades rate here for exemple

Image 6359

in another ea, these options are also included, this helps to sort and choose which optimization is the best one for we want to use with

Image 6360

thanks if you can add 

Avatar
0
Andrey Khatimlianskyi
Quote from tib

hi 


i want to find which optimization has the best winning trades rate here for exemple

Image 6359

in another ea, these options are also included, this helps to sort and choose which optimization is the best one for we want to use with

Image 6360

thanks if you can add 

Is this just an example, or do you really want to optimize by % of winning trades, ignoring all other factors?

That doesn't seem like a reliable criterion, does it?

It's easy to add this criterion, but it's meaningless if no one will use it.

Avatar
0
tib

hi having several differents criterions will permit people to optimized specifically what they want, mainly if it's easy to add.


In my case, i want to find a system, when i disactivate martin, only one trade at time with TP ( or trailing), and no SL, let me manage a loss trade manually. So i need to find the best winning trade otpimization.

Avatar
0
Andrey Khatimlianskyi
Quote from tib

hi having several differents criterions will permit people to optimized specifically what they want, mainly if it's easy to add.


In my case, i want to find a system, when i disactivate martin, only one trade at time with TP ( or trailing), and no SL, let me manage a loss trade manually. So i need to find the best winning trade otpimization.

More options doesn't always mean better. If someone needs specific criteria, it can be added, as you can see here.

You'll have best winning ratio with smallest TP/TS, it is obvious.
What would you prefer: a 90% win-ratio with TP = 1 and SL 100, or a 55% win-ratio with TP=SL=50?

And what's the point of manual management? If you can manage a losing trade to make it profitable, just open both buy and sell at any time, close the profitable trade and manage the losing one.