OPEN-SOURCE SCRIPT
Pattern Analog Projection

Pattern Analog Projection
OVERVIEW
This tool searches historical price action for the sequences that most closely
resemble the current market structure, then projects what typically followed
those analogous sequences. It is a context and probability tool, not a buy/sell
signal generator.
HOW IT WORKS
- Shape matching: the last N bars are compared against historical windows using
Pearson correlation, which is invariant to price level and scale. This compares
pattern geometry rather than absolute prices.
- Volatility gating: candidates whose relative-volatility profile differs too much
from the current window are rejected, so analogs share a similar character.
- Top analogs: the best non-overlapping matches are ranked and stored (up to 5).
- Forecast cone: the future paths that followed each analog are aggregated. The
dashed center line is the average projection; the shaded envelope spans the most
bullish and most bearish analog outcomes.
- Probability: the share of analogs that finished bullish, bearish, or neutral
over the projection horizon.
- Confidence: a 0-100 score (graded A+ to C) combining match quality, directional
agreement, and outcome consistency.
- Market regime: the current structure is classified (Strong Trend, Trending,
Range, Compression, Volatile Expansion) using an efficiency ratio and ATR.
INPUTS
- Pattern Length, Projection Length, Search Depth, Search Step
- Number of Analogs, Min Correlation Filter, Forecast Mode (Average / Best / Median)
- Volatility Matching and tolerance, Neutral Band
- Toggles for cone, historical analogs, similarity heatmap, dashboard
- Dashboard position and colors
HOW TO USE
1. Add to any symbol and timeframe; load plenty of history for better matches.
2. Read the Confidence grade first. Treat low-confidence forecasts with caution.
3. Use the cone as a likely-path context, combined with your own trade plan and
risk management - not as a standalone entry trigger.
4. The highlighted region shows the closest historical analog for reference.
NOTES
- The projection re-derives as each new bar closes. It draws forward only and does
not repaint historical bars; there are no historical signals to restate.
- Heavy calculation runs on the last bar. If you see a loop-timeout, lower Search
Depth or raise Search Step.
- Past structural resemblance does not guarantee future outcomes. This script is
for research and education only and is not financial advice.
OVERVIEW
This tool searches historical price action for the sequences that most closely
resemble the current market structure, then projects what typically followed
those analogous sequences. It is a context and probability tool, not a buy/sell
signal generator.
HOW IT WORKS
- Shape matching: the last N bars are compared against historical windows using
Pearson correlation, which is invariant to price level and scale. This compares
pattern geometry rather than absolute prices.
- Volatility gating: candidates whose relative-volatility profile differs too much
from the current window are rejected, so analogs share a similar character.
- Top analogs: the best non-overlapping matches are ranked and stored (up to 5).
- Forecast cone: the future paths that followed each analog are aggregated. The
dashed center line is the average projection; the shaded envelope spans the most
bullish and most bearish analog outcomes.
- Probability: the share of analogs that finished bullish, bearish, or neutral
over the projection horizon.
- Confidence: a 0-100 score (graded A+ to C) combining match quality, directional
agreement, and outcome consistency.
- Market regime: the current structure is classified (Strong Trend, Trending,
Range, Compression, Volatile Expansion) using an efficiency ratio and ATR.
INPUTS
- Pattern Length, Projection Length, Search Depth, Search Step
- Number of Analogs, Min Correlation Filter, Forecast Mode (Average / Best / Median)
- Volatility Matching and tolerance, Neutral Band
- Toggles for cone, historical analogs, similarity heatmap, dashboard
- Dashboard position and colors
HOW TO USE
1. Add to any symbol and timeframe; load plenty of history for better matches.
2. Read the Confidence grade first. Treat low-confidence forecasts with caution.
3. Use the cone as a likely-path context, combined with your own trade plan and
risk management - not as a standalone entry trigger.
4. The highlighted region shows the closest historical analog for reference.
NOTES
- The projection re-derives as each new bar closes. It draws forward only and does
not repaint historical bars; there are no historical signals to restate.
- Heavy calculation runs on the last bar. If you see a loop-timeout, lower Search
Depth or raise Search Step.
- Past structural resemblance does not guarantee future outcomes. This script is
for research and education only and is not financial advice.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.