Clicking "Stream" too close to the minute mark on long-running strategy
Author: haytac
Creation Date: 1/19/2016 1:26 PM
profile picture

haytac

#1
Hi,

It appears that when the button "Stream" is clicked the current strategy is run once. It is then run again when the new Bars object comes in at the top of the minute.

My strategy takes over 10 seconds to run. When it just so happens that "Stream" is clicked too close to the minute mark the following seems to happen:
a) strategy was running from the click
b) a second strategy run is launched at the minute mark

The strategy is confused and I get run time errors.

If this is the case:
I) how can I fix my strategy so this does not happen
or alternately:
ii) can WL Pro be changed so when the "Stream" button is clicked WL waits till the minute mark to run the strategy?

Thanks!
profile picture

Eugene

#2
Hi,

Your understanding is correct.

QUOTE:
ii) can WL Pro be changed

The general rule of thumb is no, WL Pro is not to be changed to accomodate single-user requests.

QUOTE:
I) how can I fix my strategy so this does not happen

As simple as check DateTime.Now.Second and abort processing if less than 10 seconds remain to the next minute?

Besides making sure that your 100K+ line strategy is not being run too close to the end of the minute, how about disabling all performance visualizers (you don't want the slow down they bring to live trading) and loading barely enough data but not too much?

profile picture

haytac

#3
Thanks!
I will update the strategy as you suggest.
This applies only when in "stream" mode.
Is there a way for the strategy to know that it is in "stream" mode?
profile picture

Eugene

#4
Please see QuickRef > System > IsStreaming property

Could you believe that? ;)
profile picture

haytac

#5
You folks have done a great job with WL! I am grateful to you and Fidelity.
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).