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 open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.