另一种 Quantmod ZigZag 叠加 [英] an alternative Quantmod ZigZag overlay
问题描述
我目前正在使用 quantmod
ZigZag 叠加层,我注意到它的计算方式与原始叠加层略有不同.我已经在下面的 图片 中展示了使用 ZigZag(5%) 和 quantmod
和一个不同的程序.如您所见,quantmod
缺少重要的峰值和高点.使用 股票图表.
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.
我认为这是因为 quantmod
平滑趋势的方式.该算法应该同时使用 high &低价值,而不仅仅是平均价格或其他一些回归.我想知道 quantmod
或 TTR
是否提供了一个替代的 ZigZag 覆盖来产生所需的输出(如图所示).
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).
谢谢.
图片中显示quantmod
输出的代码是
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)
推荐答案
问题在于 ?ZigZag
说输入应该是高/低价格系列,而您提供的是 OHLCVA 系列.如果您提供高/低系列,它可以正常工作.
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)
这篇关于另一种 Quantmod ZigZag 叠加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!