How to draw stock charts

How to draw stock charts

How do you draw a stock chart?

There are different ways to draw stock charts. Here to plot BMW.DE stock price. It is listed in NASDAQ.

getSymbols("BMW.DE", env = bmw_stock, src = "yahoo", from =
+                as.Date("2010-01-01"), to = as.Date("2019-08-05"))
[1] "BMW.DE"
> BMW<-bmw_stock$BMW.DE
> head(BMW)
           BMW.DE.Open BMW.DE.High
2010-01-04      31.820      32.455
2010-01-05      31.960      32.410
2010-01-06      32.450      33.040
2010-01-07      32.650      33.200
2010-01-08      33.335      33.430
2010-01-11      32.995      33.050
           BMW.DE.Low BMW.DE.Close
2010-01-04     31.820       32.050
2010-01-05     31.785       32.310
2010-01-06     32.360       32.810
2010-01-07     32.380       33.100
2010-01-08     32.515       32.655
2010-01-11     32.110       32.170
           BMW.DE.Volume
2010-01-04       1808170
2010-01-05       1564182
2010-01-06       2218604
2010-01-07       2026145
2010-01-08       1925894
2010-01-11       2157825
           BMW.DE.Adjusted
2010-01-04        22.94292
2010-01-05        23.12905
2010-01-06        23.48697
2010-01-07        23.69456
2010-01-08        23.37601
2010-01-11        23.02882
> chartSeries(BMW,multi.col=TRUE,theme="white")
> addMACD()
> addBBands()
draw stock charts

> BMW_return <-log(BMW$BMW.DE.Close/BMW$BMW.DE.Open)
> qqnorm(BMW_return, main = "Normal Q-Q Plot of BMW daily log return",
+        xlab = "Theoretical Quantiles",
+        ylab = "Sample Quantiles", plot.it = TRUE, datax = FALSE
+ )
> qqline(BMW_return, col="red")
www.mathclasstutor.online

Post a Comment

0 Comments