OPEN-SOURCE SCRIPT
已更新 Risk Reward Visualizer [AGPro Series]

Risk Reward Visualizer [AGPro Series]
🔹 Overview
Risk Reward Visualizer is a professional trade-planning indicator that transforms every setup into a clean visual framework: entry, stop-loss, and up to three take-profit targets displayed as long rectangular R-multiple zones. Beyond basic visualization, it adds three features rarely found together in one tool — a breakeven probability calculator, live MFE/MAE excursion tracking, and an automatic trail-to-breakeven workflow.
The indicator is built for traders who think in R-multiples: swing traders, prop-firm candidates, day traders, and anyone who wants to answer the question "does this setup actually make mathematical sense?" before committing capital.
🔹 What Makes It Different
Most risk/reward scripts stop at drawing levels and a position-size table. This one goes further:
• Breakeven Probability Math — For every R target, the panel displays the minimum win rate required to break even, adjusted for round-trip fees. A 3R target needs only 25% wins; a 1R target needs 50%. Seeing this side-by-side reframes how you evaluate setups.
• Live MFE / MAE Tracking — Maximum Favorable Excursion and Maximum Adverse Excursion are tracked in real time from the moment the setup becomes valid. Labels mark the exact bar of each peak in R-multiples, with leader lines connecting the label to the wick, so you can grade trade quality after the fact.
• Trail-to-Breakeven Visualization — When TP1 is hit, the original stop fades and a new breakeven line is drawn at entry, making the risk management discipline visible on the chart.
• Hybrid Auto-Detect — Leave Entry and Stop at zero and the script fills them using the current close and the most recent swing pivot plus an ATR buffer. Provide one manually and the other auto-completes. Everything can be overridden.
🔹 Methodology
Levels are calculated from the standard R-multiple framework:
• Risk per unit = |Entry − Stop|
• Take-profit N = Entry ± (N × Risk per unit), signed by trade direction
• Breakeven win rate = (1 + fees_R) / (1 + R target)
Direction is auto-inferred from the relationship between Entry and Stop (Long when Stop is below Entry, Short otherwise), and can be forced. Auto-detect uses a pivot lookback to locate the most recent swing high or low, then offsets the stop by a user-defined ATR multiple to reduce wick-out risk.
MFE and MAE reset whenever Entry or Stop changes, so editing inputs restarts tracking cleanly. Hit detection uses bar high or low against each level and fires alerts only on the rising edge of each event.
🔹 Visuals & Signals
• Risk zone rendered as a pink rectangle between Entry and Stop
• TP1, TP2 and TP3 zones rendered as stacked teal rectangles with graded opacity
• Entry line in indigo, stop in pink, take-profits in teal
• Labels anchor to the right edge of the zone so they never hide candles
• MFE label on the favorable excursion peak, MAE on the adverse peak, each offset 1.5 ATR with a dotted leader line
• Alerts: TP1 hit, TP2 hit, TP3 hit, Stop Loss hit, Breakeven reached
🔹 Key Inputs
• Setup Mode — Manual, Auto-Detect, or Hybrid
• Trade Side — Auto, Long, or Short
• Entry and Stop — leave at zero to auto-detect
• Swing Lookback and ATR Buffer — for auto-detected stops
• TP1, TP2, TP3 multipliers with individual show/hide toggles
• Trail Stop to Breakeven After TP1 — toggle
• Round-Trip Fees (%) — folded into breakeven math
• Enable Position Size Calculator — optional; account size and risk percentage
• Panel location, panel font size, label font size, zone length, zone transparency
🔹 How To Use
Step 1 — Add the script to any symbol and timeframe. By default, Hybrid mode uses the current close as entry and the most recent swing plus an ATR buffer as stop.
Step 2 — Override Entry or Stop with your planned levels if you have a specific setup in mind.
Step 3 — Check the Breakeven Analysis section of the panel. Confirm the minimum win rate required for your chosen R target is realistic for your strategy.
Step 4 — Set alerts for the targets you want to be notified on. If Trail-to-Breakeven is enabled, you will also receive a notification when TP1 hits so you can move your stop in your broker.
Step 5 — After the trade, review MFE and MAE to grade execution. Did price reach favorable excursion that you missed? Did it dip deep into risk before resolving?
🔹 Limitations & Transparency
• This is a planning and visualization tool. It does not place orders and does not produce buy or sell signals.
• The breakeven calculation treats fees as a percentage of entry price converted into R-units. It is a useful approximation, not a tax or slippage model.
• Auto-detected stops depend on recent swing structure. On very low-liquidity symbols or during strong trends without pullbacks, recent swings may be stale. Verify visually before using.
• MFE and MAE tracking uses bar high or low and resets when inputs change.
• Position sizing assumes a linear contract value and does not account for margin, leverage, or instrument-specific tick rules. Always cross-check with your broker.
🔹 Risk Disclosure
Trading carries risk of loss. This indicator is provided for educational and analytical purposes only and is not financial advice. Past behavior of any tool does not guarantee future performance. Use proper position sizing and never risk more than you can afford to lose.
🔹 Overview
Risk Reward Visualizer is a professional trade-planning indicator that transforms every setup into a clean visual framework: entry, stop-loss, and up to three take-profit targets displayed as long rectangular R-multiple zones. Beyond basic visualization, it adds three features rarely found together in one tool — a breakeven probability calculator, live MFE/MAE excursion tracking, and an automatic trail-to-breakeven workflow.
The indicator is built for traders who think in R-multiples: swing traders, prop-firm candidates, day traders, and anyone who wants to answer the question "does this setup actually make mathematical sense?" before committing capital.
🔹 What Makes It Different
Most risk/reward scripts stop at drawing levels and a position-size table. This one goes further:
• Breakeven Probability Math — For every R target, the panel displays the minimum win rate required to break even, adjusted for round-trip fees. A 3R target needs only 25% wins; a 1R target needs 50%. Seeing this side-by-side reframes how you evaluate setups.
• Live MFE / MAE Tracking — Maximum Favorable Excursion and Maximum Adverse Excursion are tracked in real time from the moment the setup becomes valid. Labels mark the exact bar of each peak in R-multiples, with leader lines connecting the label to the wick, so you can grade trade quality after the fact.
• Trail-to-Breakeven Visualization — When TP1 is hit, the original stop fades and a new breakeven line is drawn at entry, making the risk management discipline visible on the chart.
• Hybrid Auto-Detect — Leave Entry and Stop at zero and the script fills them using the current close and the most recent swing pivot plus an ATR buffer. Provide one manually and the other auto-completes. Everything can be overridden.
🔹 Methodology
Levels are calculated from the standard R-multiple framework:
• Risk per unit = |Entry − Stop|
• Take-profit N = Entry ± (N × Risk per unit), signed by trade direction
• Breakeven win rate = (1 + fees_R) / (1 + R target)
Direction is auto-inferred from the relationship between Entry and Stop (Long when Stop is below Entry, Short otherwise), and can be forced. Auto-detect uses a pivot lookback to locate the most recent swing high or low, then offsets the stop by a user-defined ATR multiple to reduce wick-out risk.
MFE and MAE reset whenever Entry or Stop changes, so editing inputs restarts tracking cleanly. Hit detection uses bar high or low against each level and fires alerts only on the rising edge of each event.
🔹 Visuals & Signals
• Risk zone rendered as a pink rectangle between Entry and Stop
• TP1, TP2 and TP3 zones rendered as stacked teal rectangles with graded opacity
• Entry line in indigo, stop in pink, take-profits in teal
• Labels anchor to the right edge of the zone so they never hide candles
• MFE label on the favorable excursion peak, MAE on the adverse peak, each offset 1.5 ATR with a dotted leader line
• Alerts: TP1 hit, TP2 hit, TP3 hit, Stop Loss hit, Breakeven reached
🔹 Key Inputs
• Setup Mode — Manual, Auto-Detect, or Hybrid
• Trade Side — Auto, Long, or Short
• Entry and Stop — leave at zero to auto-detect
• Swing Lookback and ATR Buffer — for auto-detected stops
• TP1, TP2, TP3 multipliers with individual show/hide toggles
• Trail Stop to Breakeven After TP1 — toggle
• Round-Trip Fees (%) — folded into breakeven math
• Enable Position Size Calculator — optional; account size and risk percentage
• Panel location, panel font size, label font size, zone length, zone transparency
🔹 How To Use
Step 1 — Add the script to any symbol and timeframe. By default, Hybrid mode uses the current close as entry and the most recent swing plus an ATR buffer as stop.
Step 2 — Override Entry or Stop with your planned levels if you have a specific setup in mind.
Step 3 — Check the Breakeven Analysis section of the panel. Confirm the minimum win rate required for your chosen R target is realistic for your strategy.
Step 4 — Set alerts for the targets you want to be notified on. If Trail-to-Breakeven is enabled, you will also receive a notification when TP1 hits so you can move your stop in your broker.
Step 5 — After the trade, review MFE and MAE to grade execution. Did price reach favorable excursion that you missed? Did it dip deep into risk before resolving?
🔹 Limitations & Transparency
• This is a planning and visualization tool. It does not place orders and does not produce buy or sell signals.
• The breakeven calculation treats fees as a percentage of entry price converted into R-units. It is a useful approximation, not a tax or slippage model.
• Auto-detected stops depend on recent swing structure. On very low-liquidity symbols or during strong trends without pullbacks, recent swings may be stale. Verify visually before using.
• MFE and MAE tracking uses bar high or low and resets when inputs change.
• Position sizing assumes a linear contract value and does not account for margin, leverage, or instrument-specific tick rules. Always cross-check with your broker.
🔹 Risk Disclosure
Trading carries risk of loss. This indicator is provided for educational and analytical purposes only and is not financial advice. Past behavior of any tool does not guarantee future performance. Use proper position sizing and never risk more than you can afford to lose.
版本注释
UPDATE NOTES - V2.0This update focuses on turning Risk Reward Visualizer into a clearer risk-box decision engine while preserving its original public identity.
The core purpose of the script remains unchanged.
This release improves how the existing risk/reward framework is presented, scored, 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 0-100 Risk Box Quality score.
The score evaluates R progress, stop distance, target room, trend support, and volatility fit so the active risk box is easier to review.
* Added a clearer next-action state.
The panel now summarizes whether the setup is READY, WAITING, under BE review, blocked by target room, or invalidated.
* Rebuilt the chart layer around an R ladder and live progress fill.
The risk zone, target zones, breakeven trigger, partial-review markers, and current R fill now work together as a single visual planning map.
* Added event labels and expanded alert logic.
READY, state shift, invalidation, breakeven review, and major follow-through conditions are now available as attention markers.
* Simplified the public update direction.
The update keeps the script centered on manual risk/reward visualization and avoids turning it into a full Position Planner or Trading Suite.
------------------------
Visual Improvements
------------------------
* Added centered labels inside the risk and target boxes for stronger first-glance readability.
* Added a live R progress fill so users can see whether current price is moving into risk, breakeven review, or target territory.
* Added compact right-edge ladder labels for entry, stop, target, breakeven, and current R context.
* Event labels are offset away from candles and controlled with cooldown plus max-visible settings.
* Screenshot-polished defaults now hide tiny MFE/MAE fluctuation labels and stale READY labels so the active risk box stays readable.
------------------------
Interface & Usability
------------------------
* Rebuilt the panel around the V2 roadmap rows: Risk Box, Current R, BE State, Nearest Target, and Action.
* Preserved the AGPro standard merged blue header row with only the panel title.
* Added panel theme, panel location, panel font-size, and label font-size controls.
* Panel visibility remains enabled by default.
* Added Event Label Memory Bars and Minimum MFE/MAE Label R controls for cleaner publication screenshots across 4H and 1D charts.
------------------------
Behavior Notes
------------------------
This update changes the interpretation layer, not the purpose of the script.
Risk Reward Visualizer remains a chart-first risk/reward map for entry, stop, R ladder, breakeven review, and target progression.
The new score and action state are rule-based review tools. They should be read as context, not as instructions.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, wick behavior, and timeframe differences may affect how risk boxes, target room, and R progress appear.
Auto-detected stops depend on recent structure and ATR behavior. Manual review remains important.
------------------------
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 - V2.1This update focuses on screenshot clarity, R-ladder readability, panel interpretation, and cleaner risk-box usability.
The core purpose of the script remains unchanged.
Risk Reward Visualizer continues to function as a chart-first risk/reward planning and visualization tool.
This release improves how the existing R-multiple framework is presented, reviewed, and interpreted on the chart.
This script does not attempt to predict price direction or provide guaranteed outcomes.
------------------------
What Changed
------------------------
• Improved current-R readability
Current R is easier to review from the panel and chart context, helping users understand whether price is inside risk, approaching breakeven review, or moving toward target territory.
• Refined breakeven review state
Breakeven behavior is presented with clearer state wording so users can separate early risk, BE review, BE active, and invalidated contexts without guessing.
• Cleaned up R-ladder interpretation
The risk box, entry reference, stop reference, and TP ladder are visually easier to scan. The update keeps the core R-multiple framework intact while improving the first-glance read.
• Improved target hierarchy
TP1, TP2, and TP3 are easier to distinguish as planning references. Partial-review and target-progress markers are kept compact so the ladder does not dominate the candles.
• Improved publication screenshot defaults
Default label density is cleaner, stale labels are reduced, and right-side ladder tags are easier to read on 4h and 1D screenshots.
------------------------
Visual Improvements
------------------------
• Improved chart readability by adjusting R-ladder labels, zone text, and right-edge tag spacing
• Reduced visual clutter to enhance first-glance interpretation
• Refined visual hierarchy so entry, stop, current R, breakeven, and target references stand out more clearly
• Adjusted event-label behavior to avoid unnecessary overlap with candles
• Preserved centered text inside risk and target zones for a cleaner premium chart layout
------------------------
Interface & Usability
------------------------
• Optimized panel layout for clearer information flow
• Improved action-state wording so the panel reads more like a decision-support dashboard
• Improved label readability for better chart interaction
• Adjusted default visual settings for a more balanced publication screenshot
• Enhanced overall user experience without changing the core risk/reward logic
------------------------
Behavior Notes
------------------------
This update does not change the core analytical purpose of the script.
The script remains focused on entry, stop, R-multiple targets, breakeven review, and risk/reward planning.
The goal is to improve clarity and usability, not to introduce predictive behavior.
Users should interpret outputs the same way as before, but with improved visual structure and cleaner dashboard guidance.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, wick behavior, gaps, and timeframe differences may affect how risk boxes, R progress, breakeven review, and target references appear.
Auto-detected structure should always be visually checked by the user.
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, execution, and risk management.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
⚡ Precision Pine tools for crypto & FX traders
📊 ICT • Smart Money • Market Structure • Liquidity
🧠 Rules-based decision tools. No hype. No guesswork
⭐ Public AGPro Series + advanced invite-only tools
💬 t.me/agprolabs
📊 ICT • Smart Money • Market Structure • Liquidity
🧠 Rules-based decision tools. No hype. No guesswork
⭐ Public AGPro Series + advanced invite-only tools
💬 t.me/agprolabs
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
⚡ Precision Pine tools for crypto & FX traders
📊 ICT • Smart Money • Market Structure • Liquidity
🧠 Rules-based decision tools. No hype. No guesswork
⭐ Public AGPro Series + advanced invite-only tools
💬 t.me/agprolabs
📊 ICT • Smart Money • Market Structure • Liquidity
🧠 Rules-based decision tools. No hype. No guesswork
⭐ Public AGPro Series + advanced invite-only tools
💬 t.me/agprolabs
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。