Strategy Parameters Q&A
Author: algtrader
Creation Date: 6/2/2009 6:02 AM
profile picture

algtrader

#1
1. Is there a way to expand the Strategy Parameters panel? I'm using 10 (and growing), and I'd like for all them to show up on the left side of my screen. That would be so convenient.

2. Is there a way to dynamically change the current .Value member of a parameter, and have the new value reflected in the Strategy Parameters panel?

3. Why do StrategyParameters have to be instantiated in the strategy class default constructor?
ie...
CODE:
Please log in to see this code.


4. It's apparent that the StrategyParameters are instantiated immediately after compilation, before any strategies are run as evidenced by the StrategyParameters slider bars appearing immediately after compilation. This functionality doesn't affect my use if WL in any meaningful way, but I'm just interested as to what's going on behind the works.


Thanks in advance.
profile picture

Eugene

#2
1. No.*
2. No.
3. Probably because the list of StrategyParameters has class-level scope.
4. "...the StrategyParameters are instantiated immediately after compilation..." -- to be immediately available in the upcoming Optimizer tool, among the rest.

* Just a side note: too many parameters may have inverse relation to a strategy's robustness = too many degrees of freedom.
profile picture

ss161

#3
i can't get StrategyParameters to work in code compiled outside of Wealth-Lab (ie in SharpDevelop)?
profile picture

Eugene

#4
Parameter sliders can be used in a strategy contained in an external DLL, just like in any regular strategy. It could be the result of failure to generate a new Guid for the strategy. Like if you copied the class of another strategy.

Which WLP build are you using?
profile picture

ss161

#5
do you mean a new GUID after including the StrategyParameter? The strategy itself has a unique GUID.

i'm using 5.3.44. i'll try generating a new GUID.
profile picture

Eugene

#6
Oops, I recollected there was a rare bug in WLD 5.1 and WLP 5.3 where Parameter Sliders are not displayed for a compiled strategy (DLL) only if it's opened from the Home Page and not through the regular File-Open dialog. Unfortunately it's not fixed in WLP 5.4. :(
profile picture

ss161

#7
and there they are! thanks.
profile picture

Eugene

#8
Just open the strategy in a DLL as usual, bypassing the Home Page.
profile picture

ss161

#9
i have a strategy with two strategy parameters. every time i change either of them, the strategy starts running. can that be disabled so i have to hit go to make the strategy start running?
profile picture

Eugene

#10
No, this very helpful feature is there by design and applies to single symbol mode. In multi-symbol mode, it doesn't happen (need to manually start the strategy after changing sliders).
profile picture

ss161

#11
i'm not sure whether i should detect a note of sarcasm or not. i find it a very unhelpful feature that is hopefully there by accident, not design, and that ultimately it is improved upon. I'm also crossing my fingers that the optimizer interface is more robust. the sliders start the code executing at each click, not even waiting for the "sliding" to end. in MSB the strategy will sometimes start executing upon moving the sliders but generally it does not. also, the sliders are intermittently unstable producing erroneous "value 7 not a valid value" error (when a value of 7 is not a choice) for which the fix seems to be to close and reopen the strategy.

a possibly more elegant solution could be to have a go button that is greyed out after the strategy executes, but then reactivates itself wheneven a slider is changed allowing the button to be pushed to re-run the strategy with the new slider values.

also (to be very picky), the descriptive text to the left of the slider only allows about 12 characters before truncating the parameter text. resizing the width of the selection area, just makes the slider bigger, it would be great if at least it made both the text area and the slider area proportionally bigger.
profile picture

Eugene

#12
QUOTE:
i'm not sure whether i should detect a note of sarcasm or not.

Didn't mean to sound sarcastic. I do like the feature, find it to be a smart move, convenient, intuitive and time-saving. I even remember doing a video tutorial in the Wiki where it's highlighted. Only wish it worked for MSBs as well, but the software designers most likely had a good reason against it.
QUOTE:
producing erroneous "value 7 not a valid value" error (when a value of 7 is not a choice)

It could just be telling you that something is probably not quite right with the range/step. Having a code fragment to look at could help.
profile picture

ss161

#13
you didn't sound sarcastic, but i'm just amazed as i have the polar opposite view. it just goes to show you can't please everyone.
profile picture

Cone

#14
Besides the fact that it's time-saving, it's there by design based on consistency that when something is changed in the Data Panel the script automatically executes.

Note that you no longer have to use the sliders if you know precisely the value you want to change a parameter. Click on the parameter to edit a value, which isn't restricted to the slider range.

While we respect everyone's opinion, you're definitely right about not being able to please everyone though!
profile picture

ss161

#15
QUOTE:
It could just be telling you that something is probably not quite right with the range/step. Having a code fragment to look at could help.






CODE:
Please log in to see this code.


i think i can replicate the error when i have clicked on a dataset (not a symbol), change some of the parameter slider values, hit escape to stop strategy from executing, then select the symbol on which i want to run the chosen parameters.
profile picture

Eugene

#16
I can see it as well. The strategy status displays "Collecting data...", and you get that runtime error message when you try switching symbols from the dataset tree. I commented out the public constructor, so the range and stepping of the Straps isn't an issue here. However, the MSB simulation is not complete because it has been explicitly canceled, so clicking on the dataset's symbols should not deliver meaningful results, but may be should have been more graceful. Robert, what do you think?
profile picture

Cone

#17
There might be something worth cleaning up when Escaping a Strategy like this one that will run through each of the symbols for every one of the symbols, but you can help yourself by selecting the "Recall DataSet/Symbol" Advanced preference (F12), and saving the script after you run it on a selected symbol. That way you can avoid running it in MSB mode. Another way would be to add some protective code at the beginning, like this -

CODE:
Please log in to see this code.
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).