OPEN-SOURCE SCRIPT
Ultimate_Price_Action_Tool_V2 by chaitu50c

Ultimate_Price_Action_Tool_V2 by chaitu50c — Session-Based SR Box Engine
This indicator builds clean, session-aware support and resistance “zones” from pure price action. It is designed for intraday and positional traders who want objective, rule-based zones instead of manual drawing.
Core Logic
Price-action based MAIN zones
Detects bullish and bearish breakouts using a strict body-structure:
Single-candle and double-candle breakout patterns.
Breakouts are confirmed only when closes break beyond previous highs/lows.
From each valid breakout, the tool builds a MAIN Support or MAIN Resistance box:
For bullish breaks, the zone is created from a combined low to the nearest open/close in the breakout combo.
For bearish breaks, the zone is created from a combined high to the nearest open/close in the breakout combo.
Optional first-box logic:
Can create the very first MAIN zone in a session from a simple opposite-color pair (without a full breakout), if enabled.
SUB zones on break
When price breaks a MAIN Support downwards with a red candle, the MAIN box is removed/frozen and:
A new SUB Resistance box is created above, using the current bar’s structure.
When price breaks a MAIN Resistance upwards with a green candle:
A new SUB Support box is created below.
SUB zones are optional and can be fully disabled if the user prefers a clean MAIN-only view.
Session Handling
The script is fully session-aware and can work in different market structures:
Session Mode options
Clock Session
Uses a fixed time window (e.g., 09:15–15:30).
Zones can be shown only inside the session or kept visible outside, depending on settings.
New Day
Each new trading day is treated as a fresh session.
Auto Gap
A new session starts whenever the time gap between candles exceeds a user-defined threshold (in minutes).
Session IDs and history
Each new session gets its own ID.
You can display zones for the last N sessions (including current).
Older sessions fade out visually but remain internally tracked to control visibility.
Main Features & Options
Initial Right Offset
Every new zone is projected to the right by a configurable number of bars.
All active boxes continuously extend with this offset, keeping zones clearly projected into the future.
Single MAIN per side (per session)
Optional constraint to have only:
One active MAIN Support and
One active MAIN Resistance
per session on the chart.
This prevents overcrowding and focuses on the most recent key structure.
MAIN vs SUB Overlap Control
When a new MAIN zone overlaps an existing SUB zone, you can choose:
Suppress MAIN (ignore the new MAIN if it clashes with a SUB),
Remove SUB (delete overlapping SUB zones and keep the new MAIN), or
Allow Both (plot everything and let the trader decide).
Vertical overlap is evaluated using a configurable minimum overlap percentage.
SUB suppression under MAIN
SUB boxes that overlap strongly with active MAIN zones can be auto-suppressed to avoid redundant clutter.
This suppression uses the same percent-based overlap logic.
Broken MAIN box handling
When a MAIN zone is broken:
Option 1: Fully delete it (classic behavior).
Option 2: Convert it into a 1-bar “marker” box at its origin, so you still see where the original zone formed without extending into the future.
Break candle coloring
The candle that breaks a MAIN zone can be optionally painted:
Red when breaking support.
Green when breaking resistance.
Helps visually confirm genuine breaks vs. simple intrabar tests.
Visual & Styling Controls
Separate style controls for:
MAIN Support / MAIN Resistance
Independent fill and border colors.
SUB Support / SUB Resistance
Independent fill and border colors.
Opacity and border colors are internally managed so that:
Recent sessions are clearly visible.
Older sessions are softly faded to maintain context without noise.
Typical Use Cases
Intraday traders looking for:
Clean, rule-based supply and demand zones.
Zones that respect actual session structure (clock, daily, or gap-based).
Swing traders who:
Want to track how current price reacts to the most recent 1–N sessions’ zones.
Price action traders who:
Prefer breakout-based zones rather than indicator-driven levels.
Need automatic zone management (creation, extension, break handling, and suppression).
This tool is built to be modular and configurable: you can run it minimal (only MAIN zones, single side per session) or fully featured (MAIN + SUB, multi-session history, overlap handling, and break paints). All logic is strictly price-action based with no dependency on volume or external indicators.
This indicator builds clean, session-aware support and resistance “zones” from pure price action. It is designed for intraday and positional traders who want objective, rule-based zones instead of manual drawing.
Core Logic
Price-action based MAIN zones
Detects bullish and bearish breakouts using a strict body-structure:
Single-candle and double-candle breakout patterns.
Breakouts are confirmed only when closes break beyond previous highs/lows.
From each valid breakout, the tool builds a MAIN Support or MAIN Resistance box:
For bullish breaks, the zone is created from a combined low to the nearest open/close in the breakout combo.
For bearish breaks, the zone is created from a combined high to the nearest open/close in the breakout combo.
Optional first-box logic:
Can create the very first MAIN zone in a session from a simple opposite-color pair (without a full breakout), if enabled.
SUB zones on break
When price breaks a MAIN Support downwards with a red candle, the MAIN box is removed/frozen and:
A new SUB Resistance box is created above, using the current bar’s structure.
When price breaks a MAIN Resistance upwards with a green candle:
A new SUB Support box is created below.
SUB zones are optional and can be fully disabled if the user prefers a clean MAIN-only view.
Session Handling
The script is fully session-aware and can work in different market structures:
Session Mode options
Clock Session
Uses a fixed time window (e.g., 09:15–15:30).
Zones can be shown only inside the session or kept visible outside, depending on settings.
New Day
Each new trading day is treated as a fresh session.
Auto Gap
A new session starts whenever the time gap between candles exceeds a user-defined threshold (in minutes).
Session IDs and history
Each new session gets its own ID.
You can display zones for the last N sessions (including current).
Older sessions fade out visually but remain internally tracked to control visibility.
Main Features & Options
Initial Right Offset
Every new zone is projected to the right by a configurable number of bars.
All active boxes continuously extend with this offset, keeping zones clearly projected into the future.
Single MAIN per side (per session)
Optional constraint to have only:
One active MAIN Support and
One active MAIN Resistance
per session on the chart.
This prevents overcrowding and focuses on the most recent key structure.
MAIN vs SUB Overlap Control
When a new MAIN zone overlaps an existing SUB zone, you can choose:
Suppress MAIN (ignore the new MAIN if it clashes with a SUB),
Remove SUB (delete overlapping SUB zones and keep the new MAIN), or
Allow Both (plot everything and let the trader decide).
Vertical overlap is evaluated using a configurable minimum overlap percentage.
SUB suppression under MAIN
SUB boxes that overlap strongly with active MAIN zones can be auto-suppressed to avoid redundant clutter.
This suppression uses the same percent-based overlap logic.
Broken MAIN box handling
When a MAIN zone is broken:
Option 1: Fully delete it (classic behavior).
Option 2: Convert it into a 1-bar “marker” box at its origin, so you still see where the original zone formed without extending into the future.
Break candle coloring
The candle that breaks a MAIN zone can be optionally painted:
Red when breaking support.
Green when breaking resistance.
Helps visually confirm genuine breaks vs. simple intrabar tests.
Visual & Styling Controls
Separate style controls for:
MAIN Support / MAIN Resistance
Independent fill and border colors.
SUB Support / SUB Resistance
Independent fill and border colors.
Opacity and border colors are internally managed so that:
Recent sessions are clearly visible.
Older sessions are softly faded to maintain context without noise.
Typical Use Cases
Intraday traders looking for:
Clean, rule-based supply and demand zones.
Zones that respect actual session structure (clock, daily, or gap-based).
Swing traders who:
Want to track how current price reacts to the most recent 1–N sessions’ zones.
Price action traders who:
Prefer breakout-based zones rather than indicator-driven levels.
Need automatic zone management (creation, extension, break handling, and suppression).
This tool is built to be modular and configurable: you can run it minimal (only MAIN zones, single side per session) or fully featured (MAIN + SUB, multi-session history, overlap handling, and break paints). All logic is strictly price-action based with no dependency on volume or external indicators.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.