Sunday, 15 January 2012

r - an alternative Quantmod ZigZag overlay -



r - an alternative Quantmod ZigZag overlay -

i'm using quantmod zigzag overlay , noticed calculated bit differently original overlay. i've demonstrated difference in next picture of rdwr using zigzag(5%) quantmod , different program. can see quantmod missing allot of important points peaks , highs. can see difference pretty when using stockcharts.

i think it's because of way quantmod smooth trend. algorithm should using both high & low values , not average cost or other regression. wondering if quantmod or maybe ttr provide alternative zigzag overlay produced desired output (illustrated in upper part of picture).

thanks.

the code displaying quantmod output in image

s<-get(getsymbols('rdwr'))["2012-07::"] chart_series(s) add_ta(zigzag(s,5),on=1)

the problem ?zigzag says input should high/low cost series , provided ohlcva series. works correctly if provide high/low series.

s <- getsymbols('rdwr', auto.assign=false) chart_series(s, subset="2012-07::") add_ta(zigzag(s[,2:3],5),on=1)

r quantmod

No comments:

Post a Comment