Regression-Aligned Candlestick Architect [MarkitTick]💡 The Regression-Aligned Candlestick Architect is an advanced, institutional-grade technical analysis instrument engineered to seamlessly fuse structural market context with precise, deterministic candlestick morphology. Rather than presenting isolated, noisy signals, this indicator operates as a holistic market mapping system. It dynamically identifies changes in market character (CHoCH), anchors statistical regression channels to these pivotal structural nodes, and overlays a rigorously filtered, strength-tiered candlestick pattern recognition engine. This tool empowers analysts to visualize the exact mathematical relationship between micro-level price action anomalies and macro-level statistical deviations.
● ✨ Originality and Utility
Standard candlestick recognition tools often suffer from a fatal flaw: signal noise. By identifying every single pattern across the chart regardless of context, they overwhelm the analyst with false positives. This indicator revolutionizes pattern detection by introducing a multi-dimensional filtering matrix.
Contextual Awareness: Patterns are cross-referenced against a dynamic Simple Moving Average (SMA) baseline, ensuring that continuation patterns are only validated when aligned with the prevailing macroeconomic trend.
Hierarchical Strength Matrix: Patterns are not treated equally. They are mathematically scored and classified into five distinct strength tiers, from baseline indecision to highly reliable structural anomalies.
Anchored Statistical Modeling: Instead of static support and resistance lines, this tool maps volatility using an anchored Linear Regression Channel (LRC) that resets automatically upon validated structural breaks (CHoCH), providing an evolving map of fair value and extreme deviation.
Institutional Automation Ready: Built-in webhook templates format high-conviction signals directly into actionable JSON payloads, bridging the gap between discretionary charting and algorithmic execution.
● 🔬 Methodology and Concepts
The architecture of this script relies on a confluence of three primary mathematical and logical engines.
• Quantitative Pattern Recognition
The core engine deconstructs each individual candlestick into absolute mathematical variables: body size, total high-low range, upper shadow ratio, and lower shadow ratio. By applying rigid algorithmic tolerance thresholds (e.g., Dojis strictly requiring a body-to-range ratio of less than 5%), the script actively eliminates subjective interpretation.
• The Strength Stratification System
The indicator systematically grades market geometry into five actionable categories:
Strength 1 (Indecision): Identifies market equilibrium phases and compression (e.g., Doji, Spinning Tops).
Strength 2 (Weak Signals): Early signs of exhaustion that require further context (e.g., Hanging Man, Inverted Hammer).
Strength 3 (Moderate Confirmations): Standard two-candle reversal structures (e.g., Harami, Piercing Line, Dark Cloud Cover).
Strength 4 (Strong Confirmations): High-conviction multi-candle configurations (e.g., Engulfing setups, Morning/Evening Stars, Marubozu).
Strength 5 (Extreme Conviction): Rare, highly reliable setups signaling massive structural imbalances (e.g., Three White Soldiers, Breakaway Gaps).
• Structural CHoCH and LRC Anchoring
The script continuously scans for localized Pivot Highs and Pivot Lows using customizable look-left and look-right parameters. When the price closes beyond the most recent opposing pivot node, a Change of Character (CHoCH) is registered. This event immediately triggers the recalculation of the Linear Regression Channel, anchoring the starting point to the critical pivot and projecting statistical deviation bands forward to track the new trend's trajectory.
● 🎨 Visual Guide
The interface is meticulously designed with a 3D holographic aesthetic to ensure clarity without cluttering the primary price action.
• Candlestick Labels and Holographic Colors
Indigo Glass (Strength 1): Muted, translucent tones denoting indecision and market pauses without demanding immediate attention.
Cyber Blue & Violet (Strength 2 & 3): Intermediate colors highlighting developing reversals or moderate continuation patterns.
Neon Mint (Bullish Strength 4-5): Bright, high-contrast markers indicating strong bullish dominance (e.g., BE+, 3WS), plotted below the bar.
Hot Pink (Bearish Strength 4-5): Intense, high-visibility markers warning of severe bearish pressure (e.g., BE-, 3BC), plotted above the bar.
Cyber Gold (Special/Exhaustion): Reserved strictly for profound trend exhaustion signatures, such as the Three Line Strike configuration.
To learn more about Candlestick patterns, access the following link:
Quantitative Analysis of Algorithmic Candlestick Pattern
• Linear Regression Channel Bands
Active LRC: Displays a Neon Cyan midline representing the mean regression. Soft Cyan and Deep Azure dashed and dotted lines represent the first and second standard deviation bands respectively, filled with translucent gradient shading to represent volatility zones.
Historical LRC: Previous channels are preserved in deep Magenta and Blue-Violet hues. This allows the analyst to review past structural behavior, momentum shifts, and how price transitioned between volatility states.
● 📖 How to Use
This indicator is optimized for confluence trading. Discretionary traders should look for optimal alignment between the LRC boundaries and high-tier candlestick patterns.
Define the Structural Boundary: Observe the active Neon Cyan LRC. Determine if the current micro-trend is contained safely within the inner standard deviation bands or if it is stretching into extreme statistical anomaly (touching or piercing Band 2).
Wait for Signal Convergence: A standalone pattern is interesting, but confluence is key. A Strength 4 (Neon Mint) Bullish Engulfing pattern occurring exactly at the lower boundary (Band 2) of an ascending LRC presents an exceptionally high-probability mean-reversion or trend-continuation setup.
Automate Execution: Utilize the built-in alert system to capture the exact entry price alongside dynamically calculated ATR-based Stop Loss and Take Profit levels when a tier 4 or 5 pattern confirms.
Adapt to Trend Shifts: If a CHoCH occurs, the channel will instantly snap to the new trajectory. Immediately shift your directional bias and await new pattern formations that align with the updated regression mean.
● ⚙️ Inputs and Settings
The indicator provides granular control over internal parameters, allowing adaptation to varying asset classes and timeframes.
• General & Strength Filters
Max Patterns to Display: Limits historical label rendering to keep the chart performant and visually clean.
Show Only Trend-Appropriate Patterns: A critical toggle that forces the engine to ignore counter-trend signals by filtering outputs through the internal SMA logic.
Strength Toggles (S1 - S5): Allows the user to independently enable or disable specific tiers. Professional traders often disable tiers 1-3 to focus exclusively on high-probability tier 4 and 5 formations.
• Current Anchored CHoCH LRC
Pivot Left/Right Bars: Dictates the sensitivity of the Change of Character detection. Higher numbers require major macro swings to shift the channel, while lower numbers tightly track micro-structure fluctuations.
Band Multipliers (1 & 2): Adjusts the mathematical standard deviation widths of the regression channel. Defaulted to standard 1.0 and 2.0 deviations.
• Webhook Execution Configuration
Action Strings: Define custom text identifiers (e.g., 'long', 'closeshort') that will be injected into the automated JSON payload when high-strength signals or CHoCH events trigger on a confirmed bar close.
● 🔍 Deconstruction of the Underlying Scientific and Academic Framework
The analytical depth of this script is heavily grounded in established statistical mathematics and heuristic geometric modeling.
• Statistical Modeling via Ordinary Least Squares (OLS)
The dynamic Linear Regression Channel is derived using the Ordinary Least Squares method. The script iteratively loops through the dynamically anchored period (from the algorithmic CHoCH trigger to the current bar index) to calculate the line of best fit. It computes the summation of price coordinates, calculating the slope and y-intercept to minimize the sum of the squared residuals.
Furthermore, the indicator calculates the population standard deviation of these residuals (errors) to project the outer variance bands. In a normally distributed financial dataset, approximately 68% of price action should remain within Band 1, and 95% within Band 2. When price forcefully breaches Band 2, it statistically indicates an unsustainable momentum extreme, shifting the probability matrix heavily toward imminent mean-reversion.
• Quantitative Candlestick Heuristics
Traditional Japanese Candlestick theory relies heavily on qualitative visual assessment. This indicator transforms it into a rigorous quantitative science. By expressing wicks, shadows, and true bodies as strict fractional ratios of the total period variance, the algorithm entirely removes psychological bias. For instance, an Engulfing pattern is not merely determined by a visual overlap; the internal logic mathematically validates that the current open and close parameters completely eclipse the previous period's boundaries, while simultaneously verifying that the absolute body size explicitly exceeds the prior via comparative array lookbacks. Furthermore, advanced configurations like the 'Three Line Strike' necessitate the sequential tracking of four independent vector arrays to confirm precise exhaustion geometry and statistical anomaly.
⚠️ Disclaimer
All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. I expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion.
อินดิเคเตอร์ Pine Script®
















