R quantstrat: Note: no visible binding for '<<-' assignment to '.strategy'

会有一股神秘感。 提交于 2019-12-13 05:09:16

问题


I installed R package quantstrat and its depencies as in the following code, as answered in this link:

install.packages("devtools")
require(devtools)
install_github("braverock/FinancialInstrument")
install_github("joshuaulrich/xts")
install_github("braverock/blotter")
install_github("braverock/quantstrat")
install_github("braverock/PerformanceAnalytics")

When installing quantstrat package, I got the following output:

Note: no visible binding for '<<-' assignment to '.strategy' 
Note: no visible binding for '<<-' assignment to 'hold' 

I do not know actually what it means. However, it seems I am not being able to make any transactions.

if I run demo('bbands', ask=FALSE)

I get the following output:

Error in chart.Posn(Portfolio = "bbands", Symbol = stock.str) : no transactions/positions to chart

Session info:
version R version 3.4.4 (2018-03-15) system x86_64, linux-gnu
ui RStudio (1.1.453)
language (EN)
collate en_US.UTF-8
tz America/Cuiaba
date 2018-06-27


回答1:


You can safely ignore the Notes on compiling (I get them too). They won't affect the code adversely in any meaningful way.

Your error:

Error in chart.Posn(Portfolio = "bbands", Symbol = stock.str) : no transactions/positions to chart

Comes about because you have no transactions done in your backtest. So there are no positions to plot. If you had transactions, you wouldn't get this error.

Make sure that startDate is a value that is before the start of your market data. Otherwise addPosLimit may not work as intended and trades don't get generated. (Also, maybe also set your timezone to "UTC" if working with data with Date time indexes). The demo works for me and generates trades.




回答2:


As well answered by @FXQuantTrader, I could ignore the notes. It was a problem with version 0.14.5 where the notes are not relevant. It is fixed in version 0.14.6 and works perfectly now.

source: https://github.com/braverock/quantstrat/issues/88



来源:https://stackoverflow.com/questions/51071941/r-quantstrat-note-no-visible-binding-for-assignment-to-strategy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!