开发者

newTA SMA OBV How to?

I am trying to create a new indicator in R with quantmod's command newTA but i can't make it.

The indicator is a simple 20-day moving average of the OBV.

so far i tried this

getSymbols("GEK.AT")
addObvma20 <- newTA(SMA(OBV(Cl(GEK.AT), Vo(GEK.AT)), n=20))
# Error in newTA(SMA(OBV(Cl(GEK.AT), Vo(GEK.AT)), n = 20)): FUN required
# to be a function object

and this

addObvma20 <- newTA(SMA(OBV), n=20)
# Error in as.vector(x, mode):cannot coerce type 开发者_开发知识库'closure' to vector of type 'any' 

I would like some help creating this indicator.


Adapting the example from the help page, I think you want addTA rather than newTA.

getSymbols("GEK.AT")
barChart(GEK.AT)
addTA(SMA(OBV(Cl(GEK.AT), Vo(GEK.AT)), n = 20))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜