OPEN-SOURCE SCRIPT
Atualizado Round Number Magnet Map [AGPro Series]

Round Number Magnet Map [AGPro Series]
════════════════════════════════════════
🔹 OVERVIEW
Round numbers act as psychological magnets on every liquid market. Traders cluster stop orders, limit orders, and mental entries around levels like 2000, 2400, 50000. These levels attract price, get tested repeatedly, and either hold with sharp reactions or break with decisive momentum. Yet most round-number tools ship a hard-coded list (100, 500, 1000) that works on some charts and fails on others.
Round Number Magnet Map is a psychological level engine that detects the right round numbers for any symbol automatically, tracks every touch with a composite reaction grading system, and ranks the strongest magnets in a professional leaderboard. It works out of the box on Bitcoin at 100k, on Ethereum at 2k, on Solana at 10, on EUR/USD at 1.05, on the S&P 500 at 5000, and on gold at 2400 — no configuration required. Traders who prefer manual control can override the auto-detected tiers with their own comma-separated list.
The indicator is asset-agnostic, non-repainting, bar-confirmed, and optimized for speed. It is designed to be a permanent chart companion on any timeframe.
🔹 UNIQUE EDGE
What separates Round Number Magnet Map from generic round-number indicators:
1. Asset-aware auto-detection. The script reads current price magnitude and selects the correct tier spacing automatically — 10000/5000/1000 for high-cap assets, 100/50/10 for mid-cap, 0.01/0.005/0.001 for forex majors. Three nested tiers render simultaneously so both major and minor psychological levels are visible with a clear visual hierarchy.
2. Composite reaction grading. Each touch is not just counted — it is graded. The script combines three inputs: ATR reaction (how many ATRs price traveled after the touch), wick rejection ratio (how strongly the touch bar rejected the level), and relative volume (whether institutional flow confirmed the reaction). The result is a 0-100 score mapped to A/B/C/D grades, so traders can distinguish a truly respected magnet from a level that price simply grazed.
3. Broken-level recovery logic. Most tools mark a level as "broken" the first time price closes through it and leave it broken forever. That is wrong on round numbers — price oscillates around 2000, 3000, 10000 repeatedly across months and years. This engine un-breaks a level the moment price returns to its zone, so the map always reflects current reality.
4. On-chart leaderboard. The panel ranks the top 5 most-touched levels visible in the current chart window, with touch count and composite grade, so the strongest magnets are always one glance away.
5. Clean by design. Rendering is restricted to an ATR-scaled window around current price, with optional toggles to hide broken and untouched levels. The chart stays readable even on high timeframes where dozens of round numbers would otherwise clutter the view.
🔹 METHODOLOGY
Tier generation. When auto-detect is enabled, the script classifies current price into a magnitude bucket (>10000, 1000-10000, 100-1000, 10-100, 1-10, <1, etc.) and assigns a three-tier spacing. Tier 0 is the major step, tier 1 is a half-step, tier 2 is a fine step. All three tiers are generated around current price within an ATR-scaled search range, deduplicated, and capped at a configurable maximum (default 20).
Touch detection. Each level is surrounded by a zone of thickness (ATR × configurable multiplier, default 0.20). A touch is registered when a bar's high-low range intersects the zone and at least N bars have passed since the last touch on that level (cooldown, default 5). This prevents a single consolidation from inflating the touch count.
Reaction grading. Exactly N bars after a touch (default 5), the script computes:
• ATR reaction (60% weight): maximum favorable excursion from the level in the direction of the test, normalized against a target of 2 ATRs = score 100.
• Wick rejection (25% weight): the rejection wick on the touch bar relative to the bar's range.
• Relative volume (15% weight): volume on the touch bar relative to the 20-bar average.
The three components are combined into a single 0-100 composite score. Scores of 80+ are grade A, 65-80 are grade B, 45-65 are grade C, below 45 are grade D.
Break detection. A level is marked as broken only when, during a reaction grading, price has closed beyond the zone by an additional 0.3 ATR in the opposite direction of the test. This strict criterion avoids false breaks from single wicks or low-conviction closes. Broken levels are un-marked automatically when price returns to the zone.
Rendering. Active non-broken levels render as solid blue lines with an optional S/R-style zone box. Broken levels render as dashed gray lines with a BRK badge. Labels show price, touch count, and grade. Priority-0 (major) levels render with increased line width, and levels within 1 ATR of price render thicker still (magnet effect).
🔹 SIGNALS & ALERTS
The script generates four non-repainting, bar-confirmed alert conditions:
• Touch — price has entered a round-number zone.
• Held (Strong Reaction) — a touch has resolved with a composite score ≥ 60, meaning the level held with meaningful reaction strength.
• Broken — a level has been decisively broken by a strong close beyond the zone.
• Magnet Approach — price is within 0.5 ATR of a level, approaching without yet touching.
Each alert fires at bar close and carries ticker and timeframe tokens for routing to external automation.
🔹 KEY INPUTS
Detection
• Auto-Detect Tiers — asset-aware tier selection (recommended).
• Custom Tiers — comma-separated override (e.g., "1000,500,100" for BTC).
• Level Search Range — how far from price to generate levels, in ATR-scaled units.
• Max Active Levels — hard cap on rendered levels (default 20).
Touch & Zone
• Zone Thickness — size of each round-number zone in ATR units (default 0.20).
• ATR Length — period for ATR used in zone and reaction calculations (default 14).
• Touch Cooldown — minimum bars between touches on the same level (default 5).
• Reaction Window — bars after a touch used for reaction grading (default 5).
Reaction Grading
• Weight: ATR Reaction / Wick Rejection / Relative Volume — configurable composite weights. Weights are normalized automatically if they do not sum to 1.
• ATR Normalization Target — the ATR-reaction value that maps to score 100.
Visuals
• Show Zones, Show Level Labels, Hide Broken Levels, Hide Untouched Levels, Magnet Effect.
• Far Levels Transparency, Label Size, Label Offset.
Panel
• Show Panel, Panel Location (6 options), Panel Theme (Dark/Light), Panel Font Size.
Alerts
• Independent toggles for Touch, Held, Broken, Magnet Approach.
🔹 HOW TO USE
The indicator is designed for discretionary trading and framework-based decision making. A few practical patterns:
1. Use the nearest Above and Below levels in the panel as your immediate target and invalidation reference. The Strongest line on the panel is the highest-conviction magnet in view.
2. Grade A and B levels are historically respected by this market. When price approaches one, expect a reaction. When price approaches a Grade D level, expect a clean pass-through or a trap.
3. Confluence with other tools. Round numbers combined with a swing high/low, a moving average, or a Fibonacci level are far more likely to hold than a round number alone. Treat this indicator as one layer in a stacked decision framework.
4. Timeframe selection. Use higher timeframes (1D, 4H) to identify the dominant magnets for position trading, and drop to lower timeframes (1H, 15m) for execution around those same levels.
5. Broken levels are still information. A dashed level with 20+ historical touches is a zone where liquidity has been swept and where retests often provide re-entry opportunities.
🔹 LIMITATIONS & TRANSPARENCY
• This tool identifies psychological levels and grades their historical reaction quality. It does not predict price direction and it is not a trading strategy. Use it as part of a complete decision framework.
• Reaction grades are historical, not forward-looking. A level that held five times may still break on the next test, especially in strong trending conditions or during high-impact news events.
• Touch counts depend on chart history. On symbols with limited history, recent levels may have fewer touches than their true significance warrants.
• The reaction window is fixed (default 5 bars). Reactions that take longer to develop will be graded as weaker than they truly are. Adjust the window to match the instrument and timeframe.
• Extremely low-volume symbols may produce noisy reaction scores because the relative-volume component becomes unreliable. Reduce its weight to 0 in such cases.
🔹 RISK DISCLOSURE
This indicator is a technical analysis tool for educational and discretionary decision support. It does not constitute financial advice, investment advice, a solicitation, or a recommendation to buy or sell any instrument. Past reactions at any level do not guarantee future behavior. All trading involves substantial risk of loss. You are solely responsible for your trading decisions and for managing your capital.
════════════════════════════════════════
🔹 OVERVIEW
Round numbers act as psychological magnets on every liquid market. Traders cluster stop orders, limit orders, and mental entries around levels like 2000, 2400, 50000. These levels attract price, get tested repeatedly, and either hold with sharp reactions or break with decisive momentum. Yet most round-number tools ship a hard-coded list (100, 500, 1000) that works on some charts and fails on others.
Round Number Magnet Map is a psychological level engine that detects the right round numbers for any symbol automatically, tracks every touch with a composite reaction grading system, and ranks the strongest magnets in a professional leaderboard. It works out of the box on Bitcoin at 100k, on Ethereum at 2k, on Solana at 10, on EUR/USD at 1.05, on the S&P 500 at 5000, and on gold at 2400 — no configuration required. Traders who prefer manual control can override the auto-detected tiers with their own comma-separated list.
The indicator is asset-agnostic, non-repainting, bar-confirmed, and optimized for speed. It is designed to be a permanent chart companion on any timeframe.
🔹 UNIQUE EDGE
What separates Round Number Magnet Map from generic round-number indicators:
1. Asset-aware auto-detection. The script reads current price magnitude and selects the correct tier spacing automatically — 10000/5000/1000 for high-cap assets, 100/50/10 for mid-cap, 0.01/0.005/0.001 for forex majors. Three nested tiers render simultaneously so both major and minor psychological levels are visible with a clear visual hierarchy.
2. Composite reaction grading. Each touch is not just counted — it is graded. The script combines three inputs: ATR reaction (how many ATRs price traveled after the touch), wick rejection ratio (how strongly the touch bar rejected the level), and relative volume (whether institutional flow confirmed the reaction). The result is a 0-100 score mapped to A/B/C/D grades, so traders can distinguish a truly respected magnet from a level that price simply grazed.
3. Broken-level recovery logic. Most tools mark a level as "broken" the first time price closes through it and leave it broken forever. That is wrong on round numbers — price oscillates around 2000, 3000, 10000 repeatedly across months and years. This engine un-breaks a level the moment price returns to its zone, so the map always reflects current reality.
4. On-chart leaderboard. The panel ranks the top 5 most-touched levels visible in the current chart window, with touch count and composite grade, so the strongest magnets are always one glance away.
5. Clean by design. Rendering is restricted to an ATR-scaled window around current price, with optional toggles to hide broken and untouched levels. The chart stays readable even on high timeframes where dozens of round numbers would otherwise clutter the view.
🔹 METHODOLOGY
Tier generation. When auto-detect is enabled, the script classifies current price into a magnitude bucket (>10000, 1000-10000, 100-1000, 10-100, 1-10, <1, etc.) and assigns a three-tier spacing. Tier 0 is the major step, tier 1 is a half-step, tier 2 is a fine step. All three tiers are generated around current price within an ATR-scaled search range, deduplicated, and capped at a configurable maximum (default 20).
Touch detection. Each level is surrounded by a zone of thickness (ATR × configurable multiplier, default 0.20). A touch is registered when a bar's high-low range intersects the zone and at least N bars have passed since the last touch on that level (cooldown, default 5). This prevents a single consolidation from inflating the touch count.
Reaction grading. Exactly N bars after a touch (default 5), the script computes:
• ATR reaction (60% weight): maximum favorable excursion from the level in the direction of the test, normalized against a target of 2 ATRs = score 100.
• Wick rejection (25% weight): the rejection wick on the touch bar relative to the bar's range.
• Relative volume (15% weight): volume on the touch bar relative to the 20-bar average.
The three components are combined into a single 0-100 composite score. Scores of 80+ are grade A, 65-80 are grade B, 45-65 are grade C, below 45 are grade D.
Break detection. A level is marked as broken only when, during a reaction grading, price has closed beyond the zone by an additional 0.3 ATR in the opposite direction of the test. This strict criterion avoids false breaks from single wicks or low-conviction closes. Broken levels are un-marked automatically when price returns to the zone.
Rendering. Active non-broken levels render as solid blue lines with an optional S/R-style zone box. Broken levels render as dashed gray lines with a BRK badge. Labels show price, touch count, and grade. Priority-0 (major) levels render with increased line width, and levels within 1 ATR of price render thicker still (magnet effect).
🔹 SIGNALS & ALERTS
The script generates four non-repainting, bar-confirmed alert conditions:
• Touch — price has entered a round-number zone.
• Held (Strong Reaction) — a touch has resolved with a composite score ≥ 60, meaning the level held with meaningful reaction strength.
• Broken — a level has been decisively broken by a strong close beyond the zone.
• Magnet Approach — price is within 0.5 ATR of a level, approaching without yet touching.
Each alert fires at bar close and carries ticker and timeframe tokens for routing to external automation.
🔹 KEY INPUTS
Detection
• Auto-Detect Tiers — asset-aware tier selection (recommended).
• Custom Tiers — comma-separated override (e.g., "1000,500,100" for BTC).
• Level Search Range — how far from price to generate levels, in ATR-scaled units.
• Max Active Levels — hard cap on rendered levels (default 20).
Touch & Zone
• Zone Thickness — size of each round-number zone in ATR units (default 0.20).
• ATR Length — period for ATR used in zone and reaction calculations (default 14).
• Touch Cooldown — minimum bars between touches on the same level (default 5).
• Reaction Window — bars after a touch used for reaction grading (default 5).
Reaction Grading
• Weight: ATR Reaction / Wick Rejection / Relative Volume — configurable composite weights. Weights are normalized automatically if they do not sum to 1.
• ATR Normalization Target — the ATR-reaction value that maps to score 100.
Visuals
• Show Zones, Show Level Labels, Hide Broken Levels, Hide Untouched Levels, Magnet Effect.
• Far Levels Transparency, Label Size, Label Offset.
Panel
• Show Panel, Panel Location (6 options), Panel Theme (Dark/Light), Panel Font Size.
Alerts
• Independent toggles for Touch, Held, Broken, Magnet Approach.
🔹 HOW TO USE
The indicator is designed for discretionary trading and framework-based decision making. A few practical patterns:
1. Use the nearest Above and Below levels in the panel as your immediate target and invalidation reference. The Strongest line on the panel is the highest-conviction magnet in view.
2. Grade A and B levels are historically respected by this market. When price approaches one, expect a reaction. When price approaches a Grade D level, expect a clean pass-through or a trap.
3. Confluence with other tools. Round numbers combined with a swing high/low, a moving average, or a Fibonacci level are far more likely to hold than a round number alone. Treat this indicator as one layer in a stacked decision framework.
4. Timeframe selection. Use higher timeframes (1D, 4H) to identify the dominant magnets for position trading, and drop to lower timeframes (1H, 15m) for execution around those same levels.
5. Broken levels are still information. A dashed level with 20+ historical touches is a zone where liquidity has been swept and where retests often provide re-entry opportunities.
🔹 LIMITATIONS & TRANSPARENCY
• This tool identifies psychological levels and grades their historical reaction quality. It does not predict price direction and it is not a trading strategy. Use it as part of a complete decision framework.
• Reaction grades are historical, not forward-looking. A level that held five times may still break on the next test, especially in strong trending conditions or during high-impact news events.
• Touch counts depend on chart history. On symbols with limited history, recent levels may have fewer touches than their true significance warrants.
• The reaction window is fixed (default 5 bars). Reactions that take longer to develop will be graded as weaker than they truly are. Adjust the window to match the instrument and timeframe.
• Extremely low-volume symbols may produce noisy reaction scores because the relative-volume component becomes unreliable. Reduce its weight to 0 in such cases.
🔹 RISK DISCLOSURE
This indicator is a technical analysis tool for educational and discretionary decision support. It does not constitute financial advice, investment advice, a solicitation, or a recommendation to buy or sell any instrument. Past reactions at any level do not guarantee future behavior. All trading involves substantial risk of loss. You are solely responsible for your trading decisions and for managing your capital.
Notas de Lançamento
UPDATE NOTES - V2.4This update focuses on premium label readability, panel cleanliness, and publication-grade presentation.
The core purpose of the script remains unchanged.
This release improves how round-number magnet levels, labels, and leaderboard information are presented 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
------------------------
* Improved round-number label contrast.
Level labels now use a stronger configurable colored badge background so they remain readable on dark and light chart backgrounds.
* Added label background transparency control.
Users can now adjust label background strength from the visual settings without changing the core magnet logic.
* Cleaned publication text formatting.
Touch-count and leaderboard text now uses clean ASCII formatting such as "x3 - A" instead of special symbols that can render inconsistently.
* Improved panel hide behavior.
When the panel is disabled, existing panel cells are cleared so stale panel content does not remain on the chart.
* Updated shorttitle.
The shorttitle now uses "AG Pro RN" to stay within a cleaner compact TradingView display length.
------------------------
Visual Improvements
------------------------
* Improved chart readability by strengthening round-number label badges.
* Reduced risk of low-contrast labels on user-selected light chart backgrounds.
* Preserved clean horizontal magnet zones and level lines.
* Kept panel hierarchy intact with a merged AG Pro blue header row.
------------------------
Interface & Usability
------------------------
* Added "Label Background Transparency" to Visuals.
* Kept panel location, panel theme, panel font size, label size, and label offset controls intact.
* Kept level visibility controls such as Hide Broken Levels and Hide Untouched Levels intact.
* Kept alerts as attention markers for touch, hold, break, and magnet approach events.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of the script.
Round-number tier detection, touch counting, reaction grading, broken-level handling, leaderboard ranking, and alert triggers remain conceptually unchanged.
Users should interpret outputs the same way as before, but with cleaner visual structure.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, and timeframe differences may affect how levels behave.
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.
Notas de Lançamento
🔧 UPDATE NOTES - v2.5This update focuses on readability and decision transparency.
The core purpose of the script remains unchanged.
This release hardens on-chart label contrast and adds an honest hold statistic
so the strength of psychological round numbers is easier to judge at a glance.
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
------------------------
• Stop-Aware Magnet Hold Rate
A new "Hold Rate" panel row reports how often a touched round number repelled
price with a clean reaction before the level was strongly broken. A win means
the magnet held with a meaningful reaction and a loss means price broke decisively
through the level instead, which reuses the script's own reaction window and break
distance, now tallied across every graded touch. Touches that resolve neither way
are left uncounted, and the row shows the sample size and reads "Building" until
enough touches have completed. This adds context to the existing reaction grades
without changing how any score, touch, or break is calculated.
• Hardened Label Contrast
Every round-number label now selects its text color from the brightness of its
own background, so held, neutral, broken, and brand-colored levels stay legible.
This corrects light text that previously sat on lighter held and neutral fills.
• ATR Hardening
The internal ATR reference is now protected against empty early-bar readings,
keeping zone thickness, reaction measurement, and level spacing stable on the
very first bars of a chart and on thin or newly listed symbols.
------------------------
Visual Improvements
------------------------
• Improved chart readability by hardening round-number label contrast
• Preserved the existing zones, lines, magnet effect, and leaderboard layout
• Refined visual hierarchy so held and broken levels read clearly
• Maintained the same premium presentation across themes
------------------------
Interface & Usability
------------------------
• Optimized panel layout with a new magnet hold-rate row
• Improved label readability for better chart interaction
• Adjusted default visual presentation for a more balanced appearance
• Enhanced overall user experience without changing core logic
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of the script.
The level detection, touch grading, zones, break logic, and leaderboard behave
the same as before. The Hold Rate is an observational statistic only.
Users should interpret outputs the same way as before, but with improved visual
structure and added hold context.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, and timeframe differences may
affect how levels, touches, and the hold rate appear.
The hold rate is a historical observation on the current chart and does not
predict future touches. 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.
Notas de Lançamento
🔧 UPDATE NOTES - v2.6This is a minor maintenance release.
The core purpose of the script remains unchanged.
This release refreshes the published presentation and does not alter the
detection, grading, hold-rate, or visual logic introduced in earlier versions.
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
------------------------
• Maintenance and version refresh
This update re-publishes the script with no change to its analytical logic.
Level detection, touch grading, the composite reaction score, the magnet hold
rate, zones, lines, and the leaderboard all behave exactly as before.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of the script.
Users should interpret outputs exactly the same way as in the previous version.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, and timeframe differences may
affect how levels, touches, and the hold 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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Public-free scripts + invite-only AGPro workflows for market analysis, liquidity context, risk planning and execution review.
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Public-free scripts + invite-only AGPro workflows for market analysis, liquidity context, risk planning and execution review.
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.