Click here to Login





                                                   Trouble with GetSeries

  1

0
Kyra Packens
2015-05-17 06:06:35


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:

vix = getSeries("^VIX", close, LastData);
plot(vix, "vix");

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?


-- KP



QuantShare
2015-05-18 04:10:45

  0

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.



Kyra Packens
2015-05-18 21:33:44

  0


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.

Any ideas?



QuantShare
2015-05-20 03:03:41

  1

Best Answer
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.



Kyra Packens
2015-05-20 19:11:17

  1

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]) {

result[i] = (double)data.GetValue(dataIdx);
lastData = result[i];
dataIdx++;
break;

} else if (data.GetDate(dataIdx) > cFunctions.Date[i]) {

switch (noDataAction) {
case "NA":
result[i] = Double.NaN;
break;
case "Zero":
result[i] = 0;
break;
default:
result[i] = lastData;
break;
}
break;
}

dataIdx++;

}
}




QuantShare
2015-05-21 03:06:02

  1

Thank you for sharing this


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Top 20 stocks with the highest 10 day rate of change - Current an...
Minimum Variance Optimization with Solver V1.1- AMM
Short Term Trading System with RSI Ratios
Enhanced Candlestick Chart with Volume Variation
Stock Correlation with its Industry - Change over time

How-to Lessons
How to use QuantShare with Metastock data
How to create a chart with a black background
How to associate an index with a list of stocks
How to screen for stocks having a high correlation with the Dow J...
How to speed up watchlist and screener plug-ins when working with...

Related Forum Threads
A helping hand with the Hilbert Transform, please?
Creating Shortcuts with arrow keys? Function keys?
Problem with "Save Trading System" in Optimizer
online trading with tadawul stocks
Trailing Stop With Condition

Blog Posts
How to deal with StockTwits data
Create Realtime Quote Sheets with the Watchlist Tool
How to Backtest an Intraday Stock Trading System with EOD Ranking
How to Optimize a Trading System with Thousands of Billions of Co...
Create Profitable Trading Strategies with Exchange Traded Funds (...









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



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.