Import stock prices

## # A tibble: 1,992 x 7
##    date        open  high   low close    volume adjusted
##    <date>     <dbl> <dbl> <dbl> <dbl>     <dbl>    <dbl>
##  1 2011-01-03  127.  128.  126.  127. 138725200     109.
##  2 2011-01-04  127.  127.  126.  127. 137409700     109.
##  3 2011-01-05  127.  128.  126.  128. 133975300     109.
##  4 2011-01-06  128.  128.  127.  127. 122519000     109.
##  5 2011-01-07  128.  128.  126.  127. 156034600     109.
##  6 2011-01-10  127.  127.  126.  127. 122401700     109.
##  7 2011-01-11  127.  128.  127.  127. 110287000     109.
##  8 2011-01-12  128.  129.  127.  129. 107929200     110.
##  9 2011-01-13  129.  129.  128.  128. 129048400     110.
## 10 2011-01-14  128.  129.  128.  129. 117677900     111.
## # ... with 1,982 more rows

Moving Average Crossover

## # A tibble: 1,992 x 9
##    date        open  high   low close    volume adjusted SMA.50 SMA.200
##    <date>     <dbl> <dbl> <dbl> <dbl>     <dbl>    <dbl>  <dbl>   <dbl>
##  1 2011-01-03  127.  128.  126.  127. 138725200     109.     NA      NA
##  2 2011-01-04  127.  127.  126.  127. 137409700     109.     NA      NA
##  3 2011-01-05  127.  128.  126.  128. 133975300     109.     NA      NA
##  4 2011-01-06  128.  128.  127.  127. 122519000     109.     NA      NA
##  5 2011-01-07  128.  128.  126.  127. 156034600     109.     NA      NA
##  6 2011-01-10  127.  127.  126.  127. 122401700     109.     NA      NA
##  7 2011-01-11  127.  128.  127.  127. 110287000     109.     NA      NA
##  8 2011-01-12  128.  129.  127.  129. 107929200     110.     NA      NA
##  9 2011-01-13  129.  129.  128.  128. 129048400     110.     NA      NA
## 10 2011-01-14  128.  129.  128.  129. 117677900     111.     NA      NA
## # ... with 1,982 more rows
## # A tibble: 5,976 x 3
##    date       type  price
##    <date>     <chr> <dbl>
##  1 2011-01-03 close  127.
##  2 2011-01-04 close  127.
##  3 2011-01-05 close  128.
##  4 2011-01-06 close  127.
##  5 2011-01-07 close  127.
##  6 2011-01-10 close  127.
##  7 2011-01-11 close  127.
##  8 2011-01-12 close  129.
##  9 2011-01-13 close  128.
## 10 2011-01-14 close  129.
## # ... with 5,966 more rows

Bollinger Bands

## # A tibble: 1,992 x 9
##    date        open  high   low close    volume adjusted   SMA    SD
##    <date>     <dbl> <dbl> <dbl> <dbl>     <dbl>    <dbl> <dbl> <dbl>
##  1 2011-01-03  127.  128.  126.  127. 138725200     109.    NA    NA
##  2 2011-01-04  127.  127.  126.  127. 137409700     109.    NA    NA
##  3 2011-01-05  127.  128.  126.  128. 133975300     109.    NA    NA
##  4 2011-01-06  128.  128.  127.  127. 122519000     109.    NA    NA
##  5 2011-01-07  128.  128.  126.  127. 156034600     109.    NA    NA
##  6 2011-01-10  127.  127.  126.  127. 122401700     109.    NA    NA
##  7 2011-01-11  127.  128.  127.  127. 110287000     109.    NA    NA
##  8 2011-01-12  128.  129.  127.  129. 107929200     110.    NA    NA
##  9 2011-01-13  129.  129.  128.  128. 129048400     110.    NA    NA
## 10 2011-01-14  128.  129.  128.  129. 117677900     111.    NA    NA
## # ... with 1,982 more rows
## # A tibble: 1,992 x 11
##    date        open  high   low close volume adjusted   SMA    SD sd2up
##    <date>     <dbl> <dbl> <dbl> <dbl>  <dbl>    <dbl> <dbl> <dbl> <dbl>
##  1 2011-01-03  127.  128.  126.  127. 1.39e8     109.    NA    NA    NA
##  2 2011-01-04  127.  127.  126.  127. 1.37e8     109.    NA    NA    NA
##  3 2011-01-05  127.  128.  126.  128. 1.34e8     109.    NA    NA    NA
##  4 2011-01-06  128.  128.  127.  127. 1.23e8     109.    NA    NA    NA
##  5 2011-01-07  128.  128.  126.  127. 1.56e8     109.    NA    NA    NA
##  6 2011-01-10  127.  127.  126.  127. 1.22e8     109.    NA    NA    NA
##  7 2011-01-11  127.  128.  127.  127. 1.10e8     109.    NA    NA    NA
##  8 2011-01-12  128.  129.  127.  129. 1.08e8     110.    NA    NA    NA
##  9 2011-01-13  129.  129.  128.  128. 1.29e8     110.    NA    NA    NA
## 10 2011-01-14  128.  129.  128.  129. 1.18e8     111.    NA    NA    NA
## # ... with 1,982 more rows, and 1 more variable: sd2down <dbl>
## # A tibble: 7,968 x 3
##    date       type  price
##    <date>     <chr> <dbl>
##  1 2011-01-03 close  127.
##  2 2011-01-04 close  127.
##  3 2011-01-05 close  128.
##  4 2011-01-06 close  127.
##  5 2011-01-07 close  127.
##  6 2011-01-10 close  127.
##  7 2011-01-11 close  127.
##  8 2011-01-12 close  129.
##  9 2011-01-13 close  128.
## 10 2011-01-14 close  129.
## # ... with 7,958 more rows

How to interpret moving average crossover

How to interpret bollinger bands

Q1 Import S&P 500 Index.

Q2 Filter for the period between 2018-01-01 and 2018-11-28. Do this for both plots: the moving average crossover and the Bollinger Bands.

Q3 The stock market plummeted since its October high. If you followed the moving average crossover blindly, what should you have done since the last October? Buy or sell?

After the initial drop of the SMA 50, I would have closely watched the price of the stock. Since it continued to drop, I would have sold the stock as the 50 day moving average got gradually closer to the 200 day moving average before crossing it.

Q4 If you followed the Bollinger Bands instead, what should you have done since the last October? Buy or sell?

Hypothetically, if I had been watching the Bollinger Bands, I probably would have invested in more stock. Previously, the stock price had been moving as expected based on the bands. After hitting a higher or lower standard deviation, the price was reacting by moving the opposite way. I would have assumed that after the price beagn lowering in October, it would eventually begin to rise again as it did in March and April. instead, the price only fluctuated briefly after almost hitting the top band before quickly dropping again.

Q5 How effective is the Bollinger Bands? For example, would you have made profits by following the Bollinger Bands since the beginning of 2018? Explain.

Bollinger Bands can be pretty effective to a certain point, however become less reliable when a market is very volatile. I don’t think an investor can fully rely on Bollinger Bands only. If I soley used the bands, I would have made a solid profit if I had sold at the end of September. However, the trend of the bands would have made me to believe that the price would eventually rise after its intial fall in October. However, since that was not the case, I probably would not have made much profit, because the price lowered back near to what the stock was bought for at the beginning of 2018.

Q6 Which of the two appears to be more appropriate for short-term?

Bollinger bands are more appropriate for short term stock evaluation, but become less effective over time as the market becomes more volatile.

Q7 Construct the Bollinger Band plot of the Nasdaq Composite Index for the same period. Do this by copying and pasting the necessary code from the above. Would you have made profits by following the BB since the beginning of 2018?

## # A tibble: 1,992 x 7
##    date        open  high   low close     volume adjusted
##    <date>     <dbl> <dbl> <dbl> <dbl>      <dbl>    <dbl>
##  1 2011-01-03 2677. 2705. 2676. 2692. 1919660000    2692.
##  2 2011-01-04 2700. 2701. 2664. 2681. 2015440000    2681.
##  3 2011-01-05 2674. 2702. 2672. 2702. 2060750000    2702.
##  4 2011-01-06 2704. 2712. 2698. 2710. 2095490000    2710.
##  5 2011-01-07 2713. 2716. 2676. 2703. 1976220000    2703.
##  6 2011-01-10 2691. 2712. 2682. 2708. 1868870000    2708.
##  7 2011-01-11 2720. 2723. 2707. 2717. 1893100000    2717.
##  8 2011-01-12 2731. 2737. 2722. 2737. 1873960000    2737.
##  9 2011-01-13 2735. 2742. 2727. 2735. 1923900000    2735.
## 10 2011-01-14 2732. 2755. 2730. 2755. 2020210000    2755.
## # ... with 1,982 more rows
## # A tibble: 1,992 x 11
##    date        open  high   low close volume adjusted   SMA    SD sd2up
##    <date>     <dbl> <dbl> <dbl> <dbl>  <dbl>    <dbl> <dbl> <dbl> <dbl>
##  1 2011-01-03 2677. 2705. 2676. 2692. 1.92e9    2692.    NA    NA    NA
##  2 2011-01-04 2700. 2701. 2664. 2681. 2.02e9    2681.    NA    NA    NA
##  3 2011-01-05 2674. 2702. 2672. 2702. 2.06e9    2702.    NA    NA    NA
##  4 2011-01-06 2704. 2712. 2698. 2710. 2.10e9    2710.    NA    NA    NA
##  5 2011-01-07 2713. 2716. 2676. 2703. 1.98e9    2703.    NA    NA    NA
##  6 2011-01-10 2691. 2712. 2682. 2708. 1.87e9    2708.    NA    NA    NA
##  7 2011-01-11 2720. 2723. 2707. 2717. 1.89e9    2717.    NA    NA    NA
##  8 2011-01-12 2731. 2737. 2722. 2737. 1.87e9    2737.    NA    NA    NA
##  9 2011-01-13 2735. 2742. 2727. 2735. 1.92e9    2735.    NA    NA    NA
## 10 2011-01-14 2732. 2755. 2730. 2755. 2.02e9    2755.    NA    NA    NA
## # ... with 1,982 more rows, and 1 more variable: sd2down <dbl>
## # A tibble: 7,968 x 3
##    date       type  price
##    <date>     <chr> <dbl>
##  1 2011-01-03 close 2692.
##  2 2011-01-04 close 2681.
##  3 2011-01-05 close 2702.
##  4 2011-01-06 close 2710.
##  5 2011-01-07 close 2703.
##  6 2011-01-10 close 2708.
##  7 2011-01-11 close 2717.
##  8 2011-01-12 close 2737.
##  9 2011-01-13 close 2735.
## 10 2011-01-14 close 2755.
## # ... with 7,958 more rows

Similarily to the S&P 500 index, the Nasdaq Composite had almost identical price movements.The price began to drop in October and did not rise as much as it had previously after hitting the lower bands. Most likely, I would have made little to no profit if I did not sell my shares before October.

Q8 (Continued from Q7) What would you consider changing to make it more effective?

I would either filter my Bollinger Band plot for a shorter time period or maybe try using a smaller standard deviation. Since using Bollinger Bands is less effective over a longer period of time, I would look at past trends in shorter time frames. This way, I could analyse short term movements and sell my stock before I predict when the price might drop drastically.