Predictive Hacks

Candlestick Charts in R

candlestick in R

We have written many posts related to stocks. A good way to represent the stock prices as time series is with Candlestick Charts.

Candlestick Charts in R 1

Let’s see how we can easily produce candlestick charts with R. We will work with the quantmod library and with the AMZN stock.

library("quantmod")    


# get the Amazon Stock data
Amazon<-getSymbols("AMZN", 
           from = "2020-01-01", 
           to = "2021-03-17",
           periodicity = "daily",
           auto.assign=FALSE)

chartSeries(Amazon, name="Amazon Chart")
Candlestick Charts in R 2

chartSeries(Amazon, name="Amazon Chart", subset = "last 2 months")
Candlestick Charts in R 3
chartSeries(Amazon, name="Amazon Chart", subset = "2021", theme="white")
Candlestick Charts in R 4

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Leave a Comment

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

snowflake
Miscellaneous

How to Schedule Tasks in Snowflake

We have started a series of Snowflake tutorials, like How to Get Data from Snowflake using Python, How to Load