kazuna8
 ( 42.69% )
- ago
In Optimization tab, it is called as Optimization Parameters.
In Strategy Settings tab, it is called as Strategy Parameters.
In the code, they are the same parameters created by AddParameter().

These parameters would be separated so that you can set them separately.

For example:

I want to optimize SMA period, say period from 1 to 100.
This SMA period isn't necessary to be accessed from the strategy parameter.

I want to see the difference between SMA and EMA, so I make a strategy parameter named UseEMA and it is set to 1 if I want to use EMA instead of SMA.
This strategy parameter isn't necessary to be available for optimization.
1
1,077
Solved
9 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.94% )
- ago
#1
This is just too radical a change, and I don't see the benefit really. If you don't want to optimize a parameter simply disable it in the optimization list.
0
Best Answer
kazuna8
 ( 42.69% )
- ago
#2
On WL6 where I optimize 100+ symbols, it's so much hassle to disable it on each symbol. So my solution was to duplicate the code and enable optimization parameters in one code and enable strategy parameters in another. When I have to change the code (e.g. symbol parameters after the optimization), I have to maintain all the code sharing the same codebase.

By the way, due to the WL6's implementation, I ended up making 4 copies of code for each strategy. 4 copies are the real trading, the backtesting (with strategy parameters), the optimization (with optimization parameters) and the forward testing.

I wish I was able to have a single codebase to be used for all scenarios.
0
- ago
#3
QUOTE:
I want to see the difference between SMA and EMA, so I make a strategy parameter named UseEMA

So why not simply declare ...
CODE:
const bool useEMA = true;
in your code and change it as required?

Personally, I have thought about saving regression parameters as constants on disk and reading them off disk so the regression routines don't have to solve for the particular solution each time the stock is run. And .NET makes it easy to serialize C# datatypes so you can read and write them to disk easily. But one can do this saving now without making any changes to WL.

The only thing I use AddParmeter for is for parameters that must be optimized.
0
kazuna8
 ( 42.69% )
- ago
#4
QUOTE:
in your code and change it as required?
Yes, I have it already.

In fact I have code like this:
CODE:
const bool enableStrategyParameters = false; if (enableStrategyParameters ) { Param1 = CreateParameter("Param1"...); Param2 = CreateParameter("Param2"...); Param3 = CreateParameter("Param3"...); ... Param9 = CreateParameter("Param9"...); }
It works but I just don't feel like it.
I wish if I could control those UI from the code like Windows API so that all I have to manage is the code not the human operation (error prone).
1
- ago
#5
QUOTE:
I wish if I could control those UI from the code like Windows API

Well, you can do that of course, but you need to popup a new WPF controls window to operate your custom controls from. I've thought about doing that myself, but I haven't read the chapters about WPF in my C# book yet. But it's on my read-eventually list.

Once you've read the WPF chapters, you can start a new VS project and download https://github.com/LucidDion/WL7ExtensionDemos as starting material. Happy coding.

I like your solution above. Nicely done.
0
- ago
#6
I like Post #4 suggestion (kazuna); however I think you can make this simpler by using Parameter method AssignExplicitValues() to assign a single value.

By disabling a parameter what are you trying to accomplish? You only want the optimizer to use a single value (I assume your code uses the parameter somewhere). Specify only that value for AssignExplicitValues and the optimizer will only use the one value you specify. You'll still be able to use the parameter to set values manually to other values as this method only appears to limit the values the optimizer uses.

For example...
CODE:
   const int DEFAULT_PARAM_PERIOD = 10;    private Parameter _spPeriod;    public MyStrategy()    {       _spPeriod = AddParameter("Period", ParameterTypes.Int32, DEFAULT_PARAM_PERIOD, 5, 50, 5);       _spPeriod.AssignExplicitValues(DEFAULT_PARAM_PERIOD);    }
3
- ago
#7
Superticker Post #3...
QUOTE:
The only thing I use AddParmeter for is for parameters that must be optimized.

I agree with you; however, there are occasions when I have a parameter I use to modify indicators on the chart which I may not use in trading code.

For example I may want to have a variable EMA period where I can change the parameter to different values while watching the chart (easier to do with WL6 as parameters and chart were visible at the same time). I'd be looking to see if there is a EMA period where the security was pulling back to in the past for a better entry point. That parameter helps me, but is useless to optimize unless I change my trading code.
0
kazuna8
 ( 42.69% )
- ago
#8
Where did you find about AssignExplicitValues?
It looks like a solution for my problem.
0
- ago
#9
I may have seen it in one of Glitch's YouTube videos. I've been using it to limit the values an optimizer runs, but it occurred to me that setting it to a single value would accomplish what you were looking for.

I hope it helps!
0

Reply

Bookmark

Sort