OPEN-SOURCE SCRIPT
Futures Previous Day Levels (5PM NY) BARTRADER

//version=5
indicator("Futures Previous Day Levels (5PM NY)", overlay=true)
// ─── CONFIGURACIÓN ─────────────────────────────────────────────────────────────
tz = "America/New_York"
sessionResetHour = 17 // 5:00 PM NY
// ─── TIEMPO ────────────────────────────────────────────────────────────────────
t = time(timeframe.period, tz)
h = hour(t)
m = minute(t)
// Detecta la vela exacta de las 5:00 PM
isSessionReset = (h == sessionResetHour and m == 0)
// ─── VARIABLES DEL DÍA EN CURSO ────────────────────────────────────────────────
var float dayHigh = na
var float dayLow = na
// ─── VARIABLES DEL DÍA ANTERIOR ────────────────────────────────────────────────
var float prevHigh = na
var float prevLow = na
var float prevClose = na
var float prevMid = na
// ─── INICIALIZACIÓN ────────────────────────────────────────────────────────────
if na(dayHigh)
dayHigh := high
dayLow := low
// ─── ACTUALIZAR HIGH / LOW DEL DÍA ─────────────────────────────────────────────
dayHigh := math.max(dayHigh, high)
dayLow := math.min(dayLow, low)
// ─── RESET A LAS 5:00 PM (CIERRE FUTUROS) ──────────────────────────────────────
if isSessionReset
prevHigh := dayHigh
prevLow := dayLow
prevClose := close[1]
prevMid := (prevHigh + prevLow) / 2
// Reset para el nuevo día
dayHigh := high
dayLow := low
// ─── DIBUJAR NIVELES ───────────────────────────────────────────────────────────
plot(prevHigh, title="Prev Day High", color=color.red, linewidth=2, style=plot.style_linebr)
plot(prevLow, title="Prev Day Low", color=color.green, linewidth=2, style=plot.style_linebr)
plot(prevMid, title="Prev Day Mid", color=color.orange, linewidth=2, style=plot.style_linebr)
plot(prevClose, title="Prev Day Close", color=color.purple, linewidth=2, style=plot.style_linebr)
indicator("Futures Previous Day Levels (5PM NY)", overlay=true)
// ─── CONFIGURACIÓN ─────────────────────────────────────────────────────────────
tz = "America/New_York"
sessionResetHour = 17 // 5:00 PM NY
// ─── TIEMPO ────────────────────────────────────────────────────────────────────
t = time(timeframe.period, tz)
h = hour(t)
m = minute(t)
// Detecta la vela exacta de las 5:00 PM
isSessionReset = (h == sessionResetHour and m == 0)
// ─── VARIABLES DEL DÍA EN CURSO ────────────────────────────────────────────────
var float dayHigh = na
var float dayLow = na
// ─── VARIABLES DEL DÍA ANTERIOR ────────────────────────────────────────────────
var float prevHigh = na
var float prevLow = na
var float prevClose = na
var float prevMid = na
// ─── INICIALIZACIÓN ────────────────────────────────────────────────────────────
if na(dayHigh)
dayHigh := high
dayLow := low
// ─── ACTUALIZAR HIGH / LOW DEL DÍA ─────────────────────────────────────────────
dayHigh := math.max(dayHigh, high)
dayLow := math.min(dayLow, low)
// ─── RESET A LAS 5:00 PM (CIERRE FUTUROS) ──────────────────────────────────────
if isSessionReset
prevHigh := dayHigh
prevLow := dayLow
prevClose := close[1]
prevMid := (prevHigh + prevLow) / 2
// Reset para el nuevo día
dayHigh := high
dayLow := low
// ─── DIBUJAR NIVELES ───────────────────────────────────────────────────────────
plot(prevHigh, title="Prev Day High", color=color.red, linewidth=2, style=plot.style_linebr)
plot(prevLow, title="Prev Day Low", color=color.green, linewidth=2, style=plot.style_linebr)
plot(prevMid, title="Prev Day Mid", color=color.orange, linewidth=2, style=plot.style_linebr)
plot(prevClose, title="Prev Day Close", color=color.purple, linewidth=2, style=plot.style_linebr)
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.