Strategy Monitor lingers during execution or data updates in 6.9.22+
Author: ronc
Creation Date: 4/27/2020 5:08 PM
profile picture

ronc

#1
My strategy (code below) writes the latest bar data for all symbols in a dataset to a text file. The dataset contains 6 symbols. Before running the strategy in Strategy Monitor I manually update the dataset via Data Manager. The objective: on 1-minute intervals, overwite the text file with the latest bar data. The Strategy Activation Settings are:
Account: PaperAccount1
Data Range: 1 Bars
Position Size: $5000 (RP)
Scale: 1 Minute
No boxes at bottom of Activation Settings are checked.
No alerts or autostaging are used (the strategy does not trade; it just downloads data each minute.).

My expectation was that the data would download within a few seconds. However, it takes approximately 1 minute to download the latest bar for 6 symbols, by which time of course the data is out of date.

The Strategy Monitor Action column typically displays, at each cycle, messages such as:
Entering mointor thread
Execute <symbol name> <strategy name> (lingers for ~5 to 20 seconds)
Update Completed(2) <symbol name> (5 symbols left) (lingers for ~5 to 20 seconds)
Leaving streaming filter monitor thread (lingers for several seconds)

This is not due to network connection speed. My speed is about 200 Mbps down, 11 Mbps up.

I have tried varying the Strategy Monitor settings but have observed no change.

In Data Manager, the data provider is Fidelity.

What, if anything, am I doing wrong?

Thanks in advance.

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

Eugene

#2
Please attach the complete SM log file.
profile picture

superticker

#3
CODE:
Please log in to see this code.

There's a typo in your Windows file name. Try:
CODE:
Please log in to see this code.
profile picture

Eugene

#4
It should work either way.
profile picture

ronc

#5
SM log is attached.
Since first observing the issue I:
- Updated WLP to v 6.9.22.7. Issue persist.
- Changed indices to include period at start of symbol name, e.g. .SPX

Note that in the log, at 12:54:06, I changed strategy settings. I was trying most recent 5 bars and then changed to 1 bar.
profile picture

Eugene

#6
What is disk Z exactly?

Is your PC clock in sync?
profile picture

ronc

#7
PC clock is in sync. Date/time settings say the last successful sync was 4/27/2020 9:57:25 AM, time server = time.windows.com

Disk Z: is a shared drive shared with my Mac. I run WLP on Windows in a virtual PC in VirtualBox. Physically, all storage is SSD. Z: is not a separate physical drive; the virtual PC sees it as a drive and the Mac sees it as a directory.

The Windows time and Mac time are in sync.

The reason for the shared drive is I have Python code that runs on Linux/Unix (including Mac) that reads the file containing the bars, computes, and returns another file which will be read by other code in WLP.

I thought this could be a performance problem due to using a virtual PC vs. native but I've never observed any performance problems before, everything else in WLP runs fine, e.g. streaming charts, etc.

I could do a test that does not involve writing the files to Z: to see if that speeds things up. But of course without the output file the whole scheme won't work.

If the Z: drive is a potential root cause, I think I can share the entire C: drive with my Mac/Python code. But that might just cause the same problem in C;.
profile picture

Cone

#8
We're doing some testing with the new Fidelity provider. I'm seeing data updated very quickly, but it's followed by "lingering" and suspicious gaps in which it appears not to be processing anything. We'll look into it.

In the time being, if you're trading fewer than 15 or even 20 symbols, use Streaming Windows for minimal delay.
profile picture

ronc

#9
Thanks Cone. Yes, I am using only 6 symbols at this time.

Regarding Streaming Windows, I am looking at User Guide p94-95 but am not clear how this should work.

My objective is to write the bar data for each symbol to a text file (at each 1-minute bar).

User Guide p94 says that each new bar in the Streaming Chart triggers a strategy in the Strategy Window. Does this mean that I should no longer use the Strategy Monitor to trigger the strategy?

Thanks again.
profile picture

Cone

#10
For sure, with only 6 symbols, open a strategy once for each symbol. Save the Workspace to open it again in a new session.

QUOTE:
Does this mean that I should no longer use the Strategy Monitor to trigger the strategy?
Right, the S. Monitor is not required for that. You shouldn't have a problem, though, using either the S. Monitor or Streaming Windows. If delay is not an issue, the S. Monitor is more convenient - but only because you don't have to set up a Workspace for it.

Now, that I'm looking at what you're doing - accessing static data from external symbols - this is actually not straightforward to do from either tool because it assumes the data are available for the other symbols when the script's symbol is triggered. Bad assumption.

The only way that I know to be successful is to use the 2-script technique outlined here:
http://www2.wealth-lab.com/wl5wiki/kbOptimalTradingTool.ashx

Otherwise, the very simple way is for each symbol to write it's own data to a separate file:

Note! This script will create and save data in a directory called: C:\Data\ASCII\ronc
CODE:
Please log in to see this code.


But if you need a solution for all the symbols in the same file, let me know. We can modify the script from the wiki to do that.
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).