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. 

Charting

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

install.packages('quantmod') 
library(quantmod) 

Related Downloads

Data Science in Finance: 9-Book Bundle

Data Science in Finance Book Bundle

Master R and Python for financial data science with our comprehensive bundle of 9 ebooks.

What's Included:

  • Getting Started with R
  • R Programming for Data Science
  • Data Visualization with R
  • Financial Time Series Analysis with R
  • Quantitative Trading Strategies with R
  • Derivatives with R
  • Credit Risk Modelling With R
  • Python for Data Science
  • Machine Learning in Finance using Python

Each book includes PDFs, explanations, instructions, data files, and R code for all examples.

Get the Bundle for $39 (Regular $57)
JOIN 30,000 DATA PROFESSIONALS

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.

Data Science in Finance: 9-Book Bundle

Data Science in Finance Book Bundle

Master R and Python for financial data science with our comprehensive bundle of 9 ebooks.

What's Included:

  • Getting Started with R
  • R Programming for Data Science
  • Data Visualization with R
  • Financial Time Series Analysis with R
  • Quantitative Trading Strategies with R
  • Derivatives with R
  • Credit Risk Modelling With R
  • Python for Data Science
  • Machine Learning in Finance using Python

Each book comes with PDFs, detailed explanations, step-by-step instructions, data files, and complete downloadable R code for all examples.