Issue with SetContext
Author: sburgener
Creation Date: 2/26/2013 10:18 AM
profile picture

sburgener

#1
Hi,

I am backtesting a strategy on a few thousand historic future codes, reaching back to 2000, out of which most have data-windows of 2-3 years only.
I then run my strategy on a dummy dataset, composed of only one ticker holding dates corresponding to a specific calendar, reaching from the late 90ies to today. When accessing a specific futures contract (in which I invest), I synchronize it with this dummy timeseries.

The strategy runs fine, but in one instance, the SetContext() method has an issue. The underlying future in which I would like to invest has dates and values reaching up to february (I see values in the csv file as well as in the chart if I use the charting feature in WealthLab). The dummy variable as well has dates and values (1s) up to today. However, when using SetContext(respective futures, true), the synched bar object (accessed with Bar) is fine up to the 17th of Dec 2012, but then this value gets duplicated until the end of the chosen DataRange (2-Jan-2013).

To trouble-shoot I also tried to access the same ticker (i.e. futures contract) through GetExternalSymbol(respective futures, respective dataset, true) and the bar object I obtain has all correct dates and values up to the end of the DataRange (2-Jan-2013).

I've checked and there is no other ticker (in any of the datasets I have) with the same name.

Have you encountered similar issues previously?

Thank you in advance for your help!

profile picture

sburgener

#2
Actually, is there an alternative to BuyAtClose, where one can specify the ticker (and dataset) to buy (i.e. avoid using SetContext)?

Thanks again,
Seb
profile picture

Eugene

#3
Replying just to this at this time:

QUOTE:
Actually, is there an alternative to BuyAtClose, where one can specify the ticker (and dataset) to buy (i.e. avoid using SetContext)?


No, there ain't no alternative to SetContext.
profile picture

Cone

#4
Nothing comes to mind why synchronization would fail with SetContext as you described, but the answer could lie in the data. If you zip and attach your dummy series along with the one that's failing, then we'll take a look.
profile picture

sburgener

#5
Thanks for the proposed help to both of you!

For the time being I will prevent the issue by restricting the data range. I'll try to find a work-around and will get back to you shouldn't I get there.

Thanks again,
Seb
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).