(This article was originally published at Systematic Investor » R, and syndicated at StatsBlogs.)
I recently came across the “An early Halloween for gold traders” article by Mark Hulbert. I have discussed this type of seasonality analysis in my presentation at R/Finance this year.
It is very easy to run the seasonality analysis using the Systematic Investor Toolbox.
###############################################################################
# Load Systematic Investor Toolbox (SIT)
# http://systematicinvestor.wordpress.com/systematic-investor-toolbox/
###############################################################################
setInternet2(TRUE)
con = gzcon(url('http://www.systematicportfolio.com/sit.gz', 'rb'))
source(con)
close(con)
#*****************************************************************
# Load historical data
#******************************************************************
load.packages('quantmod')
ticker = 'GLD'
data = getSymbols(ticker, src = 'yahoo', from = '1970-01-01', auto.assign = F)
data = adjustOHLC(data, use.Adjusted=T)
#*****************************************************************
# Look at the Month of the Year Seasonality
#******************************************************************
month.year.seasonality(data, ticker)
This confirms that October have been historically bad for Gold, but we used only 8 years of history because GLD only started traded in 2004.
To get a more complete picture, there is a long history of Gold prices at the Bundes Bank. I found this data source used at the Wikiposit.
I created a helper function bundes.bank.data.gold() function in data.r at github to download prices from the Bundes Bank site.
#*****************************************************************
# Load long series of gold prices from Bundes Bank
#******************************************************************
data = bundes.bank.data.gold()
#*****************************************************************
# Look at the Month of the Year Seasonality
#******************************************************************
month.year.seasonality(data, 'GOLD', lookback.len = nrow(data))
The October have been historically bad for Gold using longer time series as well.
Next I would recommend looking at the daily Gold’s performance in October to get a better picture. You might want to use the Seasonality Tool for this purpose. Please read the Historical Seasonality Analysis: What company in DOW 30 is likely to do well in January? post for a case study on how to use the Seasonality Tool.
To view the complete source code for this example, please have a look at the bt.october.gold.test() function in bt.test.r at github.
Please comment on the article here: Systematic Investor » R


