我正在寻找一个解决方案,以某种方式打开和关闭我的战略的一个特定功能,这样我就可以很容易地看到结果如何在tradingview上发生变化。
这里有一个例子。我修改了我的策略,所以我只在特定的时间内进行新的交易。
tradinghours = time(timeframe.period, "0800-2200", "GMT+1") bgcolor(not na(tradinghours) ? color.rgb(73, 196, 78, 75) : na) time_condition = not na(tradinghours) if (inDateRange and LongEntry and time_condition) strategy.entry("long", strategy.long, comment="entry long")
我就是这样想的:
FilterTradeTime = input.string(defval='On',title='Filter 0800-2200',options=['On','Off']) FilterTradeTimeOn = if (FilterTradeTime=="On") 1 else 0 tradinghours = time(timeframe.period, "0800-2200", "GMT+1") time_condition = not na(tradinghours) if (FilterTradeTimeOn==1) time_condition := not na(tradinghours) bgcolor(not na(tradinghours) ? color.rgb(73, 196, 78, 75) : na) else time_condition := na(tradinghours) if (inDateRange and LongEntry and time_condition) strategy.entry("long", strategy.long, comment="entry long")
我总是收到通知不能在本地范围内使用“bgcolor”
我该如何更改?有没有更简单的方法来编码?期待一些反馈:)