String parameters for strategies?
Author: sourkraut
Creation Date: 1/28/2011 2:29 PM
profile picture

sourkraut

#1
Is it possible to create a paramter to a strategy, that displays and passes different strings?

In particular, stock symbols?

I want to compare two stocks, selecting the main symbol from the data set, and the second by parameter.

Currently the second symbol is picked from an array by way of an index selected via a parameter.
That's crude! If it were any cruder, I could sell oil futures.

Does anyone have a better alternative?

Pop-up input box? A way to select the second symbol from the current data set?


Thanks for any input.


Eb
profile picture

Cone

#2
You can't put a string on a slider.

Community.Components facilitates an Input box

You can also use the number of the DataSetSymbol and add a slider for the numbers (but limiting it to DataSetSymbols.Count. i.e., string sym = DataSetSymbols[n];
profile picture

dansmo

#3
I want to have a workspace with three charts, each with the same strategy but a different string parameter. Does the input window store the string parameter for each chart?
If not: can you think of a way to deal with this?
profile picture

Eugene

#4
The "input window" is a simple static string variable. Each strategy instance is independent of the others. Try clarifying your request.
profile picture

dansmo

#5
Okay, I´d like to have a workspace with three charts.
Each chart has the same strategy applied. There is one string parameter that needs to be different for each chart. Now, I dont want to change that every time I am opening the Workspace. How can I save the workspace so that when I re-open it the charts still have their unique string parameter?
Only workaround that comes to my mind is having one unique strategy for each chart, but I think that his is not so good if there will be more charts than three in the future.
profile picture

Cone

#6
Are each of the charts displaying the same symbol? Is there another difference about each chart that you can use to conditionally set the string parameter?

CODE:
Please log in to see this code.

profile picture

dansmo

#7
Hmm, I think that @Cone´s approach should work.
However, I don´t like hard coded options very much. I think WLD should allow saving parameters to each individual worksspace window.
Take any strategy: one cannot save parameter settings to an individual chart in a workspace.
profile picture

Cone

#8
QUOTE:
Take any strategy: one cannot save parameter settings to an individual chart in a workspace.
As long as the charts were using difference symbols, you could use Preferred Values for this. In fact, you could create a string value that corresponded to a parameter value. Then, using Preferred Values, you set up the Strategy just the way you want for each chart. Leave PVs enabled, save the Workspace, and then it should work.
profile picture

dansmo

#9
Okay, I did not notice that PVs exist. Will have a look at it. 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).