Optimization (Beta version)

Created at 09 Sep 2014, 13:00
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!
Spotware's avatar

Spotware

Joined 23.09.2013

Optimization (Beta version)
09 Sep 2014, 13:00


Dear Traders,

We are glad to announce that beta version of Optimization is available in Spotware cAlgo. We decided to publish a beta version, because we believe that our community will provide a valuable feedback.

cAlgo advanced optimization functionality lets you find the optimal set of parameters for your cBot. Optimization runs multiple backtest procedures and compares their performance.

How to start Optimization

  1. Build your cBot

     
  2. Add an Instance
    |
     
  3. Click the Optimization tab

     
  4. Click the Parameters button and select parameters to be optimized

     
  5. Define your time period by using the dropdown menus or by dragging the slider
  6. Click Play

     

Optimization results

Optimization may take a long time to complete. You can see the remaining time estimate next to “Remaining time” label.

 

Optimization process runs backtesting multiple times. Once backtesting for specific set of parameters passed, new row is added to the Passes grid.

 

Passes grid contains the following columns:

  • Pass - number of pass in current Optimization session

  • Fitness - shows how well current pass fits the Optimization Criteria

  • Equity - value of equity at the end of backtesting

  • Balance - value of balance at the end of backtesting

  • Net Profit - the difference between ending balance and starting balance

  • Trades - amount of closed positions

  • Profit factor - total profit divided by total loss

  • Equity drawdown - the maximum amount of equity drawdown

  • Parameters - by pressing Apply button in the parameters column you can apply parameters of the pass to the current cBot instance

Bottom part of optimization window shows details of selected pass.

 

After you find a pass that shows desired performance, you can press Apply button next to it to apply parameters to current cBot instance.

Settings

All optimization settings are splitted to 5 groups:

  1. Backtesting Settings group allows to specify Starting Capital, Commission, Data mode settings

     
  2. cBot Parameters group provides an ability to select parameters to be optimized. For every selected parameter you must specify set of values to be used during optimization.

     
  3. Optimization Criteria group provides an ability to specify the criteria to be used during optimization. For every pass fitness value will be calculated based on selected criteria. Fitness value is used to compare backtesting results. The higher the value, the better.

     
  4. Optimization Method. Two options are available: Grid that simply backtests each possible set of parameters and Genetic Algorithm that finds the optimal parameters faster.

     
  5. Resources group provides an ability to allocate CPU resources for optimization. The more resources you allocate, the faster optimization will be done. CPU resources can be adjusted during optimization.

 


@Spotware
Replies

Elogos
09 Sep 2014, 18:40

I have been waiting for this for a while now.

My own libraries do exactly the same, however I will not longer need to macro the back-test button in cAlgo.


@Elogos

Spotware
12 Sep 2014, 11:58 ( Updated at: 21 Dec 2023, 09:20 )

Custom optimzation criterion has been added:

If Custom criterion is chosen you need to override GetFitness method in your cBot and provide a fitness values based on GetFitnessArgs. The higher fitness the value, the better.

Example 1:

protected override double GetFitness(GetFitnessArgs args)
{
        return args.WinningTrades / args.LosingTrades;//maximize count of winning trades and minimize count of losing trades
}

Example 2: 

protected override double GetFitness(GetFitnessArgs args)
{
        return Math.Pow(args.WinningTrades, 2) / args.LosingTrades;//count of winning trades is more important than count of losing trades
}

 


@Spotware

Researcher
12 Sep 2014, 22:09

Super-cool feature, now it's possible to trade with cAlgo :)


@Researcher

portocristo
15 Sep 2014, 10:23

The optimization process takes a lot of time in my computer. I'm going to get a new one. But I don't know what's better to look at in processor performance: more number of cores or higher frequency? 


@portocristo

Spotware
15 Sep 2014, 11:21 ( Updated at: 21 Dec 2023, 09:20 )

Number of cores is more important. Please also make sure that Resource slider is set to 100%:


@Spotware

mijo212
16 Sep 2014, 18:33

Hello Spotware,

it is possible to incorporate feature selection as the other versions ?

Example: broker (FxPro) does not allow test version for live accounts and thus we must have more cAlgo or cTrader platforms open at once.

thx Mijo.


@mijo212

Spotware
17 Sep 2014, 14:16

RE:

mijo212 said:

Hello Spotware,

it is possible to incorporate feature selection as the other versions ?

Example: broker (FxPro) does not allow test version for live accounts and thus we must have more cAlgo or cTrader platforms open at once.

thx Mijo.

While Optimization functionality is in beta stage, it is available for Spotware cAlgo only. We will release Optimization as soon as we decide that this feature is ready.


@Spotware

RV13
19 Sep 2014, 04:54

Small wordi

Dear Sportware,

Small suggestion for wording change in the new Beta optimizer (which looks great btw!)

GA selection box: Genetic Algorithm: "The emulation of the biological process of evolution"

Would suggest changing this to:

Genetic Algorithm: "The emulation of a biological development process"

To avoid reference to "evolution" - which by some can be read as "evolution theory", and this is for many people (including myself) an invalid theory.

Thanks!


@RV13

Spotware
19 Sep 2014, 10:18

RE: Small wordi

RV13 said:

Dear Sportware,

Small suggestion for wording change in the new Beta optimizer (which looks great btw!)

GA selection box: Genetic Algorithm: "The emulation of the biological process of evolution"

Would suggest changing this to:

Genetic Algorithm: "The emulation of a biological development process"

To avoid reference to "evolution" - which by some can be read as "evolution theory", and this is for many people (including myself) an invalid theory.

Thanks!

Thank you for your suggestion, we will consider it.


@Spotware

kricka
22 Sep 2014, 00:37

I have been testing this new feature of optimization. Wow! This gives us programmers a whole new spectrum to work with. We can streamline the cBot and make all the necessary changes in the parameters suited for the trading environment at hand. Good work Spotware! I would like one new edition though which I do not know if it is possible. To run more then one cBot at the time. For example, two cBots running through the optimization process together giving a mix of both cBots performances. That would be absolutely great if it is in the realm of doing so within cAlgo.


@kricka

Spotware
22 Sep 2014, 09:33

RE:

kricka said:

I have been testing this new feature of optimization. Wow! This gives us programmers a whole new spectrum to work with. We can streamline the cBot and make all the necessary changes in the parameters suited for the trading environment at hand. Good work Spotware! I would like one new edition though which I do not know if it is possible. To run more then one cBot at the time. For example, two cBots running through the optimization process together giving a mix of both cBots performances. That would be absolutely great if it is in the realm of doing so within cAlgo.

Thank you for your feedback. Currently it is not possible to optimize several cBots together. We plan to implement it in the future.


@Spotware

AlexanderRC
22 Sep 2014, 14:15

RE:

Here are some points which are not covered for me in the current iteration of the optimizer.

  1. Ability to specify which parameters are ignored if some other parameter is set to a specific value to exclude runs with logically identical parameters.
  2. Specify some internal parameters of genetic algorithm such as size of initial population, whether crossover and/or mutations are used. Criteria for convergence to optimum fitness value, etc.
  3. Ability to specify some bias towards mutations/crossings in some parameters against the others. For example, it may be wise to try more values for fixed take profit parameter than for the parameter specifying the number of periods in the moving average indicator.
  4. Equity and balance drawdowns in absolute values and all sorts of derived metrics based on those. For example, I do not optimize entry volume as it is chosen after optimization to keep the expected drawdown at a certain value and that calculation depends on the initial balance and optimized drawdown in absolute currency value.
  5. Ability to specify swaps (including copying current values from the server).
  6. Ability to spread the work across remote agents running on separate computers (with uploading bar/tick data to the agent and some external data like times when the news were released).

@AlexanderRC

Spotware
22 Sep 2014, 14:28

RE: RE:

AlexanderRC, thank you for your feedback.

  • Ability to specify which parameters are ignored if some other parameter is set to a specific value to exclude runs with logically identical parameters.

You can check parameters in OnStart method and stop cBot if needed.

  • Specify some internal parameters of genetic algorithm such as size of initial population, whether crossover and/or mutations are used. Criteria for convergence to optimum fitness value, etc.

We plan to expose such parameters in the future.

  • Equity and balance drawdowns in absolute values and all sorts of derived metrics based on those. For example, I do not optimize entry volume as it is chosen after optimization to keep the expected drawdown at a certain value and that calculation depends on the initial balance and optimized drawdown in absolute currency value.

It will be available with next update.

  • Ability to specify swaps (including copying current values from the server).

We plan to support swaps in the future.

  • Ability to specify some bias towards mutations/crossings in some parameters against the others. For example, it may be wise to try more values for fixed take profit parameter than for the parameter specifying the number of periods in the moving average indicator.
  • Ability to spread the work across remote agents running on separate computers (with uploading bar/tick data to the agent and some external data like times when the news were released).

We will consider these ideas.


@Spotware

portocristo
23 Sep 2014, 00:53 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Spotware said:

Number of cores is more important. Please also make sure that Resource slider is set to 100%:

Hi

I make an optimization with tick-data (from 24-1-14 to 20-9-14). It has one million combinations and I do an exhaustive search. It takes 2000 days. Is it normal or too slow? Can you tell me if this can be reduced with a faster processor?

I use an Intel Core 2 Duo 2.26 GHz.


@portocristo

Spotware
23 Sep 2014, 09:28

The exhaustive search simply backtests each possible set of parameters. It could take a lot of time to perform exhaustive optimization if there are many combinations.

Of course you can speed up optimization process by upgrading your PC, but if it takes 2000 days now, you need 1000x more processors to perform exhaustive search in 2 days.

We can recommend you to reduce parameters count or use Genetic Algorithm.

 


@Spotware

Paulo_Lira
23 Sep 2014, 13:13

guys!! i have to give my congratulations because this is incredible.... i will start working in it to give you my feedback.... but i think you can paste in next update...it´s so fine!


@Paulo_Lira

AlexanderRC
23 Sep 2014, 13:20

RE: RE: RE:

Spotware said:

  • Ability to specify which parameters are ignored if some other parameter is set to a specific value to exclude runs with logically identical parameter

You can check parameters in OnStart method and stop cBot if needed. 

That will require the cBot to store already tried logical combinations in some "external" store and abandon the run if the new set of parameters matches the one already computed.

Another approach would be to use combined values on a larger scale for the current genetic algorithm to work more efficiently. Consider the following example. There are 3 parameters, A, B and C. A can have values of 0 and 1. If A is 0, B parameter is used. If A parameter is set to 1, C parameter is used. B can have values between 0 and 120, C between 0 and 100. Instead, I can use combined parameter D which would have values from -121 to 100. -121 to -1 values of parameter D would be mapped to values 0 to 120 of parameter B and values of 0 to 100 of parameter D to values 0 to 100 of parameter C.

But both approaches would require deliberate changes to cBots.

For now I will stick to my own library.


@AlexanderRC

Spotware
23 Sep 2014, 14:32

RE: RE: RE: RE:

AlexanderRC said:

Spotware said:

  • Ability to specify which parameters are ignored if some other parameter is set to a specific value to exclude runs with logically identical parameter

You can check parameters in OnStart method and stop cBot if needed. 

That will require the cBot to store already tried logical combinations in some "external" store and abandon the run if the new set of parameters matches the one already computed.

Another approach would be to use combined values on a larger scale for the current genetic algorithm to work more efficiently. Consider the following example. There are 3 parameters, A, B and C. A can have values of 0 and 1. If A is 0, B parameter is used. If A parameter is set to 1, C parameter is used. B can have values between 0 and 120, C between 0 and 100. Instead, I can use combined parameter D which would have values from -121 to 100. -121 to -1 values of parameter D would be mapped to values 0 to 120 of parameter B and values of 0 to 100 of parameter D to values 0 to 100 of parameter C.

But both approaches would require deliberate changes to cBots.

For now I will stick to my own library.

Thank you for your suggestion, we will consider it.


@Spotware

kricka
23 Sep 2014, 19:11

Hi AlexanderRC,

I have been reading and following your posts on the forums. Thanks for all your valuable contributions to the community!


@kricka

Paulo_Lira
23 Sep 2014, 20:50

parameters been apply not working in a normal backtesting

when you get optimization parameters , you press apply and make a backtesting with that parameters, results are not same from optimization results... i veryfy sames dates and info...


@Paulo_Lira

Spotware
24 Sep 2014, 09:08

RE: parameters been apply not working in a normal backtesting

Paulo_Lira said:

when you get optimization parameters , you press apply and make a backtesting with that parameters, results are not same from optimization results... i veryfy sames dates and info...

Do you optimize the time frame? If so, it is a known issue, it will be fixed with next update.


@Spotware

jagtrading
01 Oct 2014, 01:45

When will this be available on fxpro??? Should I switch to spotware to use it???? Is it still in beta stages or is it ready to use??
 

thanks for replies.


@jagtrading

Spotware
02 Oct 2014, 10:33

RE:

jagtrading said:

When will this be available on fxpro??? Should I switch to spotware to use it???? Is it still in beta stages or is it ready to use??
 

thanks for replies.

It is ready to use. We plan to delivery it to all brokers next week.


@Spotware

cbellew
02 Oct 2014, 16:00

Great job Spotware! The genetic algorithm is great, really clever stuff. I have a single request. 

Can we ask the optimizer to try all 28 of the major symbols and tell us what the ideal parameters are for all pairs combined? I want to avoid tuning a bot to an individual symbol. Currently I will have to run the optimizer 28 times and exhaustively compare the results.

Thanks again.


@cbellew

Spotware
02 Oct 2014, 16:11

RE:

cbellew said:

Great job Spotware! The genetic algorithm is great, really clever stuff. I have a single request. 

Can we ask the optimizer to try all 28 of the major symbols and tell us what the ideal parameters are for all pairs combined? I want to avoid tuning a bot to an individual symbol. Currently I will have to run the optimizer 28 times and exhaustively compare the results.

Thanks again.

Do you want to find the Symbol that shows the best results?


@Spotware

cbellew
03 Oct 2014, 16:04

RE: RE:

Spotware said:

cbellew said:

Great job Spotware! The genetic algorithm is great, really clever stuff. I have a single request. 

Can we ask the optimizer to try all 28 of the major symbols and tell us what the ideal parameters are for all pairs combined? I want to avoid tuning a bot to an individual symbol. Currently I will have to run the optimizer 28 times and exhaustively compare the results.

Thanks again.

Do you want to find the Symbol that shows the best results?

Yes, but not just that. More importantly I want to run the same settings on multiple symbols at once in the optimizer.

I want to create a bot and have a single set of parameters that I can run on 28 of the major pairs. Some pairs will lose money, some will win, but on average those settings will make a profit.


@cbellew

AlexanderRC
10 Oct 2014, 14:04

Another quick feature to add would be to show max equity and balance draw down in absolute values in Trade Statistics tab in Optimization and Backtesting sections. There are columns for that in optimization results, so adding them to Trade Statistics should be pretty trivial.


@AlexanderRC

bellong
19 Oct 2014, 16:29

Great news to make it available; this is a huge step forward really.

But i'm wondering about the actual possibilities of cAlgo/cTrader to use the modern hardware: cpu/gpu which have each one a huge amount of threads

Does they understand opencl/cuda ?  That should open the door of 'fuzzy' logic coding (aka using a set of parameters (range) vs unique parameter as usual), so an inline optimization where the user have set the limits.

 

Thanks again for the new features and future targets.


@bellong

bellong
19 Oct 2014, 16:30

RE:

bellong said:

Great news to make it available; this is a huge step forward really.

But i'm wondering about the actual possibilities of cAlgo/cTrader to use the modern hardware: cpu/gpu which have each one a huge amount of threads

Does they understand opencl/cuda  (builtin API)?  That should open the door of 'fuzzy' logic coding (aka using a set of parameters (range) vs unique parameter as usual), so an inline optimization where the user have set the limits.

 

Thanks again for the new features and future targets.

 


@bellong

asdk
19 Oct 2014, 18:19

save optimization results

how can i save the optimization results?

same for backtest results, is there a way to export the report (html, csv, xml, whatever) so that i can refer back to it next time?


@asdk

galafrin
19 Oct 2014, 20:56 ( Updated at: 21 Dec 2023, 09:20 )

Genetic algorythm uses to reduce drasticaly the number of passes, but in this optimizing it seems not that has happened-

It took 1 h 5 m for a Bar expert optimization of 3 month H1 and 765 passes  browsing all the passes posibles, that is brute force in place of GA , while I expected  around 200 passes and 15mn max execution, based on other optimizer. The result  seems correct.


@galafrin

galafrin
19 Oct 2014, 21:48 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Here are the snapshots

 

 

 

 

 


@galafrin

galafrin
19 Oct 2014, 21:50 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

here are the snapshot of the parameters


@galafrin

Spotware
20 Oct 2014, 10:34

RE:

bellong said:

Great news to make it available; this is a huge step forward really.

But i'm wondering about the actual possibilities of cAlgo/cTrader to use the modern hardware: cpu/gpu which have each one a huge amount of threads

Does they understand opencl/cuda ?  That should open the door of 'fuzzy' logic coding (aka using a set of parameters (range) vs unique parameter as usual), so an inline optimization where the user have set the limits.

 

Thanks again for the new features and future targets.

You can adjust number of CPU cores used for optimization: http://help.spotware.com/calgo/cbots/optimization#resources

That resource slider changes number of threads used for optimization. 100% value means that number of threads will be the same as number of cores.


@Spotware

Spotware
20 Oct 2014, 10:35

RE: save optimization results

asdk said:

how can i save the optimization results?

same for backtest results, is there a way to export the report (html, csv, xml, whatever) so that i can refer back to it next time?

It is not possible at the moment. We plan to provide such functionality in the future.


@Spotware

Spotware
20 Oct 2014, 10:48

Genetic algorythm uses to reduce drasticaly the number of passes, but in this optimizing it seems not that has happened-

It took 1 h 5 m for a Bar expert optimization of 3 month H1 and 765 passes  browsing all the passes posibles, that is brute force in place of GA , while I expected  around 200 passes and 15mn max execution, based on other optimizer. The result  seems correct.

Genetic Algorithms (GA) could vary between different applications. We plan to expose GA parameters such as: population size, minimal iterations count, stagnation period, etc. After that you will be able to tune GA to be faster.

For "Bar expert" optimization you can try m5 (open prices) data mode. It should speed-up optimization process.

 


@Spotware

galafrin
20 Oct 2014, 20:21

RE:

Spotware said:

Genetic algorythm uses to reduce drasticaly the number of passes, but in this optimizing it seems not that has happened-

It took 1 h 5 m for a Bar expert optimization of 3 month H1 and 765 passes  browsing all the passes posibles, that is brute force in place of GA , while I expected  around 200 passes and 15mn max execution, based on other optimizer. The result  seems correct.

Genetic Algorithms (GA) could vary between different applications. We plan to expose GA parameters such as: population size, minimal iterations count, stagnation period, etc. After that you will be able to tune GA to be faster.

For "Bar expert" optimization you can try m5 (open prices) data mode. It should speed-up optimization process.

 

Indeed, by default the data mode is set to tick data  so it looks like the optimizer worked with ticks even though on H1 bar expert. Anyway the elapsed time has fallen to  48 s , for exhaustive parameter browsing, much less than expected.


@galafrin

galafrin
20 Oct 2014, 23:58

RE: RE:

galafrin said:

Spotware said:

Genetic algorythm uses to reduce drasticaly the number of passes, but in this optimizing it seems not that has happened-

It took 1 h 5 m for a Bar expert optimization of 3 month H1 and 765 passes  browsing all the passes posibles, that is brute force in place of GA , while I expected  around 200 passes and 15mn max execution, based on other optimizer. The result  seems correct.

Genetic Algorithms (GA) could vary between different applications. We plan to expose GA parameters such as: population size, minimal iterations count, stagnation period, etc. After that you will be able to tune GA to be faster.

For "Bar expert" optimization you can try m5 (open prices) data mode. It should speed-up optimization process.

 

Indeed, by default the data mode is set to tick data  so it looks like the optimizer worked with ticks even though on H1 bar expert. Anyway the elapsed time has fallen to  48 s , for exhaustive parameter browsing, much less than expected.

And it does reduces passes a lot in some configurations  from  about 350 times , specially when the parameter range is big it seems.


@galafrin

oktrader
23 Oct 2014, 09:40

RE: RE:

Spotware said:

You can adjust number of CPU cores used for optimization: http://help.spotware.com/calgo/cbots/optimization#resources

That resource slider changes number of threads used for optimization. 100% value means that number of threads will be the same as number of cores.

 

Is cAlgo able to use HyperThreading technology? For example, like in this Intel Core i7-5820K. Or the resource slider just recognize physical cores?


@oktrader

Spotware
23 Oct 2014, 12:22

RE: RE: RE:

oktrader said:

Spotware said:

You can adjust number of CPU cores used for optimization: http://help.spotware.com/calgo/cbots/optimization#resources

That resource slider changes number of threads used for optimization. 100% value means that number of threads will be the same as number of cores.

 

Is cAlgo able to use HyperThreading technology? For example, like in this Intel Core i7-5820K. Or the resource slider just recognize physical cores?

It uses logical cores as well. You can note that resource slider allows you to change resources by fixed step. Number of steps is the number of cores.


@Spotware

cAlgoFx
03 Nov 2014, 13:48

This is a game changer.Good job.


@cAlgoFx

alifarooq
11 Nov 2014, 09:50

RE: RE: RE: RE:

Any plans for cuda or opencl support in near future?

Spotware said:

oktrader said:

Spotware said:

You can adjust number of CPU cores used for optimization: http://help.spotware.com/calgo/cbots/optimization#resources

That resource slider changes number of threads used for optimization. 100% value means that number of threads will be the same as number of cores.

 

Is cAlgo able to use HyperThreading technology? For example, like in this Intel Core i7-5820K. Or the resource slider just recognize physical cores?

It uses logical cores as well. You can note that resource slider allows you to change resources by fixed step. Number of steps is the number of cores.

 


@alifarooq

Spotware
11 Nov 2014, 10:00

Any plans for cuda or opencl support in near future?

No, we do not plan to support it in near future.


@Spotware

oktrader
16 Dec 2014, 12:08

RE: RE: RE: RE:

Spotware said:

It uses logical cores as well. You can note that resource slider allows you to change resources by fixed step. Number of steps is the number of cores.

And what is the maximum number of cores that can be used in cAlgo Optimization?

I ask that because I have recently tried an Intel xeon E5-2680 v2 with 32 Threads, and these are the results:

(1 year data [1-12-13/30-11-14] - 1m bars from server - Grid method- 700 combinations)

Elapsed time (32cores): 8min 54s

Elapsed time (16cores): 7min 51s

Elapsed time (8cores): 8min 7s

Elapsed time (4cores): 11min 55s

Elapsed time (2cores): 20min 39s

 

It seems that more cores doesn't mean less time, at least when you pass the 4 cores line.


@oktrader

Spotware
17 Dec 2014, 10:23

And what is the maximum number of cores that can be used in cAlgo Optimization?

If you specify 100% in Resources settings, cAlgo will use all available cores. 

It seems that more cores doesn't mean less time, at least when you pass the 4 cores line.

Probably the bottle-neck is not CPU in your case. We can recommend you to check disk, network and memory loads.


@Spotware

oktrader
17 Dec 2014, 13:00

RE:

Spotware said:

Probably the bottle-neck is not CPU in your case. We can recommend you to check disk, network and memory loads.

I'm using one of the latest instances of Amazon Elastic Cloud. It has 60 GB of memory and SSD.

What else could it be?


@oktrader

Spotware
18 Dec 2014, 12:14

RE: RE:

oktrader said:

Spotware said:

Probably the bottle-neck is not CPU in your case. We can recommend you to check disk, network and memory loads.

I'm using one of the latest instances of Amazon Elastic Cloud. It has 60 GB of memory and SSD.

What else could it be?

We still recommend you to check disk load, network load and memory load.


@Spotware

tekASH
25 Dec 2014, 21:48

Admin

On the Back-testing basic Settings, on commission per million- do we enter value for round trade (total enter and close commissions) or one way?

my broker 1 mln commission is 60 USD round trip - should I enter this?


@tekASH

Spotware
31 Dec 2014, 11:25

Admin

On the Back-testing basic Settings, on commission per million- do we enter value for round trade (total enter and close commissions) or one way?

my broker 1 mln commission is 60 USD round trip - should I enter this?

In backtesting settings commissions are for one way.


@Spotware

tekASH
03 Jan 2015, 17:30

RE:

Spotware said:

Admin

On the Back-testing basic Settings, on commission per million- do we enter value for round trade (total enter and close commissions) or one way?

my broker 1 mln commission is 60 USD round trip - should I enter this?

In backtesting settings commissions are for one way.

can you elaborate why?. because logically a conrete trade is comprised of open and close which makes two ways.


@tekASH

Spotware
08 Jan 2015, 10:46

can you elaborate why?. because logically a conrete trade is comprised of open and close which makes two ways.

Commissions are taken per trade. When you open position you trade, when you close position you do another trade.


@Spotware

davidp13
19 Jan 2015, 10:03 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Spotware said:

Custom optimzation criterion has been added:

If Custom criterion is chosen you need to override GetFitness method in your cBot and provide a fitness values based on GetFitnessArgs. The higher fitness the value, the better.

Example 1:

protected override double GetFitness(GetFitnessArgs args)
{
        return args.WinningTrades / args.LosingTrades;//maximize count of winning trades and minimize count of losing trades
}

Example 2: 

protected override double GetFitness(GetFitnessArgs args)
{
        return Math.Pow(args.WinningTrades, 2) / args.LosingTrades;//count of winning trades is more important than count of losing trades
}

 

Hi. This is a very cool function and I would like to specify my own customer criteria. You do have the standard criteria to minimize Equity Drawdown, but I would like to specify the Max drawdown allowed. For example I want all outcomes for an equity drawdown of larger than 25% to be excluded in the results. Can you please help me with this?

Thank you in advance.


@davidp13

cjdduarte
20 Jan 2015, 20:33

RE: RE:

This option will be available in the future?

 

Spotware said:

cbellew said:

Do you want to find the Symbol that shows the best results?

 


@cjdduarte

davidp13
21 Jan 2015, 09:18 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

Hi, any comment or suggestion on the question below? Thanks

davidp13 said:

Spotware said:

Custom optimzation criterion has been added:

If Custom criterion is chosen you need to override GetFitness method in your cBot and provide a fitness values based on GetFitnessArgs. The higher fitness the value, the better.

Example 1:

protected override double GetFitness(GetFitnessArgs args)
{
        return args.WinningTrades / args.LosingTrades;//maximize count of winning trades and minimize count of losing trades
}

Example 2: 

protected override double GetFitness(GetFitnessArgs args)
{
        return Math.Pow(args.WinningTrades, 2) / args.LosingTrades;//count of winning trades is more important than count of losing trades
}

 

Hi. This is a very cool function and I would like to specify my own customer criteria. You do have the standard criteria to minimize Equity Drawdown, but I would like to specify the Max drawdown allowed. For example I want all outcomes for an equity drawdown of larger than 25% to be excluded in the results. Can you please help me with this?

Thank you in advance.

 


@davidp13

AlexanderRC
23 Jan 2015, 15:14

Sorting parameters which cannot be optimized under all others is a bad idea, it breaks a logical layout of parameters. For instance, unused string based parameters can be used as visual separators. Also, other types like TimeFrames and DataSeries also get below all others and become logically ungrouped from siblings.


@AlexanderRC

peeppalts
30 Jan 2015, 13:57

Hi!

How can I save optimisation results?

Parameters, trade statistics, history?

With regards,

Peep Palts


@peeppalts

AlexanderRC
30 Jan 2015, 14:08

RE:

3041865 said:

How can I save optimisation results?

Parameters, trade statistics, history?

For individual optimization run:
Parameters: Click on Parameters tab and then click Save Parameters at the right.
Trade Statistics: currently not possible to export.
History: Click on History tab, then right click on history results and then click Export to Excel.

It is not currently possible to save all (or say, top 10) results at once.

Try Spotware demo, there were some enhancements on Balance Chart in the way equity min/max are displayed which I really like.


@AlexanderRC

peeppalts
30 Jan 2015, 16:22

RE: RE:

Thank you!

It works.

P.

AlexanderRC said:

3041865 said:

How can I save optimisation results?

Parameters, trade statistics, history?

For individual optimization run:
Parameters: Click on Parameters tab and then click Save Parameters at the right.
Trade Statistics: currently not possible to export.
History: Click on History tab, then right click on history results and then click Export to Excel.

It is not currently possible to save all (or say, top 10) results at once.

Try Spotware demo, there were some enhancements on Balance Chart in the way equity min/max are displayed which I really like.

 


@peeppalts

cjdduarte
26 Feb 2015, 13:40 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE: RE:

If you put an IF condition to your criteria and it returns 1 if true and 0 if false and put it as a multiplying factor, should work.

davidp13 said:

Hi, any comment or suggestion on the question below? Thanks

davidp13 said:

Spotware said:

Custom optimzation criterion has been added:

If Custom criterion is chosen you need to override GetFitness method in your cBot and provide a fitness values based on GetFitnessArgs. The higher fitness the value, the better.

Example 1:

protected override double GetFitness(GetFitnessArgs args)
{
        return args.WinningTrades / args.LosingTrades;//maximize count of winning trades and minimize count of losing trades
}

Example 2: 

protected override double GetFitness(GetFitnessArgs args)
{
        return Math.Pow(args.WinningTrades, 2) / args.LosingTrades;//count of winning trades is more important than count of losing trades
}

 

Hi. This is a very cool function and I would like to specify my own customer criteria. You do have the standard criteria to minimize Equity Drawdown, but I would like to specify the Max drawdown allowed. For example I want all outcomes for an equity drawdown of larger than 25% to be excluded in the results. Can you please help me with this?

Thank you in advance.

 

 


@cjdduarte

aharonzbaida
07 Aug 2015, 12:30

RE:

Spotware said:

Genetic algorythm uses to reduce drasticaly the number of passes, but in this optimizing it seems not that has happened-

It took 1 h 5 m for a Bar expert optimization of 3 month H1 and 765 passes  browsing all the passes posibles, that is brute force in place of GA , while I expected  around 200 passes and 15mn max execution, based on other optimizer. The result  seems correct.

Genetic Algorithms (GA) could vary between different applications. We plan to expose GA parameters such as: population size, minimal iterations count, stagnation period, etc. After that you will be able to tune GA to be faster.

For "Bar expert" optimization you can try m5 (open prices) data mode. It should speed-up optimization process.

 

08/2015 Anything new in regards to saving optimization results? Important research aid.

 


@aharonzbaida

ironmine
16 Oct 2015, 13:01

I have a question about Max Equity Drawdown (%) vs. Fair Stop Out in cTrader (which is 50% for my account).

Do I understand it correctly that if Trade Statistics after backtesting a cBot show that Max Equity Drawndown is 55%, it means that if I were running this cBot in live account, I would be stopped out?

Thanks!


@ironmine

Spotware
20 Oct 2015, 19:33

Dear Trader,

Max Equity Drawdown:

Is the largest single drop from peak to bottom of your equity, where Equity = Balance + Unrealized Net Profit - Unrealized Net Loss + Bonus.

Fair Stop Out:

Once the Margin level is less than the Fair Stop out the fair top-out algorithm will close positions in descending order of margin used until the margin level is greater than fair stop out, so that as each position is closed, traders have a better chance at securing what they can from their remaining deals.

Therefore, in your case Max Equity Drawdown could be bigger than 50% without being stopped out.


@Spotware

alvaroreyes1011
01 Dec 2016, 03:05

Optimization

Hi Spotware,

I cant understand why when i do an optimization process with a cBot, each time the parameters are differents...

Why this is happening? 


@alvaroreyes1011

fermjy
24 May 2019, 04:54

Hi cTraders.

I was wondering if you were able to provide the entire Fitness function by default that you normaly use at the Optimization.

Thanks for your time.


@fermjy