Hi, I am having some trouble with the GetSeries function that I hope that someone can help me with.
The issue is this: on certain formulas on charts and in backtesting GetSeries is returning only NaN's for series for which there is data on the timeframe covered in the backtest or chart.
For example, I have VIX daily data going back to the 90's in the symbol "^VIX". This simple formula:
when added to a pane on a chart of, say, IBM, displays the VIX data as expected. However, if I put this onto a chart of a noncontinuous futures contract, ie "/ZCZ2009" (December expiration corn futures for 2009) I get nothing but NaN's.
This seems to happen on many charts (or backtests) where the charted/backtested symbol covers a smallish time period in the past.
Is this some kind of limitation or am I doing something wrong here?
Do you have data for "/ZCZ2009" symbol?
"GetSeries" synchronize the added series with the analyzed one. If dates for both series do not overlap then you will get NaN's.
The "/ZCZ2009" covers from 20-07-2006 up to 14-12-2009 (the source is quandl, here: https://www.quandl.com/data/CME/CZ2009-Corn-Futures-December-2009-CZ2009-CBOT). The VIX data covers from the early 90s to present; source: Yahoo finance.
I have no trouble with either of these series on their own. Also, if I reverse the situation and put the /ZCZ2009 data onto the VIX chart it appears (from 2006 to 2009, NaN's elsewhere) as expected. It's only when I try to plot the longer series on the shorter one that there seems to be a problem. Also, this isn't specific to /ZCZ2009, but happens whenever I try to plot a longer (but overlapping) series onto a shorter one.
I see what you mean now. This is a known limitation when using getseries function with series that have different very end date.
We need to work on this.
Thank you for looking into this and confirming it is a known issue. I was worried something was up with my database.
I really needed to have this functionality, so I put together a little workaround function which I'll be using until you all fix things up. I'll leave it here in case anyone else can benefit from it:
//
// function kpGetSeries
// Usage: kpGetSereis(string SymbolName, string Series, string NoDataAction)
// Series is one of the usual "open", "close", etc.
// NoDataAction is one of "NA", "LastData", or "Zero"
//
string symbolName = (string)SymbolName[0];
string series = (string)Series[0];
string noDataAction = (string)NoDataAction[0];
VectorR data = cFunctions.GetTimeframeRawData(symbolName, 0, series);
int dataIdx = 0;
double lastData = 0;
for (int i = 0; i < result.Length; i++) {
while (dataIdx < data.Length) {
if (data.GetDate(dataIdx) == cFunctions.Date[i]) {
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.