PROTECTED SOURCE SCRIPT
Premarket Break 5m (Close Above/Below Prem High/Low)

//version=5
indicator("Premarket Break 5m (Close Above/Below Prem High/Low)", overlay = true)
// === SETTINGS ===
premarketSession = input.session("0400-0930", "Premarket Session (ET)")
regularSession = input.session("0930-1600", "Regular Session (ET)")
// === HELPERS ===
isNewDay = ta.change(time("D")) != 0
// Track premarket high/low each day
var float pmHigh = na
var float pmLow = na
// Reset at the start of each new day
if isNewDay
pmHigh := na
pmLow := na
// Are we inside premarket session?
inPremarket = not na(time(timeframe.period, premarketSession, "America/New_York"))
// Update premarket high/low during premarket
if inPremarket
pmHigh := na(pmHigh) ? high : math.max(pmHigh, high)
pmLow := na(pmLow) ? low : math.min(pmLow, low)
// Are we inside regular session?
inRegular = not na(time(timeframe.period, regularSession, "America/New_York"))
// === SIGNALS: 5m close above/below premarket high/low ===
// Require previous close to be on the other side to avoid spam
bullBreak = inRegular and not na(pmHigh) and close > pmHigh and close[1] <= pmHigh
bearBreak = inRegular and not na(pmLow) and close < pmLow and close[1] >= pmLow
// === PLOTS ===
plot(pmHigh, title = "Premarket High", color = color.new(color.green, 0), linewidth = 2)
plot(pmLow, title = "Premarket Low", color = color.new(color.red, 0), linewidth = 2)
plotshape(bullBreak, title = "Close Above Prem High", style = shape.labelup,
text = "Close > PM High", location = location.belowbar, size = size.tiny)
plotshape(bearBreak, title = "Close Below Prem Low", style = shape.labeldown,
text = "Close < PM Low", location = location.abovebar, size = size.tiny)
// === ALERTS ===
// These fire once per bar close when the condition is true
if bullBreak
alert("5m candle CLOSED above Premarket High.", alert.freq_once_per_bar_close)
if bearBreak
alert("5m candle CLOSED below Premarket Low.", alert.freq_once_per_bar_close)
indicator("Premarket Break 5m (Close Above/Below Prem High/Low)", overlay = true)
// === SETTINGS ===
premarketSession = input.session("0400-0930", "Premarket Session (ET)")
regularSession = input.session("0930-1600", "Regular Session (ET)")
// === HELPERS ===
isNewDay = ta.change(time("D")) != 0
// Track premarket high/low each day
var float pmHigh = na
var float pmLow = na
// Reset at the start of each new day
if isNewDay
pmHigh := na
pmLow := na
// Are we inside premarket session?
inPremarket = not na(time(timeframe.period, premarketSession, "America/New_York"))
// Update premarket high/low during premarket
if inPremarket
pmHigh := na(pmHigh) ? high : math.max(pmHigh, high)
pmLow := na(pmLow) ? low : math.min(pmLow, low)
// Are we inside regular session?
inRegular = not na(time(timeframe.period, regularSession, "America/New_York"))
// === SIGNALS: 5m close above/below premarket high/low ===
// Require previous close to be on the other side to avoid spam
bullBreak = inRegular and not na(pmHigh) and close > pmHigh and close[1] <= pmHigh
bearBreak = inRegular and not na(pmLow) and close < pmLow and close[1] >= pmLow
// === PLOTS ===
plot(pmHigh, title = "Premarket High", color = color.new(color.green, 0), linewidth = 2)
plot(pmLow, title = "Premarket Low", color = color.new(color.red, 0), linewidth = 2)
plotshape(bullBreak, title = "Close Above Prem High", style = shape.labelup,
text = "Close > PM High", location = location.belowbar, size = size.tiny)
plotshape(bearBreak, title = "Close Below Prem Low", style = shape.labeldown,
text = "Close < PM Low", location = location.abovebar, size = size.tiny)
// === ALERTS ===
// These fire once per bar close when the condition is true
if bullBreak
alert("5m candle CLOSED above Premarket High.", alert.freq_once_per_bar_close)
if bearBreak
alert("5m candle CLOSED below Premarket Low.", alert.freq_once_per_bar_close)
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, ücretsiz ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgiyi buradan edinebilirsiniz.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, ücretsiz ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgiyi buradan edinebilirsiniz.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.