如何使用R中的charts.performanceanalytics绘制累积回报图

问题描述

我设法用两列(日期,累积利润)生成时间序列数据帧(tibble)

a = dayt %>% mutate(buy = ifelse((foreignNetbuy > 0 || instNetbuy > 0) &
                               priceClose < 1500000 &
                               rise > 3 &
                               rise < 25 &
                               candle == 1 &
                               middle > -1 &
                               disparity > 100 &
                               disparity < 120 &
                               amount > 7500000000,1,0)) %>% 
  filter(buy == 1) %>% 
  select(logDate,stockCode,ovnprofit,buy) %>% 
  group_by(logDate) %>%
  summarize(count = sum(buy),avgprofit = mean(ovnprofit,na.rm = TRUE)) %>% 
  mutate(profit = ifelse(count > 60,avgprofit,(avgprofit*count + 60-count)/60)) %>% 
  arrange(logDate) %>% 
  as_tibble() %>% 
  mutate(Date = ymd(logDate),Cumprofit = cumprod(profit)) %>% 
  select(Date,Cumprofit)

enter image description here

我尝试使用 Performanceanalytics 包中的 charts.performancesummary 函数绘制图表, 但失败了。

完成这项工作的正确方法是什么?

charts.PerformanceSummary(a)

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)