OPEN-SOURCE SCRIPT
Updated

CPR Expansion Planner [AGPro Series]

1 029
CPR Expansion Planner [AGPro Series]

🧠 Core Idea

Is CPR width and price acceptance setting up a structured expansion day, or is price still inside a weak pivot context?


📌 Overview / What it does

CPR Expansion Planner [AGPro Series] is a chart-first Central Pivot Range planning tool built to evaluate whether the current session is developing enough structure for an expansion-day read.

The script studies CPR width, the current anchor open, accepted closes beyond CPR, developing range expansion, target room, and the active invalidation shelf. These components are converted into a 0-100 Expansion Score and a clear next-action state.

It produces a CPR band, projected expansion room, target rail, invalidation shelf, state labels, alerts, and a clean AGPro planning panel. It does not predict future price movement, automate trades, or guarantee continuation.


🎯 Purpose & Design Philosophy

This script was built for traders who already watch CPR but want a more practical planning layer than a static pivot display.

Many CPR tools show the Central Pivot Range and leave the user to decide whether the day is balanced, expanding, failing, or already extended. This script fills that gap by translating CPR context into readiness, room, invalidation, and action language.

The design supports a planning mindset: identify the CPR base, check whether price is accepting beyond it, measure whether expansion has room, and keep the invalidation shelf visible.


⚡ Why This Script Is Different

Most tools focus on plotting CPR lines, daily pivots, or support/resistance reactions.

This script does NOT clone a Pivot Points Reaction Map, does not plot a full pivot ladder, and does not treat every pivot touch as a reaction signal.

Instead, it focuses on one question: is the CPR context preparing an expansion day with enough acceptance, range development, and target room to deserve attention?


⚙️ Methodology

1. Context Detection
The script builds CPR from the selected anchor and reads whether price is working above, below, or inside the CPR structure.

2. Reference Mapping
It maps the CPR band, accepted expansion side, invalidation shelf, projected target rail, and active expansion room.

3. Reaction Evaluation
The model scores CPR width, open location, accepted closes beyond CPR, current range expansion, and target room.

4. Visual Output
The result is shown through CPR zones, state labels, planner rails, deterministic alerts, and a premium AGPro panel.


🗺️ How to Read the Chart

Zones = the CPR band shows the active expansion base. The expansion room box shows the distance between the accepted CPR edge and the target rail.

Labels = READY, WATCH, ROOM, SHIFT, FOLLOW, and INVALID labels describe the current planning state.

Colors = green highlights bullish expansion context, pink highlights bearish expansion context, amber highlights room or follow-through review, indigo highlights watch states, and red highlights invalidation risk.

Panel = the panel summarizes CPR Width, Accepted Side, Expansion Score, Invalidation, and Action.


🚦 Signals & States

• READY → CPR acceptance, score, room, and confirmation are aligned.

• WATCH → price is beyond CPR but still needs cleaner confirmation or score improvement.

• ROOM BLOCKED → CPR acceptance exists, but the target rail is too close or already reached.

• EXTENDED → price has moved beyond the planned target room and late-chase risk is elevated.

• INVALID RISK → price has reached the active invalidation shelf.

• SHIFT → the accepted expansion side changed after a previous READY state.


🔔 Alerts Logic

Alerts trigger when the script detects a READY CPR expansion state, accepted side shift, invalidation risk, major follow-through, or blocked target room.

Alerts are attention markers. They are not trade instructions, automated entries, or exit commands.


🧩 Confluence Logic

The strongest context appears when narrow CPR width, a balanced anchor open, accepted closes beyond CPR, range expansion, and clean target room align.

When only one or two components are present, the script usually stays in WATCH, ROOM BLOCKED, or WAIT rather than forcing a strong state.


📊 When to Use

• Intraday markets where Daily CPR is a visible reference.

• Swing contexts where Weekly CPR is more relevant.

• Potential expansion days after narrow CPR conditions.

• Sessions where price begins accepting clearly beyond the CPR band.

• Traders who want risk and target context around CPR instead of only static lines.


⚠️ When NOT to Use

• Very low-liquidity symbols with unreliable volume and wide spreads.

• Extremely noisy sessions where price repeatedly crosses CPR without acceptance.

• News-driven volatility where normal CPR structure can be overwhelmed.

• Markets where the selected CPR anchor is not meaningful for the user's timeframe.


🎛️ Key Inputs

• CPR Anchor → switches between Daily and Weekly CPR.

• Sensitivity → adjusts how quickly the planner recognizes CPR expansion conditions.

• Confirmation Mode → controls whether acceptance requires close confirmation, volume support, or stricter alignment.

• READY Threshold → sets the minimum Expansion Score for READY states.

• Clean Target Room ATR → defines how much space is needed before the target rail is considered clean.

• Event Label Cooldown → controls label density and keeps the chart readable.

• Panel and Label Font Size → controls visual readability.


🖥️ Interface & Visual Design

The interface is chart-first.

The CPR band anchors the setup, the expansion room gives directional context, and the invalidation shelf keeps risk visible. The panel is intentionally compact, with one merged blue AGPro title row and five decision rows.

The goal is a premium TradingView visual: informative enough to avoid an empty chart, but restrained enough to stay clean.


🧪 Practical Usage Workflow

1. Read the panel and check the Expansion Score.

2. Identify whether price is accepting above or below CPR.

3. Review the expansion room and target rail.

4. Check the invalidation shelf.

5. Interpret READY, WATCH, ROOM, FOLLOW, or INVALID as planning context.


🔍 Interpretation Guidelines

Think in terms of structure, not prediction.

A narrow CPR can create expansion potential, but it still needs acceptance. Acceptance can be useful only if there is enough target room. A strong score with limited room may be less attractive than a moderate score with cleaner structure.

The script helps organize the CPR read; it does not replace broader market context.


🚫 What This Script Is NOT

• Not a prediction engine.

• Not financial advice.

• Not an auto trading system.

• Not a guaranteed signal generator.

• Not a full pivot ladder or generic support/resistance reaction map.


⚠️ Limitations & Transparency

• CPR behavior can vary across assets and sessions.

• Timeframe selection changes how the CPR anchor should be interpreted.

• High-impact news can distort normal expansion behavior.

• Thin liquidity can create false acceptance beyond CPR.

• The score is rule-based and should be interpreted within broader market context.


🧠 Market Context Notes

CPR can help frame session balance and directional acceptance. A narrow CPR often attracts expansion-day attention, but the useful question is not only whether CPR is narrow. The useful question is whether price accepts away from it with room, structure, and a clear invalidation reference.


🧾 Use Case Examples

When price opens near CPR, accepts above the top of the range, and develops range expansion with clean target room, the script may shift toward READY.

When price moves beyond CPR but immediately reaches the target rail, the script can mark ROOM BLOCKED or EXTENDED.

When price fails back through the opposite CPR edge, the planner can show INVALID RISK.


🧱 System Philosophy

AGPro Series tools are designed to turn visible market structure into practical decision context.

This script follows that philosophy by converting CPR from a passive reference into a structured expansion planner with score, state, risk, and target logic.


🔐 Non-Promise Statement

No guarantees.

No certainty.

No script can remove market risk or replace user responsibility.


📉 Risk Disclosure

Trading involves risk.

Users are responsible for their own decisions, risk management, and interpretation of market conditions.

This script is for educational and analytical purposes only and does not provide financial advice.


📚 Educational Note

Use the script to study how CPR width, acceptance, range expansion, and target room interact over time. The best value comes from reviewing repeated examples across different symbols, sessions, and timeframes.
Release Notes
🔧 UPDATE NOTES - V1.1

This update focuses on visual readability, panel polish, and publication-screen clarity.

The core purpose of the script remains unchanged.
This release improves how the existing CPR expansion logic is presented, organized, and interpreted on the chart.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

• Refined centered CPR and expansion-room badges
Important zone text is now handled with separate premium badges instead of relying on embedded transparent-zone text.

• Added centered badge controls
The new Show Centered Zone Badges and Zone Badge Anchor inputs make it easier to tune publication screenshots without changing the core model.

• Added Slate panel theme support
The panel now supports Dark, Slate, and Light themes while preserving the AG Pro blue merged header row.

• Improved visible label language
Chart labels now use cleaner readable casing such as Ready, Watch, Shift, Follow, Room, and Invalid.

• Tuned default label density
The default cooldown and retained-label settings were adjusted to keep the chart informative without making the active CPR plan feel crowded.


------------------------
Visual Improvements
------------------------

• Improved chart readability by separating zone text from transparent planning boxes

• Preserved CPR band, expansion room, target rail, invalidation rail, and historical state labels

• Refined visual hierarchy so the active CPR context remains clear at first glance

• Adjusted default label spacing to reduce overlap with candles while keeping enough chart activity for public presentation


------------------------
Interface & Usability
------------------------

• Preserved the single merged blue AG Pro panel header row

• Added a Slate panel theme for a stronger dark-chart presentation option

• Kept panel visibility, location, theme, and font-size controls available from settings

• Kept label font-size control for publication and user preference tuning


------------------------
Behavior Notes
------------------------

This update does not change the core analytical purpose of the script.

The goal is to improve clarity and usability while keeping the CPR expansion planning story visible on the chart.

Users should interpret outputs the same way as before, but with improved visual structure and cleaner readable labels.


------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool.

Market conditions such as volatility, liquidity, timeframe differences, and CPR anchor selection may affect how states appear.

Outputs should always be interpreted within broader market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only.

It does not provide financial advice or guaranteed trading outcomes.

Users remain responsible for their own decisions.
Release Notes
🔧 UPDATE NOTES - v1.2

This update adds an expansion follow-through proof and contrast-safe badge text everywhere.

The core purpose of the script remains unchanged.
It continues to convert CPR width, open location, acceptance, range expansion, target room and
invalidation distance into a decision-focused expansion day planner.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.

------------------------
What Changed
------------------------

- Expansion Rate proof layer
The panel now reports how often a Ready expansion historically followed through in the accepted
direction rather than reaching invalidation, shown with the sample count.

- Expansion proof window input
A new setting controls the window used to measure post-Ready follow-through.

- Honest, conservative counting
Each Ready is counted once, and an invalidation first or a window expiry without follow-through
is treated as not-followed, so the rate stays realistic.

------------------------
Visual Improvements
------------------------

- Contrast-safe text on the CPR band badge, expansion-room badge, rail labels and every state
label, so readouts stay readable on amber, pink, teal and indigo backgrounds

- Kept the CPR band, expansion-room corridor, planner rails and centered badges unchanged

- Preserved controlled event and watch label spacing

- Maintained a clean, focused first-glance read of the active CPR plan

- Reduced event and watch label density a notch and prevented watch labels from
printing immediately after a major event label, for a cleaner first-glance read

------------------------
Interface & Usability
------------------------

- Added an Expansion Rate row for an at-a-glance follow-through track record

- Added a window setting so the proof measures prompt follow-through

- Improved badge legibility across all states and all three panel themes

- Enhanced overall user experience without changing the core planner logic

------------------------
Behavior Notes
------------------------

This update does not change the core analytical logic of the script.

The CPR mapping, expansion score, states, acceptance and invalidation are unchanged. The
Expansion Rate is a separate historical track-record layer and does not alter detection.

------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool.

Market conditions such as volatility, liquidity and timeframe differences may affect how the
CPR context, expansion states and the rate appear.

Outputs should always be interpreted within broader market context.

------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only.

It does not provide financial advice or guaranteed trading outcomes.

Users remain responsible for their own decisions.
Release Notes
Version 1.4 – Confirmed State Pulses and Unified CPR Plan

This release converts the active CPR structure into one clearer planning story and hardens state, alert, and proof lifecycles while preserving the Central Pivot Range calculation and Expansion Score model.

• Converted READY, SHIFT, INVALID, FOLLOW, and ROOM events into confirmed one-time state pulses, preventing repeated labels and alerts while the same condition remains active.

• Separated EXTENDED from ROOM BLOCKED and moved extension ahead in the state hierarchy, making the completed target-room condition reachable and explicit.

• Locked the 0.75 ATR proof margin when each Ready sample opens, keeping the Expansion Rate threshold fixed throughout its evaluation window.

• Expanded the centered CPR badge with state and width, and expanded the room badge with side, state, score, and remaining ATR room.

• Added exact prices to TARGET and INVALID rail tags and staggered their forward positions.

• Converted historical state labels to single-line text, increased the default event cooldown to 50 bars, and reduced retained history to eight labels.

• Recreated both panel header cells after every table clear before applying the full-width merge.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.