Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(plotly)
- library(quantmod)
- getSymbols("SPY", auto.assign = F) %>%
- data.frame(date = index(.), .) %>%
- mutate(SPY.EVWMA = TTR::EVWMA(SPY.Adjusted, SPY.Volume, 15),
- SPY.SMA = TTR::SMA(SPY.Adjusted, 15)) %>%
- tail(60) %>%
- plot_ly(., x = ~date, y = ~SPY.Adjusted) %>%
- add_lines(name = "SPY.Adjusted") %>%
- add_lines(y = ~SPY.EVWMA, name = "SPY.EVWMA(15)") %>%
- add_lines(y = ~SPY.SMA, name = "SPY.SMA(15)") %>%
- plotly::config(collaborate = F, cloud = F, displaylogo = FALSE) %>%
- layout(hovermode="compare")
Add Comment
Please, Sign In to add comment