Skip to content

Instantly share code, notes, and snippets.

@sinner-
Created January 31, 2014 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinner-/8727386 to your computer and use it in GitHub Desktop.
Save sinner-/8727386 to your computer and use it in GitHub Desktop.
require(quantmod)
require(PerformanceAnalytics)
getSymbols('^GSPC',from='1970-01-01')
vol = 100 * sqrt(262) * runSD(dailyReturn(Ad(GSPC),type='log'),60)
backtest = dailyReturn(Ad(GSPC),type='log')
backtest[ lag(vol,1) > 15] = 0
charts.PerformanceSummary(backtest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment