如何解决在 Pine-Script 中,如何为我的条目编码两个条件?
有人可以帮忙,因为我需要进入条件才能将 BraidFilter 指标包含到我的策略中。我只需要在绿色柱线时做多交易,当红色柱线穿过过滤线时做空交易。这就是我所做的,但它不起作用,我收到了大量错误消息: 请帮忙。谢谢。
//-- Braid Filter
ma01 = ma(maType,close,Period1)
ma02 = ma(maType,open,Period2)
ma03 = ma(maType,Period3)
max = max(max(ma01,ma02),ma03)
min = min(min(ma01,ma03)
dif = max - min
filter = atr(14) * PipsMinSepPercent / 100
//-- Plots/=
//BraidColor = ma01 > ma02 and dif > filter ? color.green : ma02 > ma01 and dif > filter ? color.red : color.gray
//plot(dif,"Braid",BraidColor,5,plot.style_columns)
//plot(filter,"Filter",color.blue,2,plot.style_line)
//bgcolor(BraidColor)
// Condition
C1Price1 = 0.0
C1Price2 = 0.0
C1Price1 := ? ma01 > ma02 and dif > filter
C1Price2 := ? ma02 > ma01 and dif > filter
c1Cross_Long = crossover (C1Price1,C1Price2) and C1Price1 > filter
c1Cross_Short = crossover (C1Price1,C1Price2) and C1Price2 > filter
解决方法
该代码中缺少一些东西,首先您必须使用策略定义脚本,然后定义 maType 变量,此外:
C1Price1: =**?** ma01> ma02 and dif> filter
C1Price2: =**?** ma02> ma01 and dif> filter
在“?”之前必须有条件满足,我觉得那里有东西被删除了,纠正后你必须写条目。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。