I want to build a zigzag along the highs and candle catches
set.seed(1)
library(quantmod)
library(TTR)
getSymbols(Symbols ="SPY", from ="2005-01-01", to ="2005-05-01")
zig <- SPY |> HL() |> coredata() |> ZigZag(change = 0.01)
But I get strange calculations from the indicator
myTheme <- chart_theme()
myTheme$col$up.col <- "#7FFF7F"
myTheme$col$dn.col <- "#FF7F7F"
myTheme$col$dn.border <- 'lightgray'
myTheme$col$up.border <- 'lightgray'
chart_Series(SPY, theme = myTheme)
lines(zig, col=4)
Where do these fractures come from? They obviously shouldn’t exist.