Trendline Retest Planner [AGPro Series]Trendline Retest Planner
🧠 Core Idea
Is the active trendline retest constructive enough to keep the setup under review, or is it starting to fail?
📌 Overview / What it does
Trendline Retest Planner is a chart-first decision tool for traders who review price behavior around active support and resistance trendline retests.
Instead of drawing many trendlines or flagging every break, the script focuses on one active trendline retest context at a time. It measures line age, touch count, retest depth, close response, and volume support, then converts that evidence into a 0-100 Retest Score and a clear next-action state.
The script produces an active trendline, retest pocket, hold/fail labels, invalidation edge, target path, alerts, and a compact AGPro planning panel. It does not predict price movement, automate execution, or provide guaranteed outcomes.
🎯 Purpose & Design Philosophy
This script was built to fill the gap between auto-trendline drawing and practical retest planning.
Many tools can draw diagonals or detect a break. The harder question is what to do after price returns to the line: is the retest holding, weakening, failing, or still waiting for confirmation?
Trendline Retest Planner supports a decision workflow: identify the active retest, read the score, locate the invalidation edge, compare the target path, and decide what deserves review next.
⚡ Why This Script Is Different
Most trendline tools focus on drawing many lines, ranking confluence, or detecting trendline breaks.
This script does NOT clone Auto Trendline Break Quality, Auto Trendlines MTF - Break/Retest, Trendline Confluence Map, Break-Retest Quality, Structure Retest Planner, Swing Retest Quality, or a generic support/resistance zone map.
Instead, it narrows the workflow to one active support or resistance trendline retest and evaluates whether that retest is constructive or failing. The main output is not a buy or sell signal. It is a decision state: READY, MONITOR, FAILING, INVALIDATED, WATCH, WAIT, or SCAN.
⚙️ Methodology
1. Context Detection
The script builds the latest support and resistance trendline candidates from confirmed swing pivots, then selects the nearest valid retest context.
2. Reference Mapping
It maps the active trendline, a retest pocket around the line, an invalidation edge, and a forward target path.
3. Reaction Evaluation
The 0-100 model scores line age, touch count, retest depth, close response, and volume support.
4. Visual Output
The chart shows the active planning objects, compact state labels, and a clean AGPro decision panel.
🗺️ How to Read the Chart
Trendline = the active support or resistance line being evaluated.
Retest Pocket = the ATR-based area around the trendline where a retest is considered active.
Invalidation Edge = the planning reference where the active retest context is considered broken.
Target Path = a forward guide based on the trendline-to-risk distance.
Labels = compact TEST, READY, MONITOR, WEAK, INVALID, PATH, and sparse context labels.
Colors = teal marks support-side retest context, pink marks resistance-side retest context, amber marks caution, indigo marks monitoring/follow-through, and red marks invalidation.
Panel = the AGPro panel summarizes Trendline Side, Retest Score, Hold State, Risk Edge, and Action.
🚦 Signals & States
• READY → the retest is active, holding on the correct side, and the score is strong enough for structured review.
• MONITOR → the retest is developing, but confirmation or score quality is still incomplete.
• FAILING → price touched the pocket, but the response is weak or on the wrong side.
• INVALIDATED → price crossed the invalidation edge and the active context should be rebuilt.
• WATCH → price is approaching the trendline pocket.
• WAIT → a valid trendline exists, but price is not close enough for useful retest review.
• SCAN → no valid trendline context is active yet.
🔔 Alerts Logic
Alerts trigger when price touches the active retest pocket, when READY state appears, when MONITOR state appears, when a failing retest is detected, when the invalidation edge is crossed, and when follow-through appears after an active retest.
Alerts are attention markers only. They are not trade instructions, automated strategy commands, or outcome promises.
🧩 Confluence Logic
The strongest context appears when the active line is fresh enough, has enough touches, retests with controlled depth, closes back on the correct side, and receives supportive relative volume.
When these components conflict, the panel moves toward MONITOR, FAILING, WATCH, WAIT, or INVALIDATED.
📊 When to Use
• Trendline support retests during constructive pullbacks
• Trendline resistance retests during bearish continuation attempts
• Price-action review after a diagonal support or resistance line is already visible
• Retest planning where invalidation and target path matter
• Liquid markets where pivots, candles, and volume behavior are readable
⚠️ When NOT to Use
• Very low-liquidity symbols with irregular candles
• Extremely noisy micro-timeframes
• News-driven spikes where trendline geometry becomes distorted
• Markets where swing pivots are too compressed to form useful lines
• Situations where the user expects a signal-only or auto-trading tool
🎛️ Key Inputs
• Trendline Side → selects Auto, Support Retest, or Resistance Retest.
• Trendline Pivot Length → controls how confirmed swing anchors are detected.
• Max Trendline Age → controls how old a trendline can be before it is ignored.
• Touch Count Lookback → controls how extra line touches are counted.
• Sensitivity → adjusts retest pocket width and activation distance.
• READY Score → sets the score threshold for stronger review states.
• Label and Panel Font Size → controls chart-label and panel readability.
• Panel Location and Theme → adjusts the AGPro panel layout.
🖥️ Interface & Visual Design
The interface is designed to stay chart-first and decision-led.
The active trendline is the main reference. The retest pocket is drawn around that line with centered text so the chart stays readable. The invalidation edge and target path explain where the planning context weakens and what forward room is being mapped.
The AGPro panel uses a merged blue title row and five compact rows so the user can read side, score, hold state, risk edge, and action quickly.
🧪 Practical Usage Workflow
1. Read the panel state and Retest Score.
2. Check whether price is approaching or touching the retest pocket.
3. Compare current price with the invalidation edge.
4. Review whether the label says TEST, READY, MONITOR, WEAK, INVALID, or PATH.
5. Confirm the broader market context before making any decision.
🔍 Interpretation Guidelines
Think in terms of retest quality, not prediction.
A higher score means multiple retest components align inside the script's rule set. A weaker score means the line may be too old, the retest may be too shallow, too deep, missing a constructive close, or lacking participation.
The script helps organize the review process. It does not replace judgment.
🚫 What This Script Is NOT
• Not a prediction engine
• Not financial advice
• Not an auto-trading system
• Not a guaranteed signal tool
• Not a broad auto-trendline map
• Not a trendline confluence scanner
• Not a break-and-retest scanner
• Not a generic support/resistance zone map
• Not an order block, FVG, or supply/demand tool
⚠️ Limitations & Transparency
• Pivot-based trendlines appear only after pivots are confirmed.
• Scores can vary across symbols, sessions, and timeframes.
• Volume scoring depends on exchange-provided volume data.
• Fast volatility can cross a trendline before a clean retest can be measured.
• In Live Updating mode, active-bar values can change before the bar closes.
🧠 Market Context Notes
Trendline retests are easiest to interpret when liquidity, volatility, and swing structure are readable.
A trendline touch is not enough by itself. Line quality, response, invalidation distance, and target path all matter.
🧾 Use Case Examples
When price returns to an upward support trendline and closes back above the pocket with a high score, the panel may move toward READY.
When price touches a downward resistance trendline but cannot close back below it, the planner may move toward FAILING or INVALIDATED.
When price is near the line but has not touched the pocket yet, the panel can stay in WATCH or WAIT.
🧱 System Philosophy
Trendline Retest Planner follows the AGPro decision-engine approach: identify context, score quality, map risk, show the next action, and keep the chart readable.
It is designed to help traders evaluate a specific planning question instead of adding another generic signal layer.
🔐 Non-Promise Statement
No score, label, alert, or chart object guarantees any market outcome.
The script organizes retest context and highlights conditions for review. It does not provide certainty.
📉 Risk Disclosure
Trading involves risk.
Users remain responsible for their own decisions, position sizing, execution, and risk management.
This script is for educational and analytical purposes only and does not provide financial advice.
📚 Educational Note
Use the planner as a structured reading layer: trendline context first, retest quality second, invalidation and target path third, broader market context always.
Chỉ báo Pine Script®






















