Closed markziemann closed 2 years ago
current not working code adapted from https://web.archive.org/web/20180212050732/https://mkatsanos.com/VFI.html and
len=130 # periods to use coef=0.2 vcoef=2.5 #max vol cutoff sig=5 #signal line smoothVFI=FALSE
inter <- log(price$high) - log(price$low) vinter <- runner(x=inter,f=sd) cutoff <- coef vinter price$close vave <- SMA( price$volume, length ) vmax <- vave * vcoef price$vmax <- vmax price <- price[which(!is.na(price$vmax)),]
price$vc <- apply(X=price[,2:6],MARGIN=1,FUN=function(x) { if (x["volume"] <= x["vmax"]) { x["volume"] } else { x["vmax"] } } )
I settled with the MFI for now
current not working code adapted from https://web.archive.org/web/20180212050732/https://mkatsanos.com/VFI.html and
len=130 # periods to use coef=0.2 vcoef=2.5 #max vol cutoff sig=5 #signal line smoothVFI=FALSE
inter <- log(price$high) - log(price$low) vinter <- runner(x=inter,f=sd) cutoff <- coef vinter price$close vave <- SMA( price$volume, length ) vmax <- vave * vcoef price$vmax <- vmax price <- price[which(!is.na(price$vmax)),]
vc = iff(volume < vmax, volume, vmax) //min( volume, vmax )
price$vc <- apply(X=price[,2:6],MARGIN=1,FUN=function(x) { if (x["volume"] <= x["vmax"]) { x["volume"]
} else { x["vmax"]
} } )