Pine脚本代码为策略给出错误.入口函数



根据我的代码,下面是买入和卖出信号

buySignal = low < lower[1] and close > lower and close > open or close > upper and ta.crossover(rsiValue,rsiOverbought) and close > open 
sellSignal =  high > upper[1] and close < upper  and close < open or close < lower and ta.crossunder(rsiValue,rsiOversold) and close <open 

它也被正确地绘制在图表上

但是当试图进入

下面时
strategy.entry("Enter Long", strategy.long, stop=buySignal,limit=buySignal + 15 * syminfo.mintick,  oca_name="entries", oca_type=strategy.oca.cancel)

错误提示

不能用参数'expr0'='buySignal'调用'operator +'。一个使用了'系列bool'类型的参数,但使用了'简单浮点数'预期。

逻辑是,如果买入信号条件得到满足,那么它应该触发当前蜡烛高点+ 15(缓冲点)和止损=前蜡烛低点- 15(缓冲点)的止损限价单

有谁能帮我一下吗?

当前蜡烛高度为" high "。
前一个蜡烛的低点是'low '[1]。

变化;

strategy.entry("Enter Long", strategy.long, stop=buySignal,limit=buySignal + 15 * syminfo.mintick,  oca_name="entries", oca_type=strategy.oca.cancel)

:

strategy.entry("Enter Long", strategy.long, stop=low[1] - 15* syminfo.mintick, limit=high + 15 * syminfo.mintick,  oca_name="entries", oca_type=strategy.oca.cancel)

相关内容

最新更新