OPEN-SOURCE SCRIPT
Marcas minuto cada hora — COMPAT v5

//version=5
indicator("Marcas minuto cada hora — COMPAT v5", overlay=true, max_lines_count=500)
// === Inputs ===
minute1 = input.int(0, "Minuto #1 (0–59)", minval=0, maxval=59)
useMinute2 = input.bool(false, "Añadir Minuto #2")
minute2 = input.int(45, "Minuto #2 (0–59)", minval=0, maxval=59)
col = input.color(color.new(color.blue, 0), "Color de línea")
w = input.int(2, "Grosor", minval=1, maxval=5)
showLabel = input.bool(false, "Mostrar etiqueta HH:MM")
keep = input.int(400, "Máx. líneas a mantener", minval=50, maxval=500)
// === Utilidades ===
f02(x) => x < 10 ? "0" + str.tostring(x) : str.tostring(x)
// === Hora/minuto del gráfico (sin TZ externa) ===
curHour = hour(time) // usa la zona horaria del gráfico
curMin = minute(time) // usa la zona horaria del gráfico
// === Coincidencias de minuto(s) configurados ===
isM1 = curMin == minute1
isM2 = useMinute2 and (minute2 != minute1) and (curMin == minute2)
match = isM1 or isM2
// === Dibujar 1 línea por vela (al cierre) ===
var lines = array.new_line()
if barstate.isconfirmed and match
ln = line.new(bar_index, low, bar_index, high, xloc=xloc.bar_index, extend=extend.none, color=col, width=w)
array.push(lines, ln)
if showLabel
label.new(bar_index, high, f02(curHour) + ":" + f02(curMin),
style=label.style_label_down, textcolor=color.white, color=color.new(col, 65))
// Limitar memoria de líneas
if array.size(lines) > keep
line.delete(array.shift(lines))
// === Alerta opcional ===
alertcondition(barstate.isconfirmed and match, title="Marca de minuto alcanzada",
message="Se alcanzó el minuto configurado de la hora (zona del gráfico).")
indicator("Marcas minuto cada hora — COMPAT v5", overlay=true, max_lines_count=500)
// === Inputs ===
minute1 = input.int(0, "Minuto #1 (0–59)", minval=0, maxval=59)
useMinute2 = input.bool(false, "Añadir Minuto #2")
minute2 = input.int(45, "Minuto #2 (0–59)", minval=0, maxval=59)
col = input.color(color.new(color.blue, 0), "Color de línea")
w = input.int(2, "Grosor", minval=1, maxval=5)
showLabel = input.bool(false, "Mostrar etiqueta HH:MM")
keep = input.int(400, "Máx. líneas a mantener", minval=50, maxval=500)
// === Utilidades ===
f02(x) => x < 10 ? "0" + str.tostring(x) : str.tostring(x)
// === Hora/minuto del gráfico (sin TZ externa) ===
curHour = hour(time) // usa la zona horaria del gráfico
curMin = minute(time) // usa la zona horaria del gráfico
// === Coincidencias de minuto(s) configurados ===
isM1 = curMin == minute1
isM2 = useMinute2 and (minute2 != minute1) and (curMin == minute2)
match = isM1 or isM2
// === Dibujar 1 línea por vela (al cierre) ===
var lines = array.new_line()
if barstate.isconfirmed and match
ln = line.new(bar_index, low, bar_index, high, xloc=xloc.bar_index, extend=extend.none, color=col, width=w)
array.push(lines, ln)
if showLabel
label.new(bar_index, high, f02(curHour) + ":" + f02(curMin),
style=label.style_label_down, textcolor=color.white, color=color.new(col, 65))
// Limitar memoria de líneas
if array.size(lines) > keep
line.delete(array.shift(lines))
// === Alerta opcional ===
alertcondition(barstate.isconfirmed and match, title="Marca de minuto alcanzada",
message="Se alcanzó el minuto configurado de la hora (zona del gráfico).")
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.