OPEN-SOURCE SCRIPT
已更新 Take Profit Planner [AGPro Series]

Take Profit Planner [AGPro Series]
🎯 **Overview**
**Take Profit Planner [AGPro Series]** is a precision exit-planning tool that transforms trade management from guesswork into a structured process. It builds a disciplined profit ladder around any trade idea — whether you are a scalper managing rapid exits or a swing trader stepping out of positions over days — and keeps the entire plan on one chart with live progress tracking.
Most traders agonize over entries and leave exits to improvisation. This tool flips that habit: define your anchor, choose your calculation style, and the script projects a complete multi-tier exit map with stop loss, position-sizing allocation, confluence scoring, and real-time hit tracking.
🪜 **What Makes It Different**
Unlike conventional take-profit indicators that plot a single ATR-based target or fixed R:R pair, this tool offers a **multi-layer exit architecture**:
▫️ **Three Calculation Modes** — Fibonacci Extensions, R-Multiples, or Hybrid Confluence in a single tool
▫️ **Three Anchor Sources** — Manual price inputs, auto pivot detection, or recent S/R zone anchoring
▫️ **Confluence Scoring** — In Hybrid mode, every target receives a ★ / ★★ / ★★★ rating based on how many independent level types (Fib, round number, pivot S/R) cluster at that price
▫️ **Position-Sizing Layer** — Allocate a custom percentage of your position to close at each tier, with automatic weighted P&L calculation
▫️ **Live Progress Tracking** — Visual hit confirmation (✓), realized vs expected profit, and a six-state status ladder: ACTIVE → PROGRESSING → IN PROFIT → NEAR COMPLETE → ALL TPs HIT → STOPPED OUT
🧠 **Methodology**
▫️ **Anchor Detection** — The script identifies a trade's origin (Swing) and entry point using one of three methods. Auto Pivot uses a confirmable `pivothigh`/`pivotlow` with configurable length. Auto S/R uses the most recent swing extremes as structural anchor points. Manual lets you input exact prices.
▫️ **Direction Inference** — LONG or SHORT is determined automatically from the geometry: Entry above Swing → LONG, Entry below Swing → SHORT. No manual flag needed.
▫️ **Stop-Loss Logic** — Three modes: ATR Multiple (volatility-adaptive), Swing Point (structural), or Fixed Percent (disciplined). In Manual anchor mode, you set the stop directly.
▫️ **Target Projection** — Fibonacci mode projects targets from the Anchor→Swing leg using standard extensions (1.272, 1.414, 1.618, 2.000, 2.618). R-Multiple mode multiplies the stop distance by risk factors (1R, 2R, 3R, 5R, 8R). Hybrid uses Fibonacci as base and scores confluence.
▫️ **Confluence Algorithm** — For each Fibonacci target, the script checks proximity to: (1) the nearest psychological round number within 0.15 ATR, (2) the most recent pivot high within 0.2 ATR, (3) the most recent pivot low within 0.2 ATR. Each alignment adds one point to the base Fibonacci score.
▫️ **Hit Detection** — On every confirmed bar, the script checks whether price crossed each un-hit target. Hits are persistent until the anchor changes by more than 1 ATR, at which point the plan resets.
🔔 **Signals & Alerts**
▫️ **TP Hit** — Fires once per bar when price touches a specific target. Alert message includes tier number, price, and direction.
▫️ **SL Hit** — Fires once when stop-loss is breached.
▫️ **All TPs Reached** — Fires once when the full ladder is completed.
All alerts are non-repainting and trigger only on confirmed bars.
🎛️ **Key Inputs**
▫️ **Calculation Mode** — Fibonacci Extensions, R-Multiples, or Hybrid Confluence
▫️ **Anchor Source** — Manual Price, Auto Pivot High/Low, or Auto Recent S/R
▫️ **Pivot Length** — Bars of confirmation for automatic pivot detection (default 10)
▫️ **Stop-Loss Mode** — ATR Multiple, Swing Point, or Fixed Percent
▫️ **Number of TP Tiers** — 2 to 7 (default 5)
▫️ **Fibonacci / R-Multiple Levels** — Fully customizable per tier
▫️ **Allocation %** — Position-sizing percentage per tier
▫️ **Zone Half-Width (ATR)** — Vertical thickness of target zones in ATR units
▫️ **Panel Location & Theme** — Six positions, Dark or Light theme
▫️ **Label & Panel Font Size** — Tiny, Small, Normal, Large
💡 **How to Use**
▫️ **Scalper Workflow (Fast Exits)** — Set Calculation Mode to R-Multiples, tier count to 3, allocations to 50 / 30 / 20. Use Auto Pivot with pivot length 5–8 on lower timeframes. Exit weighted-partials at each R-level.
▫️ **Swing Trader Workflow (Multi-Day Holds)** — Set Calculation Mode to Hybrid Confluence, tier count to 5, allocations to 20 / 20 / 25 / 20 / 15. Use Auto Pivot with length 10–15 on 4H or daily. Prioritize exits at ★★★ confluence targets.
▫️ **Discretionary Trader Workflow** — Set Anchor Source to Manual Price, enter your own Entry, Swing, and SL values. Choose Fibonacci mode for trend-based projections or Hybrid for confluence-weighted decisions.
▫️ **Position Management** — The Expected line in the panel shows total profit % if all active tiers are filled (weighted by allocation). The Realized line tracks booked profit as tiers fill. Use this to compare planned vs actual performance.
⚠️ **Limitations & Transparency**
▫️ This is a **planning and visualization tool**, not an entry signal generator. It assumes you already have a trade bias; it structures the exit.
▫️ **Auto-anchor modes** rely on confirmed pivots, which means the most recent plan updates a few bars after a fresh pivot forms. This is intentional to prevent repainting.
▫️ **Confluence scoring** is based on the current snapshot of pivot highs/lows and round numbers. As price moves and new pivots form, scores may change.
▫️ **Hit detection** uses bar highs/lows on confirmed candles only.
▫️ The tool does not know your actual fill prices, slippage, or spreads — expected and realized percentages assume exact execution at target prices.
🛡️ **Risk Disclosure**
Trading involves substantial risk of loss and is not suitable for every investor. The information provided by this indicator is for educational and informational purposes only and does not constitute financial advice, a trading recommendation, or a solicitation to buy or sell any asset. Past performance does not guarantee future results. Always perform your own analysis, define risk before entering any trade, and use proper position sizing. The author and AGProLabs accept no liability for trading decisions made using this tool.
🔓 **Open Source**
This script is published open-source under the Mozilla Public License 2.0. You are welcome to study the methodology, build on it, and contribute feedback.
🎯 **Overview**
**Take Profit Planner [AGPro Series]** is a precision exit-planning tool that transforms trade management from guesswork into a structured process. It builds a disciplined profit ladder around any trade idea — whether you are a scalper managing rapid exits or a swing trader stepping out of positions over days — and keeps the entire plan on one chart with live progress tracking.
Most traders agonize over entries and leave exits to improvisation. This tool flips that habit: define your anchor, choose your calculation style, and the script projects a complete multi-tier exit map with stop loss, position-sizing allocation, confluence scoring, and real-time hit tracking.
🪜 **What Makes It Different**
Unlike conventional take-profit indicators that plot a single ATR-based target or fixed R:R pair, this tool offers a **multi-layer exit architecture**:
▫️ **Three Calculation Modes** — Fibonacci Extensions, R-Multiples, or Hybrid Confluence in a single tool
▫️ **Three Anchor Sources** — Manual price inputs, auto pivot detection, or recent S/R zone anchoring
▫️ **Confluence Scoring** — In Hybrid mode, every target receives a ★ / ★★ / ★★★ rating based on how many independent level types (Fib, round number, pivot S/R) cluster at that price
▫️ **Position-Sizing Layer** — Allocate a custom percentage of your position to close at each tier, with automatic weighted P&L calculation
▫️ **Live Progress Tracking** — Visual hit confirmation (✓), realized vs expected profit, and a six-state status ladder: ACTIVE → PROGRESSING → IN PROFIT → NEAR COMPLETE → ALL TPs HIT → STOPPED OUT
🧠 **Methodology**
▫️ **Anchor Detection** — The script identifies a trade's origin (Swing) and entry point using one of three methods. Auto Pivot uses a confirmable `pivothigh`/`pivotlow` with configurable length. Auto S/R uses the most recent swing extremes as structural anchor points. Manual lets you input exact prices.
▫️ **Direction Inference** — LONG or SHORT is determined automatically from the geometry: Entry above Swing → LONG, Entry below Swing → SHORT. No manual flag needed.
▫️ **Stop-Loss Logic** — Three modes: ATR Multiple (volatility-adaptive), Swing Point (structural), or Fixed Percent (disciplined). In Manual anchor mode, you set the stop directly.
▫️ **Target Projection** — Fibonacci mode projects targets from the Anchor→Swing leg using standard extensions (1.272, 1.414, 1.618, 2.000, 2.618). R-Multiple mode multiplies the stop distance by risk factors (1R, 2R, 3R, 5R, 8R). Hybrid uses Fibonacci as base and scores confluence.
▫️ **Confluence Algorithm** — For each Fibonacci target, the script checks proximity to: (1) the nearest psychological round number within 0.15 ATR, (2) the most recent pivot high within 0.2 ATR, (3) the most recent pivot low within 0.2 ATR. Each alignment adds one point to the base Fibonacci score.
▫️ **Hit Detection** — On every confirmed bar, the script checks whether price crossed each un-hit target. Hits are persistent until the anchor changes by more than 1 ATR, at which point the plan resets.
🔔 **Signals & Alerts**
▫️ **TP Hit** — Fires once per bar when price touches a specific target. Alert message includes tier number, price, and direction.
▫️ **SL Hit** — Fires once when stop-loss is breached.
▫️ **All TPs Reached** — Fires once when the full ladder is completed.
All alerts are non-repainting and trigger only on confirmed bars.
🎛️ **Key Inputs**
▫️ **Calculation Mode** — Fibonacci Extensions, R-Multiples, or Hybrid Confluence
▫️ **Anchor Source** — Manual Price, Auto Pivot High/Low, or Auto Recent S/R
▫️ **Pivot Length** — Bars of confirmation for automatic pivot detection (default 10)
▫️ **Stop-Loss Mode** — ATR Multiple, Swing Point, or Fixed Percent
▫️ **Number of TP Tiers** — 2 to 7 (default 5)
▫️ **Fibonacci / R-Multiple Levels** — Fully customizable per tier
▫️ **Allocation %** — Position-sizing percentage per tier
▫️ **Zone Half-Width (ATR)** — Vertical thickness of target zones in ATR units
▫️ **Panel Location & Theme** — Six positions, Dark or Light theme
▫️ **Label & Panel Font Size** — Tiny, Small, Normal, Large
💡 **How to Use**
▫️ **Scalper Workflow (Fast Exits)** — Set Calculation Mode to R-Multiples, tier count to 3, allocations to 50 / 30 / 20. Use Auto Pivot with pivot length 5–8 on lower timeframes. Exit weighted-partials at each R-level.
▫️ **Swing Trader Workflow (Multi-Day Holds)** — Set Calculation Mode to Hybrid Confluence, tier count to 5, allocations to 20 / 20 / 25 / 20 / 15. Use Auto Pivot with length 10–15 on 4H or daily. Prioritize exits at ★★★ confluence targets.
▫️ **Discretionary Trader Workflow** — Set Anchor Source to Manual Price, enter your own Entry, Swing, and SL values. Choose Fibonacci mode for trend-based projections or Hybrid for confluence-weighted decisions.
▫️ **Position Management** — The Expected line in the panel shows total profit % if all active tiers are filled (weighted by allocation). The Realized line tracks booked profit as tiers fill. Use this to compare planned vs actual performance.
⚠️ **Limitations & Transparency**
▫️ This is a **planning and visualization tool**, not an entry signal generator. It assumes you already have a trade bias; it structures the exit.
▫️ **Auto-anchor modes** rely on confirmed pivots, which means the most recent plan updates a few bars after a fresh pivot forms. This is intentional to prevent repainting.
▫️ **Confluence scoring** is based on the current snapshot of pivot highs/lows and round numbers. As price moves and new pivots form, scores may change.
▫️ **Hit detection** uses bar highs/lows on confirmed candles only.
▫️ The tool does not know your actual fill prices, slippage, or spreads — expected and realized percentages assume exact execution at target prices.
🛡️ **Risk Disclosure**
Trading involves substantial risk of loss and is not suitable for every investor. The information provided by this indicator is for educational and informational purposes only and does not constitute financial advice, a trading recommendation, or a solicitation to buy or sell any asset. Past performance does not guarantee future results. Always perform your own analysis, define risk before entering any trade, and use proper position sizing. The author and AGProLabs accept no liability for trading decisions made using this tool.
🔓 **Open Source**
This script is published open-source under the Mozilla Public License 2.0. You are welcome to study the methodology, build on it, and contribute feedback.
發行說明
🔧 UPDATE NOTES - VERSION 1.2This update focuses on target-management clarity, chart readability, and decision support.
The core purpose of Take Profit Planner remains unchanged.
This release improves how the existing TP ladder is evaluated, 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
------------------------
• Added Target Quality scoring
The planner now converts target distance, obstruction risk, trend support, current R progress, volatility context, and confluence into a 0-100 target quality score.
• Added Nearest TP decision layer
The panel now focuses on the nearest active TP instead of only listing the full ladder. This makes the script easier to use as a target-management planner.
• Added Obstruction review
The script now checks whether a recent swing obstacle sits between current price and the nearest active target. When present, it shows an obstruction rail and changes the action state.
• Added Current R tracking
The panel now displays current R progress relative to the nearest active TP, helping users understand whether the current target path is still practical.
• Added clearer Action states
The planner now shows states such as Target Ready, Monitor, Blocked, Target Near, Invalidation Review, and Plan Complete.
------------------------
Visual Improvements
------------------------
• Added a centered Target Path box from current price to the nearest active TP
• Added concept-native TP zone text for NEXT TP, TAGGED, and active ladder levels
• Added an optional obstruction rail when the target path becomes crowded
• Improved label positioning with ATR-based offsets and label caps
• Preserved moderate label presence so the chart remains informative without becoming crowded
------------------------
Interface & Usability
------------------------
• Updated the panel to the roadmap-required rows:
Nearest TP, Target Quality, Obstruction, Current R, and Action
• Preserved the AGPro merged blue header row with only the panel title
• Added panel location, panel theme, panel font size, and label font size controls
• Added Target Ready, Target State Shift, Target Tagged, and Invalidation Review alert conditions
• Kept the public indicator title as Take Profit Planner [AGPro Series]
------------------------
Behavior Notes
------------------------
This update keeps the Take Profit Planner identity intact.
The script is still a TP ladder and target-management tool, not an exit-readiness engine, expansion target planner, position planner, or full trading suite.
The goal is to improve target-path interpretation and planning clarity without adding profit-promise language or automated trade instructions.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, timeframe differences, and sudden price gaps may affect how target paths and obstruction rails 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.
發行說明
🔧 UPDATE NOTES - V1.3This update focuses on readability, entry-reference clarity, and a cleaner first-glance TP ladder experience.
The core purpose of the script remains unchanged.
This release improves how the existing target-management 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
------------------------
• Added a new Visual Mode control
The script now includes Clean Ladder, Planner, and Manual visual modes.
Clean Ladder is designed for users who want the older, simpler TP ladder feeling with a clearer entry reference.
Planner restores the richer V1.2-style target-path presentation.
Manual follows the individual chart-visual toggles.
• Improved entry-reference readability
The entry cue is now more visible by default through the new Entry Emphasis setting.
Strong mode adds a clearer ENTRY REF badge, stronger guide line, and a subtle entry-reference band so users can identify the active entry level faster.
• Reduced default visual complexity
Clean Ladder mode keeps the important TP ladder, entry reference, invalidation reference, and panel while reducing the extra target-path layer that made the chart feel more complex for some users.
• Added Entry Reference to the panel
The panel now includes a dedicated Entry Reference row so the active entry level is visible both on the chart and inside the dashboard.
• Preserved the core calculation model
Target calculation, target quality scoring, obstruction logic, R tracking, TP tagging, and alert logic remain conceptually unchanged.
------------------------
Visual Improvements
------------------------
• Improved chart readability by making the entry reference more dominant.
• Reduced visual competition between the entry line, TP zones, target path, and obstruction rail.
• Refined visual hierarchy so Entry Reference, Nearest TP, and Action state are easier to scan.
• Adjusted default presentation toward a cleaner ladder-style layout while keeping the richer planner view available.
------------------------
Interface & Usability
------------------------
• Added Visual Mode:
Clean Ladder / Planner / Manual.
• Added Entry Emphasis:
Minimal / Normal / Strong.
• Added a dedicated Entry Reference panel row.
• Kept panel location, panel theme, panel font size, label size, and visual toggles adjustable.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical purpose of the script.
The goal is to improve clarity and usability, not to introduce predictive behavior.
Users should interpret outputs the same way as before, but with a cleaner default layout and stronger entry-reference cue.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, timeframe differences, and chart structure may affect how target levels, quality scores, and planning 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.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
Public-free and invite-only TradingView Pine Script tools for market analysis, risk planning, liquidity and execution review.
Script library & access: aligurtuna.com/agprolabs-pine-scriptleri/
Telegram: t.me/agprolabs
Script library & access: aligurtuna.com/agprolabs-pine-scriptleri/
Telegram: t.me/agprolabs
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
Public-free and invite-only TradingView Pine Script tools for market analysis, risk planning, liquidity and execution review.
Script library & access: aligurtuna.com/agprolabs-pine-scriptleri/
Telegram: t.me/agprolabs
Script library & access: aligurtuna.com/agprolabs-pine-scriptleri/
Telegram: t.me/agprolabs
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。