Practical Data Science: Analyzing Stock Market Data with R

Learn basic financial technical analysis technics using R (quantmod, TTR) to better understand your favorites stocks.
4.3 (100 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
702 students enrolled Bestselling in Big Data
50% off
Take This Course
  • Lectures 18
  • Length 4 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 8/2015 English

Course Description

In this class, we will explore various technical and quantitative analysis techniques using the R programming language. I will code as I go and explain what I am doing. All the code is included in PDFs attached to each lecture. I encourage you to code along to not only better understand the concepts but realize how easy they are.

What We'll Cover

  1. Easily access free, stock-market data using R and the quantmod package
  2. Build great looking stock charts with quantmod
  3. Use R to manipulate time-series data
  4. Create a moving average from scratch
  5. Access technical indicators with the TTR package
  6. Create a simple trading systems by shifting time series using the binhf package
  7. A look at trend-following trading systems using moving averages
  8. A look at counter-trend trading systems using moving averages
  9. Using more sophisticated indicators (ROC, RSI, CCI, VWAP, Chaikin Volatility)
  10. Grouping stocks by theme to better understand them
  11. Finding coupling and decoupling stocks within an index

What This Class Isn't

This class isn't about telling you how to trade or revealing secret trading methods, but to show how easy it is to explore the stock market using R so you can come up with your own ideas.

What are the requirements?

  • Basic understanding of R
  • Access to R Console or RStudio
  • Interest in stock-market data

What am I going to get from this course?

  • Use R on stock market data for insight and ideas
  • Download free, daily stock market data from Yahoo
  • Plot great looking financial charts
  • Apply basic technical analysis on stock market data
  • Explore trading ideas and display entries and exits
  • Gain additional insights by comparing similar stocks

Who is the target audience?

  • Those looking to expand their R skills on stock market data
  • Those looking to come up with their own conclusions about the markets
  • NOT for those seeking easy stock tips or secret trading systems
  • NOT a solicitation to trade - trading is difficult, learn as much as you can before risking real money
  • NO guarantee that past historical strategies will work on future events

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Introduction
What is covered in this class

This is an optional video explaining where to find the binaries for R and RStudio needed to follow this course.

Section 2: Downloading Free Stock Market Data with R
  • Installing quantmod
  • Downloading stock market data
  • Downloading multiple symbols at once
  • Merging multiple symbols into one data frame
Section 3: Creating Amazing Stock Charts with quantmod

We'll see how in one line of code we can create professional-looking chart stocks


Add complex indicators from the TTR package on a chart.. Get familiar with creating custom indicators and adding them to charts.


An easy way to create documents of stock market charts in HTML.You can use these for printing, sharing, and saving in a PDF format.

Section 4: Applying Technical Analysis Indicators

We'll create a simple moving average (SMA) from scratch to better understand how technical indicators work. We'll then look and analyze the equivalent indicator available from the TTR package.


Use multiple moving averages to analyze different time frames and look for potential entries and exits. De-trend two moving averages to quantify bullish and bearish periods.


We experiment with a few setting changes on our previous multiple moving average systems and analyze their effects.


A look at trend-following systems and at both the Welles Wilder's Directional Movement Indicator (ADX) and the Volume-Weighted Average Price (VWAP)


A look at counter-trend systems, by going against the short-term trend when contrary to the long-term trend. We'll also look at the look at the Relative Strength Index (RSI), the Commodity Channel Index (CCI), the rate of change (ROC), and the Chaikin Volatility indicators.

Optional: Counter-trend systems - tweaks
Section 5: Tracking Profit and Loss for Fun!

We will add exits to our earlier systems and create a function to track profits and losses. We will also visualize our entries and exits on charts.

Section 6: Analyzing Stocks in Groups

We will add exits to our earlier systems and create a function to track profits and losses. We will also visualize our entries and exits on charts.


We'll analyze a small basket of stocks reflected in the QQQ index. We'll also look at percent of times each stock move in the direction of the index.


We'll look at using the correlation function on our market data and splitting by various time periods.

Applying correlations to entries and other experiments.
Section 7: Conclusions
Closing notes

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Manuel Amunategui, Data Scientist & Quantitative Developer

I am data scientist in the healthcare industry. I have been applying machine learning and predictive analytics to better patients lives for the past 3 years. Prior to that I was a developer on a trading desk on Wall Street for 6 years. On the personal side, I love data science competitions and hackathons - people often ask me how can one break into this field, to which I reply: 'join an online competition!'

Ready to start learning?
Take This Course