Skip to content

Instantly share code, notes, and snippets.

@ivannp
ivannp / dvi.r
Created September 24, 2014 16:24
DVI Indicator Backtesting with SIT
require(quantmod)
require(SIT)
dvi.indicator = function(prices) {
dvi = TTR:::DVI(prices)[,3]
indicator.long = ifelse(dvi <= 0.5, 1, 0)
indicator.short = ifelse(dvi > 0.5, -1, 0)
indicator = reclass(cbind(indicator.short + indicator.long), prices)
@mrbcuda
mrbcuda / currency.png
Last active December 29, 2018 05:28
A mashup of financial turbulence and regime switching examples having missing bits into a standalone example without missing bits. Uses sources from Quantivity and Systematic Investor blogs as well as the CRAN RHmm and TTR packages. Uses quantmod and FRED as a data source. The turbulence calculation clearly is not the same as referenced original…
currency.png