Is it possible to pin the start date of a Strategy?
Author: jecjackal
Creation Date: 6/4/2018 6:08 PM
profile picture

jecjackal

#1
Hi All,

I have a strategy that executes a dataset. This strategy selects N positions from a dataset. As my dataset is quite large, I would prefer to run the strategy in portfolio mode when I add it to the Strategy Monitor. Otherwise, I may end up with dozens to hundreds of alerts for the same trading day. I have a concern regarding the start date. If I use portfolio mode and my start date changes (using the past 5 years of data), then the positions I am given alerts for may not be active. Here's a quick timeline for a better explanation.

Timeline (Buys)
1--------2----------3---------4 ~~~~~~~~~ t -1
A C
B

If I start one day 1, A and B are buys, so I buy those positions. However, when I use the rolling 5 year window, on the next day I start on day 2 and I don't have A and B any longer. Therefore, I won't receive the sell alerts for those positions. Is there a way I could 'pin' my start date such that I always start on day 1, but I run the strategy to the present day?

Thanks,

Jec
profile picture

Eugene

#2
QUOTE:
Is there a way I could 'pin' my start date such that I always start on day 1, but I run the strategy to the present day?

Sure. Make sure that enough data is loaded by WLP but limit the starting date in your strategy:

Should I place entry orders for historic open positions in paper trading?

See posts #2 and #7 there. While Cone's approach is straightforward, an advantage of having a GetTradingLoopStartBar is in loading enough seed data in your main (trading) loop. Which is especially important when using any "unstable" indicators as per the WealthScript Guide > Indicators > Stability of Indicators.

At any rate you might want to use GetAllDataForSymbol to let WLP transparetly load enough data for indicators.
profile picture

Cone

#3
QUOTE:
using the past 5 years of data

The first thing to do is to use the Data Loading "Date Range" option. Set your first date to whatever you want, but set the "to" date to some date far in the future. Then in Preferences (F12) > Advanced Options > make sure that the "Data Range" box is checked (and others as required) so that when you launch the script, the dates and values specified when you last saved your script will be used. If you use a Workspace, make sure to save the Workspace after configuring and running the script.
profile picture

jecjackal

#4
Thanks for the help. I'll try these suggestions out tonight.
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).