OPEN-SOURCE SCRIPT
Cập nhật Pivot Matrix + Zones [AFD]

Overview
Pivot Matrix + Zones [AFD] brings up to three independently configured pivot systems into one coordinated overlay. It combines exact pivot ladders, standard Central Pivot Range (CPR), ATR- or tick-scaled reaction zones, formula-aware cross-pack confluence, retained untested levels, a compact context dashboard, and seven bar-close alert conditions.
Each pack can use a different formula and anchor, allowing combinations such as Daily Traditional, Daily Camarilla, and Weekly Fibonacci to be compared without merging their identities.
The script is designed for descriptive market context. It does not produce trade recommendations, forecasts, performance statistics, or automated orders.
What makes it different
The script's original contribution is its identity-aware coordination of the three packs rather than a simple stack of pivot lines. Each pack has its own formula, anchor, tier ceiling, formula-pivot and CPR visibility, labels, R/S color, and line style. One shared lifecycle model freezes reaction width at origin, carries formula and anchor provenance into retained levels and alerts, and keeps dashboard and drawing state aligned.

Confluence requires overlapping reaction zones from at least two distinct enabled packs. Multiple levels or historical origins from only one pack do not create confluence, and duplicate canonical levels do not inflate the displayed pack count. Exact formula-and-anchor duplicates are marked inactive instead of drawing the same configuration twice.
The implementation and lifecycle logic are original. The named pivot methods use standard published calculations identified below; no third-party indicator source code is reused.
Pivot formulas and anchors
The three packs can use Traditional, Floor Pivots, Fibonacci, Woodie, Classic, DM, Camarilla, Frank Dilernia, Shadow Trader, or ACD Method calculations. Traditional, Fibonacci, Woodie, Classic, DM, and Camarilla use the formulas documented for TradingView Pivot Points Standard. Floor Pivots uses the standard prior-period high, low, and close ladder through R3/S3; those levels match Traditional through the third tier, while Traditional retains its additional R4/R5 extensions.
Available anchors are Auto, Daily, Weekly, Monthly, Quarterly, and Yearly. Auto uses Daily pivots on chart resolutions through 15 minutes, Weekly pivots above 15 minutes and below one day, and Monthly pivots on daily-or-higher charts.
Each formula stops at its documented native tier. The Through Rn/Sn controls do not create unsupported extension levels. Camarilla calculations use the standard R/S equations and display H/L aliases alongside those names.
Data and session handling
Use daily-based values to request anchor data from the selected symbol context. Exchange default, RTH, and ETH choices are available. For futures, ETH uses the exchange-default electronic context, while RTH uses the named subsession entered in the settings. The default futures RTH name is us_regular, but valid names are symbol-specific.
On intraday charts, turning daily-based values off builds anchor values from the chart feed. This may reflect a visible session more closely, but Quarterly or Yearly anchors can have insufficient intraday history. On daily-or-higher charts, the script continues to use daily-based anchor data.
Most formulas use completed prior-anchor values. Woodie also uses the fixed open of the active anchor. The optional developing next CPR uses the active anchor's changing high, low, and close; it is visually separated and never enters confluence, retained history, or alerts.
CPR and reaction zones

CPR always uses the standard floor-pivot calculation from the completed period's high, low, and close. Its chart labels identify the center as PP, the lower Bottom Central boundary as Lower (BC), and the upper Top Central boundary as Upper (TC). This CPR pivot remains separate from a formula pivot when methods such as Woodie or DM produce a different value.
Reaction zones are symmetric bands around exact pivot prices. Their half-width can use confirmed Daily ATR, completed anchor ATR, or a fixed number of minimum ticks. The width is frozen when an anchor's geometry is created, so an existing zone does not drift as ATR changes inside that anchor. The exact pivot remains the center line; the surrounding fill is a configurable context band.
How to read the chart
Exact center lines are the calculated PP, resistance, support, or CPR levels. Soft surrounding fills show the configured interaction distance; they are not additional pivot levels or predictive outputs.
By default, formula PP lines and matching fills are yellow, Pack A R/S lines and fills are blue, and CPR boundaries and the central range are purple. Active labels identify Formula + Level, while CPR labels distinguish PP, Lower (BC), and Upper (TC). Price text is optional and hidden by default.
Confluence and retained levels
When eligible reaction zones from at least two distinct packs overlap, the script merges the overlap transitively into a confluence band. Each label names the unique contributing formulas and then shows the number of distinct packs represented, such as Traditional + Fibonacci x2. Enable confluence is the master control and is on by default. Turning it off removes confluence zones and labels and suppresses Confluence Touch events while the pivot packs, dashboard, retained-level lifecycle, and other alerts continue. When enabled, confluence color, text color, and projection change the display only, not the overlap or alert identity.
At an anchor rollover, eligible pivot zones that were not touched during their active period can be retained as Untested. A later confirmed wick overlap changes the record to TESTED, freezes and fades its drawing for 20 chart bars, and removes it afterward. Retained drawings are off by default, but lifecycle tracking, dashboard counts, confluence eligibility, and fill alerts continue while the drawings are hidden.
Dashboard
The compact dashboard shows only enabled packs with their selected pivot formula and any non-active status. It then classifies the two-period CPR relationship, reports whether the active-anchor open is above, below, or inside CPR, and shows the nearest retained untested level with the live count across all packs. CPR context follows the first enabled pack in A/B/C order.
Display controls
Active geometry can end at a finite current-bar offset, at the anchor end, or extend right. Confluence has its own finite current-bar, finite label-offset, and extend-right choices. Show confluence only hides non-confluence drawings while confluence is enabled; turning the master control off restores the normal layers. Calculations, the dashboard, lifecycle processing, and all enabled alerts continue.
Formula PP, CPR, labels, displayed prices, label size, line width, reaction shading, tier depth, and retained-level styling can be adjusted independently. Formula PP lines and fills default to yellow, Pack A R/S lines and fills default to blue, and CPR boundaries and the central range default to purple. The Inputs tab follows a numbered workflow and dims controls that do not apply without disabling calculations that still use their state. Prices are hidden by default, and chart labels identify formula and level without A/B/C prefixes; dashboard and alert provenance retain pack identity. Duplicate formula-and-anchor pack configurations are rejected rather than drawn twice.
Suggested setup workflow
Configure Pack A as the primary context, then enable Pack B or C when a second formula, anchor, or both are needed for comparison. Choose the highest native R/S tier, session basis, reaction-width method, and projection for the chart being reviewed. Use the dashboard and labels for identity, Show confluence only to isolate cross-pack overlaps, and retained-level drawings when the untested lifecycle should remain visible.
Create alerts only after the symbol, timeframe, sessions, pack settings, and reaction-width inputs are finalized, because those chart settings define the levels and events being monitored.
Alerts
Seven fixed conditions are available: Active Level Touch, Cross Up, Cross Down, CPR Enter, CPR Exit, Untested Level Filled, and Confluence Touch. Events confirm at chart-bar close. Optional dynamic messages aggregate supported events from the same confirmed bar and include available pack, formula, anchor, level, origin, and price context. TradingView running alerts retain the script inputs saved when they were created, so delete and recreate an alert after changing Enable confluence or another input.
Limitations
Pivot values and rollover timing depend on the selected symbol, data feed, anchor, session context, and available history. Daily and intraday feeds can differ because of extended hours, futures settlements, and feed construction. An invalid futures subsession name can fall back to the exchange default, so confirm the requested name in Inputs and compare the resulting pivots with the intended session.
Reaction zones and confluence visualize proximity; they do not predict a response. Untested means the configured zone was not touched during its tracked active period; it does not imply that price must revisit or react to it.
Use a standard time-based chart when evaluating touches, crosses, and alerts because those events use the chart's OHLC bars. Alerts still depend on TradingView alert creation, chart settings, feed updates, and bar-close processing.
The script keeps bounded histories of up to 30 live untested levels and 20 fading tested markers, with older retained records removed as those limits are reached. Confluence display is capped at 20 zones.
This is a public open-source Pine Script v6 indicator with a Mozilla Public License 2.0 source header. TradingView's open-source reuse rules apply on-platform before the license terms. It is an educational charting tool and is not financial advice.
Pivot Matrix + Zones [AFD] brings up to three independently configured pivot systems into one coordinated overlay. It combines exact pivot ladders, standard Central Pivot Range (CPR), ATR- or tick-scaled reaction zones, formula-aware cross-pack confluence, retained untested levels, a compact context dashboard, and seven bar-close alert conditions.
Each pack can use a different formula and anchor, allowing combinations such as Daily Traditional, Daily Camarilla, and Weekly Fibonacci to be compared without merging their identities.
The script is designed for descriptive market context. It does not produce trade recommendations, forecasts, performance statistics, or automated orders.
What makes it different
The script's original contribution is its identity-aware coordination of the three packs rather than a simple stack of pivot lines. Each pack has its own formula, anchor, tier ceiling, formula-pivot and CPR visibility, labels, R/S color, and line style. One shared lifecycle model freezes reaction width at origin, carries formula and anchor provenance into retained levels and alerts, and keeps dashboard and drawing state aligned.
Confluence requires overlapping reaction zones from at least two distinct enabled packs. Multiple levels or historical origins from only one pack do not create confluence, and duplicate canonical levels do not inflate the displayed pack count. Exact formula-and-anchor duplicates are marked inactive instead of drawing the same configuration twice.
The implementation and lifecycle logic are original. The named pivot methods use standard published calculations identified below; no third-party indicator source code is reused.
Pivot formulas and anchors
The three packs can use Traditional, Floor Pivots, Fibonacci, Woodie, Classic, DM, Camarilla, Frank Dilernia, Shadow Trader, or ACD Method calculations. Traditional, Fibonacci, Woodie, Classic, DM, and Camarilla use the formulas documented for TradingView Pivot Points Standard. Floor Pivots uses the standard prior-period high, low, and close ladder through R3/S3; those levels match Traditional through the third tier, while Traditional retains its additional R4/R5 extensions.
Available anchors are Auto, Daily, Weekly, Monthly, Quarterly, and Yearly. Auto uses Daily pivots on chart resolutions through 15 minutes, Weekly pivots above 15 minutes and below one day, and Monthly pivots on daily-or-higher charts.
Each formula stops at its documented native tier. The Through Rn/Sn controls do not create unsupported extension levels. Camarilla calculations use the standard R/S equations and display H/L aliases alongside those names.
Data and session handling
Use daily-based values to request anchor data from the selected symbol context. Exchange default, RTH, and ETH choices are available. For futures, ETH uses the exchange-default electronic context, while RTH uses the named subsession entered in the settings. The default futures RTH name is us_regular, but valid names are symbol-specific.
On intraday charts, turning daily-based values off builds anchor values from the chart feed. This may reflect a visible session more closely, but Quarterly or Yearly anchors can have insufficient intraday history. On daily-or-higher charts, the script continues to use daily-based anchor data.
Most formulas use completed prior-anchor values. Woodie also uses the fixed open of the active anchor. The optional developing next CPR uses the active anchor's changing high, low, and close; it is visually separated and never enters confluence, retained history, or alerts.
CPR and reaction zones
CPR always uses the standard floor-pivot calculation from the completed period's high, low, and close. Its chart labels identify the center as PP, the lower Bottom Central boundary as Lower (BC), and the upper Top Central boundary as Upper (TC). This CPR pivot remains separate from a formula pivot when methods such as Woodie or DM produce a different value.
Reaction zones are symmetric bands around exact pivot prices. Their half-width can use confirmed Daily ATR, completed anchor ATR, or a fixed number of minimum ticks. The width is frozen when an anchor's geometry is created, so an existing zone does not drift as ATR changes inside that anchor. The exact pivot remains the center line; the surrounding fill is a configurable context band.
How to read the chart
Exact center lines are the calculated PP, resistance, support, or CPR levels. Soft surrounding fills show the configured interaction distance; they are not additional pivot levels or predictive outputs.
By default, formula PP lines and matching fills are yellow, Pack A R/S lines and fills are blue, and CPR boundaries and the central range are purple. Active labels identify Formula + Level, while CPR labels distinguish PP, Lower (BC), and Upper (TC). Price text is optional and hidden by default.
Confluence and retained levels
When eligible reaction zones from at least two distinct packs overlap, the script merges the overlap transitively into a confluence band. Each label names the unique contributing formulas and then shows the number of distinct packs represented, such as Traditional + Fibonacci x2. Enable confluence is the master control and is on by default. Turning it off removes confluence zones and labels and suppresses Confluence Touch events while the pivot packs, dashboard, retained-level lifecycle, and other alerts continue. When enabled, confluence color, text color, and projection change the display only, not the overlap or alert identity.
At an anchor rollover, eligible pivot zones that were not touched during their active period can be retained as Untested. A later confirmed wick overlap changes the record to TESTED, freezes and fades its drawing for 20 chart bars, and removes it afterward. Retained drawings are off by default, but lifecycle tracking, dashboard counts, confluence eligibility, and fill alerts continue while the drawings are hidden.
Dashboard
The compact dashboard shows only enabled packs with their selected pivot formula and any non-active status. It then classifies the two-period CPR relationship, reports whether the active-anchor open is above, below, or inside CPR, and shows the nearest retained untested level with the live count across all packs. CPR context follows the first enabled pack in A/B/C order.
Display controls
Active geometry can end at a finite current-bar offset, at the anchor end, or extend right. Confluence has its own finite current-bar, finite label-offset, and extend-right choices. Show confluence only hides non-confluence drawings while confluence is enabled; turning the master control off restores the normal layers. Calculations, the dashboard, lifecycle processing, and all enabled alerts continue.
Formula PP, CPR, labels, displayed prices, label size, line width, reaction shading, tier depth, and retained-level styling can be adjusted independently. Formula PP lines and fills default to yellow, Pack A R/S lines and fills default to blue, and CPR boundaries and the central range default to purple. The Inputs tab follows a numbered workflow and dims controls that do not apply without disabling calculations that still use their state. Prices are hidden by default, and chart labels identify formula and level without A/B/C prefixes; dashboard and alert provenance retain pack identity. Duplicate formula-and-anchor pack configurations are rejected rather than drawn twice.
Suggested setup workflow
Configure Pack A as the primary context, then enable Pack B or C when a second formula, anchor, or both are needed for comparison. Choose the highest native R/S tier, session basis, reaction-width method, and projection for the chart being reviewed. Use the dashboard and labels for identity, Show confluence only to isolate cross-pack overlaps, and retained-level drawings when the untested lifecycle should remain visible.
Create alerts only after the symbol, timeframe, sessions, pack settings, and reaction-width inputs are finalized, because those chart settings define the levels and events being monitored.
Alerts
Seven fixed conditions are available: Active Level Touch, Cross Up, Cross Down, CPR Enter, CPR Exit, Untested Level Filled, and Confluence Touch. Events confirm at chart-bar close. Optional dynamic messages aggregate supported events from the same confirmed bar and include available pack, formula, anchor, level, origin, and price context. TradingView running alerts retain the script inputs saved when they were created, so delete and recreate an alert after changing Enable confluence or another input.
Limitations
Pivot values and rollover timing depend on the selected symbol, data feed, anchor, session context, and available history. Daily and intraday feeds can differ because of extended hours, futures settlements, and feed construction. An invalid futures subsession name can fall back to the exchange default, so confirm the requested name in Inputs and compare the resulting pivots with the intended session.
Reaction zones and confluence visualize proximity; they do not predict a response. Untested means the configured zone was not touched during its tracked active period; it does not imply that price must revisit or react to it.
Use a standard time-based chart when evaluating touches, crosses, and alerts because those events use the chart's OHLC bars. Alerts still depend on TradingView alert creation, chart settings, feed updates, and bar-close processing.
The script keeps bounded histories of up to 30 live untested levels and 20 fading tested markers, with older retained records removed as those limits are reached. Confluence display is capped at 20 zones.
This is a public open-source Pine Script v6 indicator with a Mozilla Public License 2.0 source header. TradingView's open-source reuse rules apply on-platform before the license terms. It is an educational charting tool and is not financial advice.
Phát hành các Ghi chú
Update: clearer test status, confluence, dashboard help, and consistent namingThis revision updates the existing Pivot Matrix + Zones [AFD] script. The nine pivot calculations, standard CPR math, anchor/session data, frozen reaction geometry, and seven confirmed-bar event definitions are unchanged.
Formula and identity cleanup
• Formula menus now contain nine distinct methods. The duplicate Traditional option was removed; Shadow Trader remains the Pack A default.
• The Pine title, chart short title, dashboard header, runtime messages, alert-condition names, GitHub folder, and source filename now use the published Pivot Matrix + Zones [AFD] identity consistently.
• Alert-condition names now carry the full published title. Recreate alerts after updating so they use the current script and input snapshot.
Tested and Untested visuals
• Color levels by test status now works with Pack A alone for active pivot and CPR drawings. Confluence still requires two distinct enabled packs.
• Active pivots, CPR, and current confluence can use separate user-selected Untested and Tested colors and line or border styles.
• A level changes state only after a confirmed bar's wick touches its frozen reaction band.
• Rollover now retains both states: up to 30 Untested and 20 Tested pivot/CPR records. A later touch updates an Untested record, freezes its right edge, and moves it into Tested history.
• The prior 20-bar Tested fade was removed. Optional historical fills use the same frozen band as the touch test.
• Optional status labels remain right of current price and use up to eight horizontal lanes when nearby zones overlap. An additional collision can hide only that label; its line and tracking state remain active.
Confluence and labels
• Chart confluence labels now list each unique formula once in Pack A/B/C order and omit the x-count. Dynamic alert detail still retains the distinct-pack count.
• A confluence zone begins when its newest contributor exists. Newer overlaps can therefore have a shorter left edge than older retained clusters; this is origin-aware geometry, not a missing extension.
• Qualification remains unchanged: connected reaction bands must contain at least two distinct enabled pack identities, and duplicate canonical levels do not inflate the result.
Dashboard and help
• Formula cells provide concise equation help on hover.
• The dashboard no longer shows Stored, age, live totals, or record counts. Nearest Untested is limited to the single closest Pack Level; its hover contains the exact price and confirmed-wick rule.
• Settings tooltips were rewritten as short bullet guidance that reflects the current calculation and display behavior.
Settings and compatibility
• The script now has 61 public inputs, including independent status colors/styles, history visibility/fill, and optional status labels.
• Existing alerts retain their creation-time script and inputs. Delete and recreate affected alerts after applying this update.
• Developing Pack A CPR remains provisional and excluded from history, confluence, dashboard context, and alerts.
Phát hành các Ghi chú
Update v2.0: a plain-language Read, a clean Simple preset, a redesigned dashboard, and five fixesThe nine pivot calculations, CPR math, anchor and session data, and reaction geometry are unchanged. Every formula was re-checked level by level against TradingView's own Pivot Points Standard documentation, Sierra Chart's Pivot Points study, and ShadowTrader's published glossary; no calculation needed correcting.
New — plain-language Read
• The dashboard now leads with a Read line: price location (Above R1 / Above CPR / Inside CPR / Below CPR / Below S1) paired with the prior-period CPR relationship. Descriptive location only.
New — Simple chart preset
• A Chart preset input (Simple / Full) defaults to Simple: the CPR, PP, and R1/S1 only, for a clean chart. Set it to Full for the complete ladder each pack selects. It changes only what is drawn — not the pivot math, tracking, or alerts.
New — redesigned dashboard
• The card is now a slate panel with an accented title bar, the Read line highlighted as its headline row, alternating row tints, labels left and values right, and light gridlines. A pack showing any status other than ACTIVE — DUPLICATE, NO DATA, INVALID ANCHOR, ATR UNAVAILABLE — is tinted amber so a misconfigured pack is obvious at a glance. Nothing here is coloured by direction, and none of it changes the pivot math, tracking, or alerts. Text size is still yours to set under Dashboard.
Fixed — level tracking under Camarilla
• With Tracking scope on Core, a Camarilla pack tracked only H3/L3 and H4/L4; its CPR band and pivot were left out of Untested/Tested history, out of Nearest Untested, and out of the Untested Level Filled alert. The CPR and the pivot are now core under every formula — only the R/S pair changes, and Camarilla's is still H3/L3 and H4/L4.
Fixed — CPR Enter and CPR Exit alerts
• Turning off Pack A's CPR checkbox silently stopped both alerts firing. That checkbox now hides the drawings only; the two alerts keep firing while it is hidden, which is what the tooltips have always described. If you had disabled the CPR drawing and relied on the silence, these alerts will now fire.
Fixed — duplicate pack detection
• Shadow Trader and Floor Pivots produce the same ladder, so running one of each on the same anchor drew two identical sets of levels while both packs reported ACTIVE. Duplicate detection now compares the ladder rather than the name, and the second pack reports DUPLICATE.
Fixed — dashboard context row
• The card followed Pack A whenever Pack A was enabled, so an invalid anchor on Pack A blanked the whole card while Packs B and C drew normally. It now follows the first pack that is actually operational.
Renamed
• The dashboard row "Two-Day CPR" is now "CPR vs Prior", with hover help — it always compared the two most recent anchor periods, which is two days only on a Daily anchor.
• The chart short title is now "PMZ [AFD]", so the legend is readable. The full title, the nine formula names, the input names, and the seven alert titles are unchanged.
• The dashboard's right-hand header now reads "Hover" rather than "Hover formulas" — the formula cells are not the only ones carrying hover help. Read, CPR vs Prior, and Nearest Untested all have it too.
Clarified
• Shadow Trader's dashboard help states that it reproduces the classic floor-pivot ladder (identical R/S to Floor Pivots).
Existing alerts keep their creation-time inputs; delete and recreate them after updating if you rely on the new defaults or on the two CPR alert fixes. Descriptive chart context — it does not predict a response, issue trades, or establish performance.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Auction Foundry - See the Auction more clearly.
All content provided is for informational & educational purposes only.
Website: auction-foundry.io
Instagram: instagram.com/AuctionFoundry
X:@AuctionFoundry
All content provided is for informational & educational purposes only.
Website: auction-foundry.io
Instagram: instagram.com/AuctionFoundry
X:@AuctionFoundry
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Auction Foundry - See the Auction more clearly.
All content provided is for informational & educational purposes only.
Website: auction-foundry.io
Instagram: instagram.com/AuctionFoundry
X:@AuctionFoundry
All content provided is for informational & educational purposes only.
Website: auction-foundry.io
Instagram: instagram.com/AuctionFoundry
X:@AuctionFoundry
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.