0

I've created an indicator in which there are multiple large arrays and crossovers between the values of those arrays. I want to generate alerts when such crossover takes place. I am trying to use for loop to trigger alerts for multiple crossovers of different values. There are no compilation errors but the script is not triggering alerts.

`

for i = 0 to 24
    
    //Crossovers
    cross_1 = ta.crossover(array.get(cvol_s_arr, i), array.get(ema1_arr, i))
    cross_2 = ta.crossover(array.get(cvol_s_arr, i), array.get(ema2_arr, i))
    cross_3 = ta.crossover(array.get(cvol_s_arr, i), array.get(ema3_arr, i))
    
    if cross_1
        alert("" + str.tostring(array.get(s_arr, i))) 
    if cross_2
        alert("" + str.tostring(array.get(s_arr, i)))
    if cross_3
        alert("" + str.tostring(array.get(s_arr, i)))

` I tried generating alerts this way. It did not caused any compilation errors but it didn't trigger any alerts either. If anyone knows how to solve this issue it'll be of great help!

1 Answers1

0

Once your alert() is created on the Pinescript side, you must configure it on the chart.
From the chart, create an alert using the “Create Alert” dialog box and select that indicator or strategy in the “Condition” field like this :

enter image description here

G.Lebret
  • 2,826
  • 2
  • 16
  • 27
  • hey @G.Lebret, thanks for looking into this, it worked! I had no idea that you have to manually configure the alert too. My indicator is working perfectly fine so thank you so much! – Sanket Kolte Nov 28 '22 at 04:25