小编Tre*_*ond的帖子

当条件从真/假变为警报条件后。当前在任一条件为真时发出警报。不是当它改变

这是用于交易视图的松树脚本的一部分。在“//Condition”之后的脚本中,我希望仅在条件从多头变为空头或由空头变为多头时生成警报。不是每根蜡烛都像现在这样结束,因为一个条件始终为真。这已更改为一项研究。

threshold = input(title="Threshold", type=float, defval=0.0014, step=0.0001)

buying  = l3_0 > threshold ? true : l3_0 < -threshold ? false : buying[1]
///// T edit
selling = l3_0 > -threshold ? true : l3_0 < threshold ? false : 
selling[1] //// T edit END

hline(0, title="base line")
bgcolor(l3_0 > 0.0014 ? green : l3_0 < -0.0014 ? red : gray, transp=20)
bgcolor(buying ? green : red, transp=20)
plot(l3_0, color=silver, style=area, transp=75)
plot(l3_0, color=aqua, title="prediction")

/////     Stragegy     
/////////////////////////////////////////////////////
//longCondition = buying …
Run Code Online (Sandbox Code Playgroud)

alert conditional-statements pine-script

2
推荐指数
1
解决办法
1849
查看次数