Select DataSet on-the-fly
Author: pubx101
Creation Date: 6/25/2018 4:59 PM
profile picture

pubx101

#1
I want to run one strategy on Sector DataSet(constituents are sector indices or ETFs) to select a sector , then for the period when the sector is held, the program select trades on the DataSet that has all securities in the sector. Is it do-able?
profile picture

Eugene

#2
I'm trying to choose a design pattern which fits best and it might be one from the Symbol Rotation group. Could you be more detailed about both the sector selection criteria (how is the holding period determined?) and the trade selection (is there another set of rules for trading the sector securities?)
profile picture

pubx101

#3
the case is like this:

I have datasets: 'Sectors' (including sector ETFs: XLY, XLP, XLU,.... etc) and 'Sector XLY' (all components in XLY), 'Sector XLP', 'Sector XLF'. etc. I want to run a strategy on dataset 'Sector' to select a sector, for example:

XLY Buy 100 shares Jun 5, 2018 Sell on Jun 8, 2018
XLP Buy 150 shares Jun 11, 2018 Sell on Jun 15, 2018

and then run another strategy / rule to find trades in dataset 'Sector XLY' in the period Jun 5 to Jun 8, and trades in dataset 'Sector XLP' from Jun 11 to Jun 15.
profile picture

Eugene

#4
Let's start by saying that switching DataSets programmatically (as opposed to setting context to make trades on individual symbols across DataSets) is not supported in Wealth-Lab. What are your possible workarounds?

A. If you don't care about somewhat offset backtest results due to inclusion of unrelated symbols, then you could create just one large DataSet with all the symbols and put both the ETF selection logic and the trade rules inside one Strategy. Clumsy but compact and might work.

B. If you prefer to make it more elegant and can deal with multiple Strategies doing their own thing then we're on the same page. There are probably ways to tackle this but simple is best. How about this?

1. A 'regime switching' master Strategy could be run every day and save its chosen sector ETF in Wealth-Lab's global memory or to a disk file. See the QuickRef > System for SetGlobal, GetGlobal and ClearGlobals or if files is what you prefer, examples aren't hard to find since it's a commonplace task in .NET.

2. Create as many tweaked copies of "another strategy / rule" as there are sector ETFs. Save them with different names e.g. "Another Strategy - Sector XLY", for example.

3. In Wealth-Lab's Preferences > Advanced Options, check [v] DataSet[/i] in Save the following items... This "attaches" each Strategy to its own DataSet when opening it interactively (N/A in Strategy Monitor). As an alternative to this override, create and save a Workspace with your multiple Strategy windows.
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).