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.
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.
Rename
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.
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.
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.
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:in your code and change it as required?
const bool useEMA = true;
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.
QUOTE:Yes, I have it already.
in your code and change it as required?
In fact I have code like this:
CODE:It works but I just don't feel like it.
const bool enableStrategyParameters = false; if (enableStrategyParameters ) { Param1 = CreateParameter("Param1"...); Param2 = CreateParameter("Param2"...); Param3 = CreateParameter("Param3"...); ... Param9 = CreateParameter("Param9"...); }
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).
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.
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...
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); }
Superticker Post #3...
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.
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.
Where did you find about AssignExplicitValues?
It looks like a solution for my problem.
It looks like a solution for my problem.
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!
I hope it helps!
Your Response
Post
Edit Post
Login is required