Does HV Peek in this example?
Author: deepbuyer
Creation Date: 8/2/2008 11:52 PM
profile picture

deepbuyer

#1
Could somebody check if HV peeks in this example. I use HV (calculated on Daily) as a filter for entry (5-min). Should I used HV1[bar] or HV1[bar-1] in the example below? I am worried that if use the current day's bar than HV peeks at the Close of the day.

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

Eugene

#2
No, HV isn't peaking.
profile picture

Cone

#3
... but you're not processing the last 50 bars, and therefore will never generate an Alert to trade the Strategy. Why?

IS:
Bars.Count-50

SHOULD BE:
Bars.Count-1
profile picture

deepbuyer

#4
Thank you, Eugene and Cone!

Cone, yes should have been Bars.Count-1. I think I had a problem with another exit and Bars.Count-50 somehow "fixed" it. So, it was a left-over from trying to deal with another bug in my code.

Just to clarify my original post: I meant to say whether to use HV1[bar-6] to avoid peeking. But this is not important now that I know that HV1 does not peek.

Do I understand it correctly that, in general, if I reference a daily indicator in an intraday code, the daily indicator is NEVER calculated for the last day (incomplete) when the trade actually takes place? Was WL designed in such a clever way so that people like me did not have to worry which bar to use with indicators from other time frames? :)

profile picture

Eugene

#5
To configure the application's behavior when accessing compressed price series, in WL4 there were three so called synchronization options (see the Knowledge Base on the old site for an article explaining it in great detail). In WL5, you can manipulate the synchronization without having to resort to the Options dialog. This is accomplished in your code by shifting the series with standard .NET operators. See this KB article for a code example:

Intraday / Multi-Time Frame | Compressed price series alignment
profile picture

deepbuyer

#6
I have another small problem with the same script. I ran it on a dataset that have symbols that are no longer updated (stock delisted, merged, etc.). I think it is those symbols that give me "Dataseries do not have equal number of values for mathematical operation" error (e.g. NVT symbol). The script does not generate trades for this particular symbol, but works for the others stocks in the dataset. How can I modify the script to be able to run it on the discontinued symbols?
profile picture

Eugene

#7
If the script doesn't generate enough trades, perhaps there's not enough data?
profile picture

deepbuyer

#8
Eugene, sorry it was my mistake. I have re-built the dataset from scratch and Fidelity does not keep the data for old symbols. So, the error is because there were 0 bars for the symbols in question.
profile picture

Eugene

#9
QUOTE:
Fidelity does not keep the data for old symbols.


Yahoo! does though. If you really need to run some tests on a discontinued symbol (to avoid survivorship bias, for instance), still there's a workaround:

1. Download Aronow Software LLC Wealth-Lab 5.0 Watchlist DataSet Provider.
2. Create a DataSet with the Y! provider - they still have NVT on board.
3. "Combine" two Y! & Fidelity DataSets together in a Watchlist with the help of Dave Aronow's great freeware.
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).