Weekend Reading – Gold in October

September 28, 2012
By

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

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 Deutch Bank. I found this data source used at the Wikiposit.

I created a helper function deutch.bank.data.gold() function in data.r at github to download prices from the Deutch Bank site.

    #*****************************************************************
    # Load long series of gold prices from Deutch Bank
    #****************************************************************** 
    data = deutch.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.


To leave a comment for the author, please follow the link and comment on his blog: Systematic Investor » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: 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...

Tags:

Comments are closed.