cant understand why I get multiple triggers from the following code. even on the same bar in 1 case. by using the not statement as as soon as the alert is triggered there should not be any trades until it is reset for the new day. I do not want to wait for the bar to form, I want it as soon as as the price (close) crosses the PP
kind regards
newDay = bool(ta.change(time('D'))) t = str.format_time(time, " HH:mm", "UTC+2")
EMA_1 = ta.ema(close, emaL)
// Variables creation
var traded_today = false
var traded_today1 = false
if newDay
traded_today := false
traded_today1 := false
if newDay and IsInSession and open >= PP and EMA_1 > vS1 and EMA_1 < close
startAboveP := true
P_Trade = open > PP and close <= PP
longReady = not traded_today and startAboveP
longtrade = not traded_today1 and IsInSession and startAboveP and P_Trade
// ENTRY
if longReady
traded_today := true
if longtrade
traded_today1 := true
alert("Buy " + syminfo.ticker + " now " + "n TP1 " + str.tostring(vR1, format.mintick) + "n SL " + str.tostring(vS1, format.mintick) + "n Pivot_Buy" + "nn Time Stamp of triggern" + "nn Time of trade " + str.tostring(t) , alert.freq_once_per_bar)