Hint: Copy and revise the importing part of the code from above.
## # A tibble: 251 x 7
## date open high low close volume adjusted
## <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2018-10-24 301. 304. 286. 288. 20058300 288.
## 2 2018-10-25 317. 321 301. 315. 20840700 315.
## 3 2018-10-26 308. 340. 307. 331. 27425500 331.
## 4 2018-10-29 337. 347. 326. 335. 14486000 335.
## 5 2018-10-30 328. 338. 322. 330. 9126700 330.
## 6 2018-10-31 333. 342 329. 337. 7624300 337.
## 7 2018-11-01 338. 348. 335. 344. 8000100 344.
## 8 2018-11-02 344. 349. 341. 346. 7808000 346.
## 9 2018-11-05 340. 344. 330. 341. 7831000 341.
## 10 2018-11-06 339. 349. 336. 341. 6762900 341.
## # … with 241 more rows
Hint: Copy and revise the moving average part of the code from above.
## # A tibble: 251 x 9
## date open high low close volume adjusted SMA.short SMA.long
## <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2018-10-24 301. 304. 286. 288. 20058300 288. NA NA
## 2 2018-10-25 317. 321 301. 315. 20840700 315. NA NA
## 3 2018-10-26 308. 340. 307. 331. 27425500 331. NA NA
## 4 2018-10-29 337. 347. 326. 335. 14486000 335. NA NA
## 5 2018-10-30 328. 338. 322. 330. 9126700 330. 320. NA
## 6 2018-10-31 333. 342 329. 337. 7624300 337. 330. NA
## 7 2018-11-01 338. 348. 335. 344. 8000100 344. 335. NA
## 8 2018-11-02 344. 349. 341. 346. 7808000 346. 339. NA
## 9 2018-11-05 340. 344. 330. 341. 7831000 341. 340. NA
## 10 2018-11-06 339. 349. 336. 341. 6762900 341. 342. NA
## # … with 241 more rows
Hint: Copy and revise the transformation part of the code from above.
## # A tibble: 753 x 3
## date type price
## <date> <chr> <dbl>
## 1 2018-10-24 close 288.
## 2 2018-10-25 close 315.
## 3 2018-10-26 close 331.
## 4 2018-10-29 close 335.
## 5 2018-10-30 close 330.
## 6 2018-10-31 close 337.
## 7 2018-11-01 close 344.
## 8 2018-11-02 close 346.
## 9 2018-11-05 close 341.
## 10 2018-11-06 close 341.
## # … with 743 more rows
Hint: Copy and revise the visualization part of the code from above.
The time lag would have been 29 days.
## # A tibble: 251 x 7
## date open high low close volume adjusted
## <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2018-10-24 301. 304. 286. 288. 20058300 288.
## 2 2018-10-25 317. 321 301. 315. 20840700 315.
## 3 2018-10-26 308. 340. 307. 331. 27425500 331.
## 4 2018-10-29 337. 347. 326. 335. 14486000 335.
## 5 2018-10-30 328. 338. 322. 330. 9126700 330.
## 6 2018-10-31 333. 342 329. 337. 7624300 337.
## 7 2018-11-01 338. 348. 335. 344. 8000100 344.
## 8 2018-11-02 344. 349. 341. 346. 7808000 346.
## 9 2018-11-05 340. 344. 330. 341. 7831000 341.
## 10 2018-11-06 339. 349. 336. 341. 6762900 341.
## # … with 241 more rows
## # A tibble: 251 x 9
## date open high low close volume adjusted SMA.short SMA.long
## <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2018-10-24 301. 304. 286. 288. 20058300 288. NA NA
## 2 2018-10-25 317. 321 301. 315. 20840700 315. NA NA
## 3 2018-10-26 308. 340. 307. 331. 27425500 331. NA NA
## 4 2018-10-29 337. 347. 326. 335. 14486000 335. NA NA
## 5 2018-10-30 328. 338. 322. 330. 9126700 330. NA NA
## 6 2018-10-31 333. 342 329. 337. 7624300 337. NA NA
## 7 2018-11-01 338. 348. 335. 344. 8000100 344. NA NA
## 8 2018-11-02 344. 349. 341. 346. 7808000 346. NA NA
## 9 2018-11-05 340. 344. 330. 341. 7831000 341. NA NA
## 10 2018-11-06 339. 349. 336. 341. 6762900 341. 331. NA
## # … with 241 more rows
## # A tibble: 753 x 3
## date type price
## <date> <chr> <dbl>
## 1 2018-10-24 close 288.
## 2 2018-10-25 close 315.
## 3 2018-10-26 close 331.
## 4 2018-10-29 close 335.
## 5 2018-10-30 close 330.
## 6 2018-10-31 close 337.
## 7 2018-11-01 close 344.
## 8 2018-11-02 close 346.
## 9 2018-11-05 close 341.
## 10 2018-11-06 close 341.
## # … with 743 more rows
I would change the simple moving average to account for the 15 and 50 day simple moving averages rather than 100 and 50, to 10 and 30.
Hint: Use message
, echo
and results
in the chunk options. Refer to the RMarkdown Reference Guide.