松脚本警报

发布于 2025-01-31 10:06:07 字数 148 浏览 1 评论 0原文

我在通过购买,出售,简短,封面的指示器上设置警报时有问题。

信号的条件是趋势。但是目前,我为每一个蜡烛都有新的警报,我的脚本都处于趋势状态。显然,我只希望它在趋势的第一个栏上。

如何设置我的警报()或AlertCondition(),以便它只会触发一次?

I am having problem with setting up alerts on an indicator with buy, sell, short, cover lables.

The condition for the signals is a when in trend. But at the moment I get a new alert for every candle my script is in trend. And obviously I only want it on the first bar in trend.

How can I set up my alert() or alertcondition() so it only will trigger once?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽袖吟 2025-02-07 10:06:07

您需要有一个变量来检查事件是否更改。

例如,说您想在趋势方向变化时触发警报。

uptrend = ... // Your definition of the uptrend
downtrend = ... // Your definition of the downtrend

is_new_uptrend = not uptrend[1] and uptrend  // It was not an uptrend one bar ago AND it is an uptrend now
is_new_downtrned = not downtrend[1] and downtrend  // It was not a downtrend one bar ago AND it is a downtrend now

alertcondition(is_new_uptrend, "New uptrend")
alertcondition(is_new_downtrend, "New downtrend")

You need to have a variable to check if the event is changed.

For example, say you want to trigger an alert when the trend direction changes.

uptrend = ... // Your definition of the uptrend
downtrend = ... // Your definition of the downtrend

is_new_uptrend = not uptrend[1] and uptrend  // It was not an uptrend one bar ago AND it is an uptrend now
is_new_downtrned = not downtrend[1] and downtrend  // It was not a downtrend one bar ago AND it is a downtrend now

alertcondition(is_new_uptrend, "New uptrend")
alertcondition(is_new_downtrend, "New downtrend")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文