Key Levels Pro [AGPro Series]Key Levels Pro
🔑 Overview
Key Levels Pro is a comprehensive, non-repainting level tracker that consolidates every institutionally significant price reference into one clean overlay. Previous day, week, and month highs/lows (PDH, PDL, PWH, PWL, PMH, PML) are plotted alongside Asian, London, and New York session highs and lows. Every level is actively monitored — touch count, break count, and respect rate update in real time, giving you a live quality score for each price zone.
Most level scripts stop at drawing lines. Key Levels Pro goes further: lines automatically thicken on repeated touches, switch to dashed style when broken, and fade to muted color to signal invalidation. Zone rectangles extend back to the formation bar of each level, making historical respect visible at a glance. An ATR-aware label collision system keeps the chart readable on every timeframe, and same-price levels are intelligently deduplicated so you never see four overlapping labels at the same price.
───────────────────────────────────────────────────────
📐 Unique Edge
Unlike generic pivot or S/R scripts, Key Levels Pro tracks the behavioral quality of each level — not just its existence. A level that has been tested five times without breaking carries a different weight than a fresh, untested one. Key Levels Pro surfaces that difference automatically through line width, style, and panel data.
What makes it distinct:
🔹 Complete previous-period coverage (PDH/PDL, PWH/PWL, PMH/PML) in one overlay, without redundant current-period duplicates.
🔹 Live session tracking for Asian, London, and New York simultaneously, with automatic hiding on Daily and higher timeframes.
🔹 Per-level touch count, break count, and respect rate computed from actual historical price interaction.
🔹 Dynamic line thickening on repeated touches (width 1 → 2 → 3).
🔹 Auto-broken state with dashed style + muted color — no distracting flags or banners.
🔹 Historical zone boxes extending back to the formation bar of each level.
🔹 ATR-aware label collision resolution that stacks overlapping labels vertically.
🔹 Price-based deduplication: when two levels share the same price, the higher-priority one wins (Monthly > Weekly > Daily > Session).
🔹 ATR-normalized proximity to the nearest level above and below the current price.
───────────────────────────────────────────────────────
🔬 Methodology
Previous-period levels are pulled from the daily, weekly, and monthly timeframes using request.security() with lookahead enabled for the completed-period values. This approach is standard, transparent, and non-repainting — historical data does not change.
Session levels are tracked bar by bar using customizable session time inputs. Each session resets at its start time and tracks the running high and low until the session closes. The Asian, London, and New York sessions can each be configured independently.
Touch detection uses an ATR-based tolerance band (default 10% of ATR). When price closes within that tolerance of a level, the touch counter increments. A break is registered when price closes on the opposite side of a level compared to the prior bar. Respect rate is calculated as touches / (touches + breaks) × 100.
Line width scales with touch count: 1 touch = width 1, 2–4 touches = width 2, 5+ touches = width 3. Broken levels switch to dashed style and a muted color.
The label collision system operates in three stages: first, all enabled levels are collected into a sorted array; second, same-price levels are deduplicated based on priority (Monthly highest, Session lowest); third, an upward sweep enforces minimum vertical spacing using a blend of ATR and chart-range heuristics, ensuring labels never overlap regardless of market volatility.
───────────────────────────────────────────────────────
📊 Signals & States
This script is a visualization and data tool — it does not generate buy or sell signals.
Level states are communicated visually:
🔹 Active (solid line, full color): level has not been broken.
🔹 Touched (thicker line, 2–3px): level has been tested one or more times.
🔹 Broken (dashed line, muted slate color): level has been decisively closed through.
Info panel states:
🔹 Session: active market session (Asian / London / New York / Off-Hours / N/A on Daily+).
🔹 Near Above / Near Below: price of the closest active level on each side of the current close.
🔹 Dist Above / Below ATR: distance expressed as a multiple of ATR(14).
🔹 Touch and respect rate data for PDH, PDL, PWH, PWL.
───────────────────────────────────────────────────────
⚙️ Key Inputs
Level Groups: Toggle previous day, week, month, and session levels independently.
Session Times: Fully customizable start/end times for Asian, London, and New York sessions in exchange timezone.
Zone Style: Enable/disable S/R zones and adjust zone transparency.
Lines & Labels: Set line extension length, toggle labels, choose label density (All / Reduced / Minimal), set font size, and enable or disable same-price deduplication.
Info Panel: Toggle panel, set location (six positions), and choose theme (Dark / Light).
ATR Settings: Set ATR period and touch tolerance as an ATR multiple (0.02 to 0.50).
───────────────────────────────────────────────────────
📖 How to Use
1. Add the script to a chart — all major levels appear immediately.
2. Adjust session times if trading non-crypto markets.
3. Watch line thickness: thicker = more tested = stronger historical reaction zone.
4. Dashed + muted color = broken. Treat broken levels as potential new S/R from the opposite side (role reversal).
5. Use the panel's Near Above and Near Below fields to gauge proximity before entry or exit decisions.
6. Use "Reduced" density (default) for cleaner charts, or switch to "All" when you need session context.
7. Works on all asset classes: crypto, forex, equities, indices, commodities.
Recommended timeframes: 15m–4H for session levels; 1H–1D for previous-period levels.
───────────────────────────────────────────────────────
⚠️ Limitations & Transparency
🔹 Session tracking is session-relative and resets each new session.
🔹 Touch tolerance is an ATR-based heuristic and may need adjustment on extremely low-volatility instruments.
🔹 All data is historical. Touch count and respect rate describe past price behavior, not future outcomes.
🔹 This script is not a trading strategy, does not issue trade signals, and cannot predict market direction.
🔹 On exotic or illiquid instruments with large gaps, formation-bar zone boxes may appear truncated if the level formed outside the chart's visible range.
───────────────────────────────────────────────────────
🛡️ Risk Disclosure
This script is provided for informational and educational purposes only. It does not constitute financial advice, investment advice, or a recommendation to buy or sell any financial instrument. All trading involves risk. Past level behavior does not guarantee future results. Always use proper risk management and test any approach in a demo environment before committing real capital.
Pine Script® indicator



