How To Manipulate Daily Stock Market Data With Quantmod R Package?

Quantmod is a very powerful R package. If you are a stock trader then you should learn how to manipulate daily stock market data using Quantmod R package. Quantmod means Quantitative Modelling Package. Quantmod is a rapid prototyping environment, where quant traders can quickly and cleanly explore and build trading models. With Quantmod you can draw very powerful charts that can give you the edge when it comes to trading stocks. R is an open source very powerful statistical package. You can download this powerful software from The R Projecct for Statistical Computing. After installing R on your computer, you can easily install Quantmod using R command: install.packages(“Quantmod).

When you want to use Quantmod, you should use this R command: library(quantmod). When you open R, it doesn’t open all the packages installed in it. So when you call the library command, you tell R to open that particular package and use it during the session.

>install.packages(“quantmod”) #Install the quantmod library
>library(“quantmod”) #Load the quantmod Library

As explained in the above video, you can download the data about any stock symbol using the GetSymbol command. GetSymbol downloads the data from Yahoo Finance. So you don’t have to look here and there for the daily stock market daily. XTS is an important time series object that helps you convert the data into a time series. It is important that the data that you use when using Quantmod is converted into XTS. These are the following commands that you will use:
>getSymbols(“YHOO”,src=”google”) # from google finance
[1] “YHOO”
> getSymbols(“GOOG”,src=”yahoo”) # from yahoo finance
[1] “GOOG”

So this is how you are going to download the stock market data. As you can see from the above commands, you can download stock market data from Yahoo Finance as well as Google Finance. Below is another good video on Quantmod package!

This is another good introductory video!

As a retail trader you should know how the quants build their stock trading models using powerful statistical packages. Now you have an open source statistical analysis R software that you can download FREE. Learn a little bit of R language. It is the language that will help you a lot. R is not a difficult language. You should google R language tutorials and you will get many good pdfs that you can download and read and in a few days you will be pretty well conversant with how to program in R language. Below is another good video on Quantmod and how to build models with it.

The most important statistical models that you will be able to build is predictive models that will help you look ahead in the future for the next few days. For example, suppose you can predict with 70% accuracy that the stock ABC will either go up or down tomorrow. If you have this knowledge will you go short when your predictive model is telling you that stock ABC will go up. So your predictive model will save you from making a costly mistake. Today all the big banks and hedge funds are using advanced statistical predictive models and if you are not using them you are on the losing side. Candlestick patterns are not working anymore. Standard indicators like MACD, Stochastic, RSI etc are not working anymore. Only these statistical predictive models are working.