addSMA not drawn on graph when called from function

后端 未结 1 558
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-06 13:47

I am a newbie for R and have got stuck here. I am trying to draw a graph with price, sma and ema.

When I call the graph from the command line it draws fine includin

相关标签:
1条回答
  • 2020-12-06 14:06

    wrap plot around your add* calls.

    plot(addSMA(10))
    plot(addEMA(10))
    

    I think you could also just add these in the lineChart call instead. (untested)

    lineChart(ydat.monthly["1998/"], TA="addSMA(10);addEMA(10)", name=paste(tickers[x],"Monthly & 10 Month Moving Average"))
    
    0 讨论(0)
提交回复
热议问题