这是用于交易视图的松树脚本的一部分。在“//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)