an alternative Quantmod ZigZag overlay

空扰寡人 提交于 2019-12-06 00:11:56

问题


i'm currently using quantmod ZigZag overlay and i noticed it is calculated a bit differently then the original overlay. I've demonstrated the difference in the following picture of RDWR using ZigZag(5%) with quantmod and a with a different program. as you can see quantmod is missing allot of significant points peaks and highs. you can also see the difference pretty clearly when using StockCharts.

I think it's because of the way quantmod smooth the trend. the algorithm should be using both high & low values and not just an average price or some other regression. i was wondering if quantmod or maybe TTR provide an alternative ZigZag overlay that will produced the desired output (illustrated in the upper part of the picture).

Thanks.

the code for displaying the quantmod output in the picture is

s<-get(getSymbols('rdwr'))["2012-07::"]
chart_Series(s)
add_TA(ZigZag(s,5),on=1)

回答1:


The problem is that ?ZigZag says the input should be a high/low price series and you provided an OHLCVA series. It works correctly if you provide a high/low series.

s <- getSymbols('rdwr', auto.assign=FALSE)
chart_Series(s, subset="2012-07::")
add_TA(ZigZag(s[,2:3],5),on=1)



来源:https://stackoverflow.com/questions/14792128/an-alternative-quantmod-zigzag-overlay

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!