Cumulative -3% Corrections

I mentioned a few posts earlier I wanted to post some R code replicating Hussman’s chart.


#get the data of S&P500
getSymbols('SPY', from='1990-01-01')
#lets look at it from 1990 to 2015
spy <- SPY['1990/2015']
#our baseline, unfiltered results
ret <- ROC(Cl(spy)) 
#our comparision, filtered result
filter <- Lag(ifelse(ret < -0.03, 1, 0))
drops<- rollapply(filter==1,50,sum)

Created by Pretty R at

One thought on “Cumulative -3% Corrections

  1. Pingback: Drop and Gain Clustering | Sefirot Capital

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s