Writing a GetFitness args.MaxEquityDrawdownPercentages

Created at 22 Nov 2021, 03:59
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
TH

thecaffeinatedtrader

Joined 22.07.2020

Writing a GetFitness args.MaxEquityDrawdownPercentages
22 Nov 2021, 03:59


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! 


@thecaffeinatedtrader
Replies

amusleh
22 Nov 2021, 09:04 ( Updated at: 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.


@amusleh

thecaffeinatedtrader
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.


@thecaffeinatedtrader