Automation during optimization

Created at 03 May 2016, 15:25
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!
.I

.ics

Joined 10.03.2015

Automation during optimization
03 May 2016, 15:25


Hi Spotware,

I was wondering if it's possible to determine in your cBot if you're running in optimization mode?
And if so, is it possible to perform some automated actions like, if one cycle is finished and the results are positive, export the specific cycle parameters to a setitngs file and access the trade statistics to export the to another file?

If this is possible, could you please provide a small snippet of example code?

Thanks in advance.
 


@.ics
Replies

Spotware
03 May 2016, 16:58

Dear Trader,

Please have a look at the GetFitness method of the API Reference.

There is no method to export Optimization parameters according to any user specified preferences. We will consider providing such method in the future. Stay tuned. 

Additionally, you can post your ideas/suggestions to http://vote.spotware.com/


@Spotware

.ics
03 May 2016, 18:06

RE:

Spotware said:

Dear Trader,

Please have a look at the GetFitness method of the API Reference.

There is no method to export Optimization parameters according to any user specified preferences. We will consider providing such method in the future. Stay tuned. 

Additionally, you can post your ideas/suggestions to http://vote.spotware.com/

Thanks for your reply but the API documentation isn't providing much info.

GetFitness

Summary

Override this method to provide custom fitness value for Optimization

Syntax

protected virtual double GetFitness(GetFitnessArgs args)

Parameters

Name     Description

Is there maybe someone else who has experience with the GetFitness method?

Thanks in advance.


@.ics

solark
14 May 2016, 19:20

You override `GetFitness` if you want to use genetic optimization with a custom fitness metric. The `GetFitnessArgs` type provides some useful metrics for creating you're own score. For example if you only cared about your win ratio you could do:

 

        protected override double GetFitness(GetFitnessArgs args)
        {
            
            return args.WinningTrades / (args.WinningTrades + args.LosingTrades + 1);
        }

Though it's nice to get creative and combine rewards/rewards using various metrics to encourage/discourage certain features.

I think whats ultimately being suggested to answer your original question is that although you now have to create a custom fitness function you could also insert logic to check for your minimum stats (most of which are given in `GetFitnessArgs`) and then write the stats to a file as well as the parameters to another (accessible directly).


@solark