【发布时间】:2019-05-29 01:47:02
【问题描述】:
TradingView PineScript 代码。当它从 true 变为 false 和 false 变为 true 时需要一个警报。
//@version=2
study
threshold = input(title="Threshold", type=float, defval=0.0014,
step=0.0001)
buying = l3_0 > threshold ? true : l3_0 < -threshold ? false : buying[1]
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=50)
plot(l3_0, color=aqua, title="prediction")
//longCondition = buying
//if (longCondition)
// strategy.entry("Long", strategy.long)
//shortCondition = buying != true
//if (shortCondition)
// strategy.entry("Short", strategy.short)
已将其更改为研究。作为一种策略,它发出警报并在图表上绘制方向。将其更改为一项研究,但警报仅应在更改时才发出。在我的研究中,它会提醒每一根蜡烛,而不是改变。我尝试的任何方法都会在每根蜡烛上给出多头或空头。
【问题讨论】:
-
你看到我对你其他问题的回答了吗? stackoverflow.com/a/56287886/7209631
-
你认为哪一行给了你警报?你的大部分代码都被注释掉了。
-
谢谢巴里斯。是的,我确实收到了您的答复。花了几天时间尝试添加到我的脚本中,但无法使其工作。我还在学习代码。了解基础,能看懂部分代码。尝试破解它但无法使其工作。你能帮我看看这个吗?收到任何建议。
-
嗨,Reportgunner。代码最初是一种策略。因此注释掉了。我把它留在了,因为我认为它可能会有所帮助。进入/退出策略是我在研究中所追求的。只有当它由真变为假或由假变为真时。需要退出买入进入卖出。
标签: pine-script