问题描述
移动平均线似乎在我的时间序列上从右到左绘制。这是我的代码:
library(Quandl)
library(ggplot2)
# Get Historical Futures Prices: Crude Oil Futures from Quandl. Contract Code is CL
CME_CL_Data <- Quandl('CHRIS/CME_CL1',start_date = '2021-01-01')
# Plot the OHLC Barchart of the Crude Oil Futures Historical Prices
ggplot(CME_CL_Data,aes(x = Date,y = Last)) +
geom_barchart(aes(open = Open,high = High,low = Low,close = Last)) +
xlab('') + ylab('Daily Prices') +
ggtitle('Future Daily Prices: WTI Crude') +
geom_ma(ma_fun = SMA,n=20,linetype = 1,size = .75) +
geom_ma(ma_fun = SMA,n=50,color = 'red',size = 1.25) +
theme_light()
这是输出图表:Chart of CL with Moving Averages
我似乎无法确定我正在做什么导致这种情况。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)