Is it possible to set the Base Symbol by program ?
Author: Ben_Zurich
Creation Date: 8/2/2012 9:24 AM
profile picture

Ben_Zurich

#1
In normal use, one can set the Base Symbol by simply clicking on a symbol in the DataSet window.

However, in my Visual C# strategy, I would like to be able to SET this symbol at the beginning of the Execute() method. Is this possible?

Even more important would be to be able to set the following parameters by program:

Scale
Data Range (several parameters)
Position Size (several parameters)


profile picture

Eugene

#2
First, let's determine what kind of task - not covered by normal usage of SetContext/RestoreContext - are you trying to accomplish with this?
profile picture

Ben_Zurich

#3
Let's say you have several strategies programmed in Visual C#, each is only valid for a certain Base Symbol, a certain scale, data range and position size.

Now when I start one of these strategies from the .Net environment, WL6 opens the default workspace with its predefined Base Symbol, etc. regardless of what strategy I am using.

The problem would also be solved when I could tell WL6 which workspace to load upon starting a strategy from .Net. But I don't think that this is possible.
profile picture

Eugene

#4
Thanks for the clarification.

The problem, I hope, will be solved by instructing Wealth-Lab to keep the current configuration in the Strategy's XML file when saving a strategy:

Preferences dialog (F12) > Advanced Options > Strategy-Dependent Preferences

profile picture

Ben_Zurich

#5
Thank you for your answer.

However I can't find

Strategy-Dependent Preference within Advanced Options of Preferences
profile picture

Eugene

#6
profile picture

Ben_Zurich

#7
In my particular case this does not help, as in fact I have only one single strategy that handles all. This "Master-Strategy" reads an external XML file which contains instructions about which external symbols, indicators, panes, parameters etc. are used for the run. Hence my strategy dll that is read by WL6 contains only one strategy.

As I said before, WL6 loads the default workspace when started by .Net. However, if I make corrections to the C# program without closing WL6, which is possible by setting breakpoints and making changes after the program stopped at the breakpoint, then I can close the current workspace and reopen whatever workspace I want and get the right base symbol, data range etc. stored therein. But this is only a workaround.

This brings me back to my initial question which is still unanswered: Is it possible to set the base symbol, scale, data range and position size by program ?
profile picture

Eugene

#8
Setting the base symbol and so forth programmatically is not supported.

Regarding Default workspace, I probably did not understand your description quite well. For sure, multiple copies of the same Strategies can be saved in Default workspace and individual Strategy windows would open up on different symbols just fine (without having to resort to workarounds like saving copies of your master Strategy with different settings, it works out of the box).

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).