OPEN-SOURCE SCRIPT
Cập nhật Smart Money Dynamics Blocks — Pearson Matrix

Smart Money Dynamics Blocks — Pearson Matrix
A structural fusion of Prime Number Theory, Pearson Correlation, and Cumulative Delta Geometry.
1. Mathematical Foundation
This indicator is built on the intersection of Prime Number Theory and the Pearson correlation coefficient, creating a structural framework that quantifies how price and time evolve together.
Prime numbers — unique, indivisible, and irregular — are used here as nonlinear time intervals. Each prime length (2, 3, 5, 7, 11…97) represents a regression horizon where correlation is measured between price and time. The result is a multi-scale correlation lattice — a geometric matrix that captures hidden directional strength and temporal bias beyond traditional moving averages.
2. The Pearson Matrix Logic
For every prime interval p, the indicator calculates the linear correlation:
r_p = corr(price, bar_index, p)
Each r_p reflects how closely price and time move together across a prime-defined window. All r_p values are then averaged to create avgR, a single adaptive coefficient summarizing overall structural coherence.
- When avgR > 0.8 → strong positive correlation (labeled R+).
- When avgR < -0.8 → strong negative correlation (labeled R−).
This approach gives a mathematically grounded definition of trend — one that isn’t based on pattern recognition, but on measurable correlation strength.
3. Sequential Prime Slope and Median Pivot
Using the ordered sequence of 25 prime intervals, the model computes sequential slopes between adjacent primes. These slopes represent the rate of change of structure between two prime scales. A robust median aggregator smooths the slopes, producing a clean, stable directional vector.
The system anchors this slope to the 41-bar pivot — the median of the first 25 primes — serving as the geometric midpoint of the prime lattice. The resulting yellow line on the chart is not an ordinary regression line; it’s a dynamic prime-slope function, adapting continuously with correlation feedback.
4. Regression-Style Parallel Bands
Around this prime-slope line, the indicator constructs parallel bands using standard deviation envelopes — conceptually similar to a regression channel but recalculated through the prime–Pearson matrix.
These bands adjust dynamically to:
- Volatility, via standard deviation of residuals.
- Correlation strength, via avgR sign weighting.
Together, they visualize statistical deviation geometry, making it easier to observe symmetry, expansion, and contraction phases of price structure.
5. Volume and Cumulative Delta Peaks
Below the geometric layer, the indicator incorporates a custom lower-timeframe volume feed — by default using 15-second data (custom_tf_input_volume = “15S”). This allows precise delta computation between up-volume and down-volume even on higher timeframe charts.
From this feed, the indicator accumulates delta over a configurable period (default: 100 bars). When cumulative delta reaches a local maximum or minimum, peak and trough markers appear, showing the precise bar where buying or selling pressure statistically peaked.
This combination of geometry and order flow reveals the intersection of market structure and energy — where liquidity pressure expresses itself through mathematical form.
6. Chart Interpretation
The primary chart view represents the live execution of the indicator. It displays the relationship between structural correlation and volume behavior in real time.
Orange “R+” and blue “R−” labels indicate regions of strong positive or negative Pearson correlation across the prime matrix. The yellow median prime-slope line serves as the structural backbone of the indicator, while green and red parallel bands act as dynamic regression boundaries derived from the underlying correlation strength. Peaks and troughs in cumulative delta — displayed as numerical annotations — mark statistically significant shifts in buying and selling pressure.

The secondary visualization (Prime Regression Concept) expands on this by illustrating how regression behavior evolves across prime intervals. Each colored regression fan corresponds to a prime number window (2, 3, 5, 7, …, 97), demonstrating how multiple regression lines would appear if drawn independently. The indicator integrates these into one unified geometric model — eliminating the need to plot tens of regression lines manually. It’s a conceptual tool to help visualize the internal logic: the synthesis of many small-scale regressions into a single coherent structure.
7. Interpretive Insight
This model is not a prediction tool; it’s an instrument of mathematical observation. By translating price dynamics into a prime-structured correlation space, it reveals how coherence unfolds through time — not as a forecast, but as a measurable evolution of structure.
It unifies three analytical domains:
- Prime distribution — defines a nonlinear temporal architecture.
- Pearson correlation — quantifies statistical cohesion.
- Cumulative delta — expresses behavioral imbalance in order flow.
The synthesis creates a geometric analysis of liquidity and time — where structure meets energy, and where the invisible rhythm of market flow becomes measurable.
8. Contribution & Feedback
Share your observations in the comments:
- The time gap and alternation between R+ and R− clusters.
- How different timeframes change delta sensitivity or reveal compression/expansion.
- Prime intervals/clusters that tend to sit near turning points or liquidity shifts.
- How avgR behaves across assets or regimes (trending, ranging, high-vol).
- Notable interactions with the parallel bands (touches, breaks, mean-revert).
Your field notes help others read the model more effectively and compare contexts.
Summary
- Primes define the structure.
- Pearson quantifies coherence.
- Slope median stabilizes geometry.
- Regression bands visualize deviation.
- Cumulative delta locates imbalance.
Together, they construct a framework where mathematics meets market behavior.
A structural fusion of Prime Number Theory, Pearson Correlation, and Cumulative Delta Geometry.
1. Mathematical Foundation
This indicator is built on the intersection of Prime Number Theory and the Pearson correlation coefficient, creating a structural framework that quantifies how price and time evolve together.
Prime numbers — unique, indivisible, and irregular — are used here as nonlinear time intervals. Each prime length (2, 3, 5, 7, 11…97) represents a regression horizon where correlation is measured between price and time. The result is a multi-scale correlation lattice — a geometric matrix that captures hidden directional strength and temporal bias beyond traditional moving averages.
2. The Pearson Matrix Logic
For every prime interval p, the indicator calculates the linear correlation:
r_p = corr(price, bar_index, p)
Each r_p reflects how closely price and time move together across a prime-defined window. All r_p values are then averaged to create avgR, a single adaptive coefficient summarizing overall structural coherence.
- When avgR > 0.8 → strong positive correlation (labeled R+).
- When avgR < -0.8 → strong negative correlation (labeled R−).
This approach gives a mathematically grounded definition of trend — one that isn’t based on pattern recognition, but on measurable correlation strength.
3. Sequential Prime Slope and Median Pivot
Using the ordered sequence of 25 prime intervals, the model computes sequential slopes between adjacent primes. These slopes represent the rate of change of structure between two prime scales. A robust median aggregator smooths the slopes, producing a clean, stable directional vector.
The system anchors this slope to the 41-bar pivot — the median of the first 25 primes — serving as the geometric midpoint of the prime lattice. The resulting yellow line on the chart is not an ordinary regression line; it’s a dynamic prime-slope function, adapting continuously with correlation feedback.
4. Regression-Style Parallel Bands
Around this prime-slope line, the indicator constructs parallel bands using standard deviation envelopes — conceptually similar to a regression channel but recalculated through the prime–Pearson matrix.
These bands adjust dynamically to:
- Volatility, via standard deviation of residuals.
- Correlation strength, via avgR sign weighting.
Together, they visualize statistical deviation geometry, making it easier to observe symmetry, expansion, and contraction phases of price structure.
5. Volume and Cumulative Delta Peaks
Below the geometric layer, the indicator incorporates a custom lower-timeframe volume feed — by default using 15-second data (custom_tf_input_volume = “15S”). This allows precise delta computation between up-volume and down-volume even on higher timeframe charts.
From this feed, the indicator accumulates delta over a configurable period (default: 100 bars). When cumulative delta reaches a local maximum or minimum, peak and trough markers appear, showing the precise bar where buying or selling pressure statistically peaked.
This combination of geometry and order flow reveals the intersection of market structure and energy — where liquidity pressure expresses itself through mathematical form.
6. Chart Interpretation
The primary chart view represents the live execution of the indicator. It displays the relationship between structural correlation and volume behavior in real time.
Orange “R+” and blue “R−” labels indicate regions of strong positive or negative Pearson correlation across the prime matrix. The yellow median prime-slope line serves as the structural backbone of the indicator, while green and red parallel bands act as dynamic regression boundaries derived from the underlying correlation strength. Peaks and troughs in cumulative delta — displayed as numerical annotations — mark statistically significant shifts in buying and selling pressure.
The secondary visualization (Prime Regression Concept) expands on this by illustrating how regression behavior evolves across prime intervals. Each colored regression fan corresponds to a prime number window (2, 3, 5, 7, …, 97), demonstrating how multiple regression lines would appear if drawn independently. The indicator integrates these into one unified geometric model — eliminating the need to plot tens of regression lines manually. It’s a conceptual tool to help visualize the internal logic: the synthesis of many small-scale regressions into a single coherent structure.
7. Interpretive Insight
This model is not a prediction tool; it’s an instrument of mathematical observation. By translating price dynamics into a prime-structured correlation space, it reveals how coherence unfolds through time — not as a forecast, but as a measurable evolution of structure.
It unifies three analytical domains:
- Prime distribution — defines a nonlinear temporal architecture.
- Pearson correlation — quantifies statistical cohesion.
- Cumulative delta — expresses behavioral imbalance in order flow.
The synthesis creates a geometric analysis of liquidity and time — where structure meets energy, and where the invisible rhythm of market flow becomes measurable.
8. Contribution & Feedback
Share your observations in the comments:
- The time gap and alternation between R+ and R− clusters.
- How different timeframes change delta sensitivity or reveal compression/expansion.
- Prime intervals/clusters that tend to sit near turning points or liquidity shifts.
- How avgR behaves across assets or regimes (trending, ranging, high-vol).
- Notable interactions with the parallel bands (touches, breaks, mean-revert).
Your field notes help others read the model more effectively and compare contexts.
Summary
- Primes define the structure.
- Pearson quantifies coherence.
- Slope median stabilizes geometry.
- Regression bands visualize deviation.
- Cumulative delta locates imbalance.
Together, they construct a framework where mathematics meets market behavior.
Phát hành các Ghi chú
A subtle optimization in historical data handling has resolved the “historical offset limit” issue that could occur in specific CumDelta scenarios.The indicator now runs flawlessly across all timeframes — smoother and more stable performance overall.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.