GetDataSetName

Modified on 2017/05/16 15:05 by Eugene — Categorized as: Community Components

Syntax

public static string GetDataSetName(WealthScript obj)

public string GetDataSetName( WealthScript obj )


Parameter Description

objAn instance of the WealthScript object

Description

Returns DataSet name the strategy is being executed upon. Works in Strategy windows, does not work in Strategy Monitor or Combination Strategies.

Background:
Wealth-Lab 6 doesn't include a WatchListName equivalent function, used in WL4 to return WatchList name containing the symbol that was clicked to execute the script. This function is slightly different, however, because it takes current strategy window into account when determining the DataSetName, not some given symbol. In a future version, we expect a similar function to be implemented natively. Once it happens, this mockup function GetDataSetName will become depreciated.

Note:
For an alternative approach that searches through all datasets for current symbol, take a look here: DataSet name.

Example

Here's a short snippet illustrating how to call the method in your Strategy code:

Example using C# extension methods:

using System; using System.Text; using WealthLab; using WealthLab.Indicators;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { PrintDebug( this.GetDataSetName() ); } } }


Legacy syntax example:

using System; using System.Text; using WealthLab; using WealthLab.Indicators; using Community.Components; // GetDataSetName here /*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Pass a WealthScript instance Utility u = new Utility( this );

PrintDebug( u.GetDataSetName() ); } } }