PartialValue to peek at opening price
Author: thodder
Creation Date: 10/30/2009 10:10 AM
profile picture

thodder

#1
In the previous topic "WLP 5.0 Tips", Eugene mentioned that a ghost bar could be checked for the open price with the following code:
CODE:
Please log in to see this code.

However Cone made the following warning:
QUOTE:
This is going to change once "the heartbeat" is implemented for Fidelity Streaming in 5.1. In this case, scripts will be executed based on the heartbeat and not [necessarily] the first tick in the next interval. Consequently, the opening price won't be available when the Strategy is executed.

I'd like to implement a gap strategy that I could run soon after market open which would use a daily scale instead of a intraday scale. The beginning of the gap strategy might look something like this...
CODE:
Please log in to see this code.

I would run this manually at market open when I wanted to trade gaps. Can I rely on Open.PartialValue to contain the opening price if I run this after market open? Today it appears to be providing the open daily price when my scale is daily. I'm not clear what Cone's warning was about.

profile picture

Cone

#2
The warning meant that a script is run when an interval closes. Before 5.1 intraday intervals closed only if a tick occurred in the next interval. Having that tick was great for PartialValues since it meant that OHLC partial values were initialized just an instant before the script was executed.

But since that tick could be 14 minutes after the orthodox close of a 15-minute interval, for example, another method was required to close the interval so the script could be executed in a timely manner - the heartbeat. If the interval closes due to the heartbeat, it means that no partial values exist (the result could be NaN, not sure) since a tick has not yet occurred.

Fidelity isn't supporting PartialValues yet, but they're there for the most part. If you run your script moments after the open (applies to Nasdaq primarily since listed stocks on the NYSE don't all open simultaneously), then you might be able to use the PartialValue if it exists. You should handle the case in which it does not exist.
profile picture

thodder

#3
I tested for double.NaN as the WealthScript Quick Ref stated that would result if there was no value. From WeatlthScript Quick Ref:

QUOTE:
If the DataSeries does not have a partial value available, the PartialValue property returns Double.NaN (not a number).


It sounds like I should be careful using this at the moment as it may not be fully supported. (I am using Fidelity data.)

Thanks.

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).