- ago
I may have found a defect with the Strategy Monitor not utilizing pre-market data when executing a strategy. Or, I have misconfigured something. To test for this potential defect I have configured WL8 as follows:

Using WL8 build 14.
Using TD Ameritrade extension build 8.
Created a new market named US Stocks PrePost that was copied from built-in market US Stocks. For market symbols I added ##### to US Stocks PrePost. I set US Stocks PrePost hours to be from 04:00 to 20:00.
In the Preferences, on the Trading tab, in the Miscellaneous Trading Settings section, option Enable Pre/Post Market Trading is checked.
I have a one minute scale dataset for symbol RBLX. It is up-to-date.

As for strategy execution...
Run WL8 as administrator.
To test the strategy named TestPreMarketLoad (code is below), I launched the Strategy Monitor, and dragged the TestPreMarketLoad strategy into the Strategy monitor window.
For strategy settings, in the Strategy Monitor popup, I selected stock symbol RBLX and picked the US Stocks PrePost market. The Data Range is set to 1,000 bars, Shares = 30, and Scale = 1 minute. The strategy uses streaming data. The broker is Dummy Broker, Account 1 and Streaming is set to TD Ameritrade. The strategy does not have Strategy parameters.
(Note that the strategy itself (when opened), in the Strategy Settings tab, has Filter Pre/Post Market Data unchecked.)
In the strategy monitor, I double-checked the settings, and they show that US Stocks PrePost is the selected market.

So here is the code for TestPreMarketLoad...
CODE:
using System; using System.IO; using WealthLab.Backtest; using WealthLab.Core; namespace WealthLabStrategies.PriceAction { public class TestPreMarketLoad : UserStrategyBase { public override void Execute(BarHistory bars, int idx) { var timeOfDay = bars.DateTimes[idx].TimeOfDay; var date = bars.DateTimes[idx].Date;          // For running in the strategy monitor... // If you set timeOfDay.Minutes to 20 then the file will NOT be updated. // If you set timeOfDay.Minutes to 35 then the file will be updated. if (date == DateTime.Today && timeOfDay.Hours == 9 && timeOfDay.Minutes == 20) {             // update output filename accordingly for your testing... var file = File.CreateText(@"C:\Users\Paul\Documents\WL8.txt"); file.WriteLine($"Strategy executed for bar with specific time of day {timeOfDay}. Bar execution occurred realtime at {DateTime.Now}."); file.Close(); } } } }

The code writes a message to a text file indicating the sought time-of-day bar (e.g. 9:20) and the strategy's realtime code execution. (I didn't use WriteToDebugLog because I believe that won't occur for strategy execution in the Strategy Monitor.)

In the code, if you set timeOfDay.Minutes == 20 then the text file is not updated. If you set timeOfDay.Minutes == 35 then the text file is updated.

If you run a backtest you will get an update to the text file regardless of whether you're looking for 9:20 or 9:35, as expected. Of course, for back testing, Filter Pre/Post Market Data is unchecked.
0
429
Solved
2 Replies

Reply

Bookmark

Sort
Cone8
 ( 24.57% )
- ago
#1
You've got a pretty good handle on it all. The only "mistake" was using ##### because this will only match symbols with 5 characters. You'd need to copy that symbol record 4 more times for #, ##, ###, and ####. Unless I missed something, that should work.
1
Best Answer
- ago
#2
Thanks, Cone! That was it - I did not have the proper market symbol configuration. Now I feel like a big dummy because I should have realized the symbol masking is character slot-specific, which makes sense, because that is more flexible than allowing just a # to specify multiple slots.
1

Reply

Bookmark

Sort