Guest User

Untitled

a guest
Dec 14th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. library(plotly)
  2. library(quantmod)
  3.  
  4. getSymbols("SPY", auto.assign = F) %>%
  5. data.frame(date = index(.), .) %>%
  6. mutate(SPY.EVWMA = TTR::EVWMA(SPY.Adjusted, SPY.Volume, 15),
  7. SPY.SMA = TTR::SMA(SPY.Adjusted, 15)) %>%
  8. tail(60) %>%
  9. plot_ly(., x = ~date, y = ~SPY.Adjusted) %>%
  10. add_lines(name = "SPY.Adjusted") %>%
  11. add_lines(y = ~SPY.EVWMA, name = "SPY.EVWMA(15)") %>%
  12. add_lines(y = ~SPY.SMA, name = "SPY.SMA(15)") %>%
  13. plotly::config(collaborate = F, cloud = F, displaylogo = FALSE) %>%
  14. layout(hovermode="compare")
Add Comment
Please, Sign In to add comment