fbpx

R Code for for charting Daily Crude Oil Futures spread (calendar spread of first two months)

(Last Updated On: March 27, 2014)

R Code for for charting Daily Crude Oil Futures spread (calendar spread of first two months)

You can thanks the NYC Contact for this gem!

The chart shows mean reversion and volatility. Extreme contango has happened several times.

CL1 = read.csv(‘http://www.quandl.com/api/v1/datasets/CHRIS/CME_CL1.csv?&trim_start=1983-03-31&trim_end=2014-03-24&sort_order=desc’, colClasses=c(‘Date’=’Date’))

CL2 = read.csv(‘http://www.quandl.com/api/v1/datasets/CHRIS/CME_CL2.csv?&trim_start=1983-03-30&trim_end=2014-03-24&sort_order=desc’, colClasses=c(‘Date’=’Date’))

CL_Spread[“Date”] = CL1[“Date”]

CL_Spread[“Settle”] = CL1[“Settle”] – CL2[“Settle”]

rdate <- as.Date(CL_Spread$Date,”%yy-%m-%d”)
fix(rdate)
plot(CL_Spread$Settle~rdate, type=”l”,col=”blue”,axes=F)
box()
axis(1,rdate,format(rdate,”%m-%y”))
axis(2,CL_Spread$Settle)

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Subscribe For Latest Updates

Sign up to best of business news, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

NOTE!

Check NEW site on stock forex and ETF analysis and automation

Scroll to Top