DataSet name
Author: mikael
Creation Date: 10/10/2008 3:37 PM
profile picture

mikael

#1
I've been digging around WealthScript and can't find anyway to get the DataSet name. On the way I discovered DataSetSymbols which will be useful later. Is it available?
profile picture

Eugene

#2
Unfortunately, there's no WL4's WatchListName analogue in the WealthScript namespace. What do you need it for?
profile picture

mikael

#3
I have my own ASCII files which I update myself from various sources, but I run the script across various sources, not just my own ones. The name of the DataSet is the only hint I have, unless you've got another up your sleeve, that informs me where the DataSet came from.
profile picture

Eugene

#4
Here's an example of how you can search through all datasets for the current symbol. This search could be limited to some particular provider using the DataSource.Provider property. The fact that currently there is no WatchListName function in WL5, complicates your task when a symbol exists in multiple datasources at the same time.

CODE:
Please log in to see this code.
profile picture

mikael

#5
This is an interesting piece of code, which just exposed me to a couple of new classes. Thanks. But you're right. I have no idea at this moment in time about the uniqueness of the symbols across my various data sources. And because I don't know which data source I'm executing the strategy on it seems to make my job impossible. Oh well.
profile picture

Eugene

#6
mikael

Although a WathcListName equivalent function is scheduled for 5.4, for the time being we're going to implement our own mockup pretty soon. Unlike the code above, the new one is built around a different concept and therefore will not slip up if your symbol exists in multiple datasources.

Most likely, in Community.Components in a matter of days.
profile picture

mikael

#7
Yay
profile picture

Eugene

#8
Done. Fire up the Extension Manager and let it do the job (if you don't have the library, you have download it from the Extensions section first):

GetDataSetName returns DataSet name the strategy is being executed upon.
profile picture

mikael

#9
Unless my mind has completely left me, there is an error in http://www2.wealth-lab.com/WL5Wiki/GetDataSetName.ashx. According to the source code I have, which I haven't yet tried, it should use the StrategyChartForm class instead of Utility and therefore should read

CODE:
Please log in to see this code.
profile picture

Eugene

#10
No, there is no error. Although you can do it as you did, using the function exactly as shown in the Wiki is strongly advised.

StrategyChartForm is an "internal" class used to do some dirty work outside GetDataSetName - namely to support "trading the equity curve". There is no point to document any part of it.

On the contrary, the Utility class contains other reusable functions like RunProgram and SaveClosedTrades - reducing the number of code lines creating different classes for your aesthetical pleasure! ;)