Writing a GetFitness args.MaxEquityDrawdownPercentages

thecaffeinatedtrader since: 22 Jul 2020;

  22 Nov 2021, 05:27
Writing a GetFitness args.MaxEquityDrawdownPercentages

Hi all, 

I'm a little confused on how to properly write the GetFitness arg for MaxEquityDrawdownPercentages 

I'm trying to have it optimize and return results below a set percentage amount.

for example...

I would like it only return results within optimization of anything less than 10% equity drawdown. Then after that be able to look to maximize net profits, winning trades, etc. 

I don't know if this would be the best way to optimize for it or to actually build it within parameters and return the result that way.... 

if anyone knows how this could be done it would be greatly appreciated if you could share your knowledge! 

amusleh's avatar

amusleh since: 01 Mar 2021;

  22 Nov 2021, 09:08

Hi,

You can only set one fitness parameter not multiple, if you want to use MaxEquityDrawdownPercentages then you can't use win rate or net profit.

You can try to combine them and come up with a new metric for GetFitness, for example you can do something like this:

protected override double GetFitness(GetFitnessArgs args)
{
	// Here it adds the amount of remained equity percentage to win rate
    return 100 - args.MaxEquityDrawdownPercentages + (args.WinningTrades / args.TotalTrades);
}

So if MaxEquityDrawdownPercentages is 65% it will add the 35 to win rate and use this metric as your fitness.

You can add more parameters to the calculation of fitness if you want to and come up with something that covers multiple aspects of your result not just one single parameter.

If you use the optimizer standard criteria then you can set there to minimize MaxEquityDrawdownPercentages and maximize wining trades and net profit.

Community Developer | Spotware | Telegram: @algodeveloper

thecaffeinatedtrader since: 22 Jul 2020;

  23 Nov 2021, 01:34
RE:

amusleh said:

Hi,

You can only set one fitness parameter not multiple, if you want to use MaxEquityDrawdownPercentages then you can't use win rate or net profit.

You can try to combine them and come up with a new metric for GetFitness, for example you can do something like this:

protected override double GetFitness(GetFitnessArgs args)
{
	// Here it adds the amount of remained equity percentage to win rate
    return 100 - args.MaxEquityDrawdownPercentages + (args.WinningTrades / args.TotalTrades);
}

So if MaxEquityDrawdownPercentages is 65% it will add the 35 to win rate and use this metric as your fitness.

You can add more parameters to the calculation of fitness if you want to and come up with something that covers multiple aspects of your result not just one single parameter.

If you use the optimizer standard criteria then you can set there to minimize MaxEquityDrawdownPercentages and maximize wining trades and net profit.

Awesome, that is very helpful! I did not know they needed to be all in one single formula. Thank you.