Introduction to Quantmod in R

The quantmod package for R is designed to assist the quantitative traders in the development, testing, and deployment of statistics based trading models. Using quantmod, quant traders can quickly explore and build trading models.

The important features of quantmod that we will use are divided into three categories: 1) downloading data, 2) charting, and 3) technical indicators and other functions.

Downloading Data

The Quantmod package provides useful tools for loading, and managing data in R. With Quantmod we can download data from public sources such as Yahoo, Oanda, Google, the Federal Reserve Economic Data(FRED), and also from  SQL databases and CSV files. 


The package has great capabilities for creating charts and we can plot different graphs types such as lines, bars and candlestick. Once we have the charts, we can add technical indicators into it to analyze signals, entry and exit points from a specific trading rules.

Technical Indicators and Trading Signals

Quantmod has a wide list of technical indicators (MACD, RSI, EMA, SMA, ROC, and ADX, among others) that we can plot together with the price series or price candlestick charts. Finally, it is possible to create trading signals with the indicators and plot them into the chart.

To start using the Quantmod library, you can install and load it in your R environment using the following commands in R console or R Studio (Preferred).