Back to Community
Global Context Variable timestamping data creep

Messing around with etfs and have this issue below.

SUMMARY:
Calculate trailing WVIX, when current crosses trailing X day max, buy. If worthy, to be used as technical indicator as part of a factor combination.

ISSUE:
Most efficient way to calculate it given that cannot reference earlier values of factors in the pipeline as an input -- i.e. DataSets are just collections of objects and do not hold actual data

DIFFERENT OPTIONS:
1) Use data.history --> pipeline preferred
2) a custom factor for each day up to X with varying window lengths --> messy, lots of line of pointless code, increase change of manual error, parameter changes more tedious
- being done below in class WVIX for today, and class WVIXHIST for history with each day set up in initialize
3) Use Global Context Variable (GCV) in conjunction with custom factor then do analysis on the GCV (e.g. https://www.quantopian.com/posts/obv-custom-factor) - doing this

    ISSUE: looks like GCV df populated throughout testing period at inception so when pulling data from there, dates are off - after time stamp, log shows on Nov 13/09, that the gcv last 10 slice has data all the way out to May 13, 2010. Did I do timestamping wrong (..just used today in custom factor) ... is this meant to be this way be design?  

    Also is there a way to run the custom factor without adding it to pipeline? I do not want the custom factor output per-say, but need to run it for the GCV - more of a resource/memory management question.  

Log generated from code on line 327:

2009-11-13 10:31 order_positions:317 INFO assets wvix_again timestamp
assets
38292 14.432192 2010-04-28 00:00:00+00:00
38292 13.088930 2010-04-29 00:00:00+00:00
38292 12.630674 2010-04-30 00:00:00+00:00
38292 15.437491 2010-05-03 00:00:00+00:00
38292 15.194043 2010-05-04 00:00:00+00:00
38292 20.048690 2010-05-05 00:00:00+00:00
38292 23.468507 2010-05-06 00:00:00+00:00
38292 29.725037 2010-05-07 00:00:00+00:00
38292 28.961667 2010-05-10 00:00:00+00:00
38292 18.070652 2010-05-11 00:00:00+00:00
38292 17.879891 2010-05-12 00:00:00+00:00
38292 15.923567 2010-05-13 00:00:00+00:00

Clone Algorithm
1
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5832b10f975c5367411357fc
There was a runtime error.
1 response

William’s VIX Fix is a synthetic VIX (CBOE Volatility Index) calculation which can be used in any market to mimic the performance (but not the quotes) of the well-known volatility index (the WVF is not based on option’s implied volatility but derived from historical and intraday prices only).

William’s original formula:

WVF = [Highest (Close,22) – Low) / (Highest(Close,22)] * 100

http://www.tradingtheodds.com/2010/09/williams%E2%80%99-vix-fix/