Pine 脚本 tradingview 警报问题。条件不同

Pine script tradingview alert problem. Different conditions

我有这段代码

if(condition)
 crb=true
plotchar(crB,text="Long",color=color.green)
alertcondition(crB, title='Long', message='Long')

所以,plotchar 如我所料 - 很好。 但是 alertcondition 必须与 plotchar 一样工作,因为条件相同。 但它的工作方式不同:当我有一个 plotchar -> alert doenst 工作时,我需要在不同条件下通过 UI 打开警报。

问题是:

错误示例:

Can I make alert through code? Without turning alert through UI?

您必须手动启用警报。我建议您阅读 this and this 页。

Can I make same conditions with alert and plotchar any other ways?

您可以对这两个函数应用相同或不同的条件。但是无论如何您都必须手动设置警报。