why dose the alert trigger before the conditions are met what wrong with the if in pine script
i am tring to use longconf as confimation for the trigger but evertime i turn the alert on
it trigger when it crosses below ma3 which isnt part of the condition trigger like is completely ignoring my condition
ma1_above = ta.crossover(close, ma1[offset1])
ma2_above = ta.crossover(close, ma2[offset2])
ma3_above = ta.crossover(close, ma3[offset3])
ma1_below = ta.crossunder(close, ma1[offset1])
ma2_below = ta.crossunder(close, ma2[offset2])
ma3_below = ta.crossunder(close, ma3[offset3])`
// Variables for tracking trade conditions
varip longconf = false
// Logic for trade conditions
if ma1_above and ma2_above and ma3_above
longconf := true`
if ma2_below and ma1_below and longconf
alert("Long entry at " + str.tostring(close), alert.freq_all)
longconf := false`