OPEN-SOURCE SCRIPT
Midnight Open

This Midnight open indicator tracks and displays each trading day’s midnight open based on a user-selected time zone. It lets the user choose between America/New_York, the chart’s exchange time zone, UTC, GMT, or a custom GMT/UTC hour offset, then detects when midnight occurs in that time zone and captures the open price either from the chart timeframe or from a 1-minute source for better precision. It filters by trading-week mode, so the script can operate on standard Monday–Friday schedules, Sunday–Thursday futures-style weeks, or all calendar days. Once a valid midnight open is found, it plots the current day’s level as a step line on the chart and can also draw a separate horizontal line for each day, with optional labels showing the weekday, 00:00 time stamp, and active time zone.
The Midnight Open indicator also keeps a rolling weekday dashboard that stores the latest Monday through Friday midnight open values and shows them in a table in the chart corner, with the active time zone included in the table header. Those table values are formatted with comma-separated numbers while preserving the instrument’s tick precision. To keep the chart clean, the script automatically limits how many historical lines and labels remain visible based on a user-defined lookback count. In addition, it generates a “new midnight open” event when a fresh daily level is captured and can fire a dynamic alert message that includes the active time zone, symbol, and timeframe, making it easier to monitor midnight reference levels across different markets and time zone settings.
The Midnight Open indicator also keeps a rolling weekday dashboard that stores the latest Monday through Friday midnight open values and shows them in a table in the chart corner, with the active time zone included in the table header. Those table values are formatted with comma-separated numbers while preserving the instrument’s tick precision. To keep the chart clean, the script automatically limits how many historical lines and labels remain visible based on a user-defined lookback count. In addition, it generates a “new midnight open” event when a fresh daily level is captured and can fire a dynamic alert message that includes the active time zone, symbol, and timeframe, making it easier to monitor midnight reference levels across different markets and time zone settings.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.