0

I try to get alerts for some conditions but nothing happens. Manual didn't help.

This test code doesn't trigger any error message but no alerts displayed.

alert(close[1] < open[1] ? "Close was lower than Open" : na, alert.freq_once_per_bar)
alert(close[1] > open[1] ? "Close was higher than Open" : na, alert.freq_once_per_bar)

In the Manual, there's an IF cycle but it also do nothing:

if close[1] < open[1]
    alert("Close was lower than Open", alert.freq_once_per_bar)

if close[1] > open[1]
    alert("Close was higher than Open", alert.freq_once_per_bar)

So I'm confused. What do I wrong?

Vendrel
  • 865
  • 9
  • 19

1 Answers1

2

Once you create an alert on your script, you must manually set it up on your pinescript chart.
To do so, click on the alarm clock on the right of the screen, and then, in Condition, choose the name of your script.
Your alert will trigger. enter image description here

G.Lebret
  • 2,826
  • 2
  • 16
  • 27
  • Thank you! And where will the text: "Close was lower than Open" etc. be displayed? It seems it overrides any in-code text with that "Alert name". :) – Vendrel Nov 27 '22 at 20:33