Optimization Toggle
Author: gbullr
Creation Date: 3/27/2012 2:33 PM
profile picture

gbullr

#1
I am trying to create a toggle switch to be used in optimizations. The idea is to test different exit/entry based systems and run them through an optimization w/ o having to compile a different code each time. So for example:


toggle = CreateParameter("toggle",0,0,1,1 )
toggle2 = CreateParameter("toggle2",0,0,1,1 )


so if toggle.ValueInt == 1
you run some code

and if toggle2.ValuInt == 1 while toggle.ValueInt == 0
you run some other code

and if code segment has optimizable parameters it only get optimized when that particular toggle is activated.

profile picture

Eugene

#2
Yep, that's a popular design pattern. What's your question?
profile picture

gbullr

#3
Can you point me to a sample?
Thanks

profile picture

Eugene

#4
A sample of what? You already know how to do it, judging by the code lines. The only missing piece is an if{ ... } else { ... } filled with your trading system rules. It's C# 101.
profile picture

gbullr

#5
The part that is missing is to get the optimizer to NOT run though variables in a toggle zeroed out.

So if toggle1 == 0 but it contains a ShortAtLimit(bar+1,limit.ValueInt,"SAL") I don't want the optimizer to cycle through the limit.ValueInt variable. I know the results will be zero but the optimizer cycles through and "wastes" time.

Thanks.

profile picture

Eugene

#6
You can't influence the optimizer from a Strategy. There are other ways to speed it up (a more coarse optimization step, Monte Carlo and Genetic optimizers, a faster CPU...)
profile picture

gbullr

#7
Thank you.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).