Why does it trigger multiple times after the alert conditions have been met for the alertcondition(confirmed_signal, title="Price crosses upper range with confirmation", message="Price has crossed the upper range with confirmation") ?
I am using the lower_range_confirmed
as confirmation for the alert when it cross upper range so that if lower range is my exit the alert would need to go back to exit and confirm before a second short trigger.
var lower_range_confirmed = false
if close < offset1
lower_range_confirmed := true
//alert condition for the second VWAP (upper range) with confirmation
price2 = close
confirmed_signal = price2 > offset2 and lower_range_confirmed
alertcondition(confirmed_signal, title="Price crosses upper range with confirmation", message="Price has crossed the upper range with confirmation")
// Reset the confirmation flag after the lower range trigger
if confirmed_signal
lower_range_confirmed := false