OPEN-SOURCE SCRIPT
Malama's Pre-Market Box

This script is a comprehensive Pre-Market range visualizer designed to replace older, single-candle analysis tools. It automatically highlights the full pre-market session (04:00–09:30 EST) and extends key support/resistance levels into the regular trading day.
Why this script was created (Evolution from previous versions): This is a complete architectural rewrite of the older "Malama's KAYCAP Pre-Market Box."
Old Logic: The previous version focused on isolating a single, specific 1-minute candle (e.g., exactly 4:00 AM) to determine levels.
New Logic: This version tracks the entire pre-market session range. It dynamically updates the True High and True Low as the pre-market develops, providing a much more accurate support/resistance zone for the open.
Visual Overhaul: Instead of static plots, this version uses Pine Script v6 box and line objects to draw a clean, shading-customizable range that automatically extends rightward until the trading session ends.
How it works:
Session Tracking: The script monitors the user-defined session (default 04:00-09:30).
Dynamic Box: As price moves during pre-market, a box is drawn covering the highest high and lowest low of that period.
Level Extension: At 09:30 (Market Open), the script locks the High and Low values. It then projects two horizontal lines (Resistance and Support) across the chart for the rest of the day.
Breakout Detection: If the price closes outside these levels during regular hours, the script can optionally trigger Alerts and plot "BREAK" labels on the chart.
Settings:
Time Settings: Customizable session string (default captures standard US Pre-Market).
Visuals: Fully adjustable box colors, border transparency, and line width.
Signals: Toggle breakout labels on/off.
Alerts Included:
Bullish Breakout: Triggers when price crosses and closes above the Pre-Market High.
Bearish Breakdown: Triggers when price crosses and closes below the Pre-Market Low.
Why this script was created (Evolution from previous versions): This is a complete architectural rewrite of the older "Malama's KAYCAP Pre-Market Box."
Old Logic: The previous version focused on isolating a single, specific 1-minute candle (e.g., exactly 4:00 AM) to determine levels.
New Logic: This version tracks the entire pre-market session range. It dynamically updates the True High and True Low as the pre-market develops, providing a much more accurate support/resistance zone for the open.
Visual Overhaul: Instead of static plots, this version uses Pine Script v6 box and line objects to draw a clean, shading-customizable range that automatically extends rightward until the trading session ends.
How it works:
Session Tracking: The script monitors the user-defined session (default 04:00-09:30).
Dynamic Box: As price moves during pre-market, a box is drawn covering the highest high and lowest low of that period.
Level Extension: At 09:30 (Market Open), the script locks the High and Low values. It then projects two horizontal lines (Resistance and Support) across the chart for the rest of the day.
Breakout Detection: If the price closes outside these levels during regular hours, the script can optionally trigger Alerts and plot "BREAK" labels on the chart.
Settings:
Time Settings: Customizable session string (default captures standard US Pre-Market).
Visuals: Fully adjustable box colors, border transparency, and line width.
Signals: Toggle breakout labels on/off.
Alerts Included:
Bullish Breakout: Triggers when price crosses and closes above the Pre-Market High.
Bearish Breakdown: Triggers when price crosses and closes below the Pre-Market Low.
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.