Has the S&P 500 Cleared the Earlier Sell?

October 25, 2015

(This article was first published on Quintuitive » R, and kindly contributed to R-bloggers)

Life has been busy and has kept me away from blogging, and from trading, mostly. Still, I can’t stay away from monitoring the markets, and, with the recent rally, I started asking myself – has the situation changed since the 200 day SMA signaled an exit. What do you think – make up your mind before reading further.

Making up once mind before looking at the technical is a valuable approach to analyze one’s emotions in a rational way. To tune the gut feeling in other words.

Now back to the S&P 500. The answer to the question is – it depends. Let’s rerun the R script:


# Download data
spy = getSymbols("SPY",from="1900-01-01",auto.assign=F)

# Confirm the SMA situation first
spy.sma = runMean(Cl(spy), 200)
mm = merge(Cl(spy), spy.sma, all=F)
ind = mm[,1] >= mm[,2]

# 2015-10-20     FALSE
# 2015-10-21     FALSE
# 2015-10-22     FALSE
# 2015-10-23      TRUE
# Yep, buy on the Friday's close

# Compute the returns
rets = ROC(Cl(spy),type="discrete")

# Compute the adjusted returns
adj.rets = rets/sqrt(runSum(rets*rets,10)/9)

# The moving average
sma = runMean(adj.rets,n=200)

ind = sma >= 0

# 2015-10-20 FALSE
# 2015-10-21 FALSE
# 2015-10-22 FALSE
# 2015-10-23 FALSE
# Nope, no action based on the returns SMA

We closed above the 200 day SMA. On the other hand, the more robust, and better historically, approach, which uses normalized returns, continues maintaining a cautious position.

Make your mind and act accordingly – who said trading is easy.

Best of luck!

The post Has the S&P 500 Cleared the Earlier Sell? appeared first on Quintuitive.

To leave a comment for the author, please follow the link and comment on their blog: Quintuitive » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)