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).


Related Downloads

Learn the skills required to excel in data science and data analytics covering R, Python, machine learning, and AI.

Free Guides - Getting Started with R and Python

Enter your name and email address below and we will email you the guides for R programming and Python.

Saylient AI Logo

Take the Next Step in Your Data Career

Join our membership for lifetime unlimited access to all our data analytics and data science learning content and resources.