OPEN-SOURCE SCRIPT
Updated

Auto Pattern Detector Targets [MarkitTick]

64 489
💡 Operates as an advanced geometric mapping engine designed to automatically identify structural equilibrium states and dynamically project precise L-Pool extraction targets. This tool systematically scans raw time-series data to detect complex, multi-node fractal formations, mathematically verifying their symmetry and proportional validity before a kinetic breach occurs. By unifying dimensional pattern recognition with a strict quantitative filtration system, it provides traders with an objective, continuous visual feed of active market structures, fully calculated risk voids, and mathematically derived extraction zones.
snapshot
● ✨ Originality and Utility
Standard geometrical analysis often falls victim to subjective interpretation and manual drawing errors, rendering statistical backtesting and real-time execution highly inconsistent. This system revolutionizes the approach by abstracting classical chart formations into an Algorithmic Liquidity Matrix. Instead of relying on approximate trendlines, it employs precise Void Node anchoring, measuring the exact percentage tolerances between swing vectors. The utility of this engine lies in its ability to actively discard false-positive structures by running them through a multi-layered verification process that accounts for standard deviation thresholds, volume kinetic spikes, and net-friction Risk:Reward parameters. It does not merely draw shapes; it engineers a complete, actionable mathematical hypothesis for every identified structure, complete with slippage and commission discounting.
snapshot
● 🔬 Methodology and Concepts

• Algorithmic Void Node Collection
The core detection protocol does not use standard zigzag logic. Instead, it deploys an abstracted lookback and look-forward matrix to isolate Void Anchors. These anchors are stored in persistent memory arrays, allowing the engine to compare historical coordinate points against current price action to find symmetrical congruence.
snapshot
• Geometric Void Projection
Once the requisite Void Anchors are collected, the system attempts to fit them into predefined topological models (such as bilateral compressions, horizontal equilibria, or multi-crest voids). It calculates the median delta between these anchors. If the variance falls within the user-defined Symmetry Tolerance, the structure is flagged as a "pending" sequence.

• Kinetic Breach Validation
A structure is only formalized when a Kinetic Breach is confirmed. This requires the price action to cleanly sever the boundary vector of the established Void. To prevent mapping noise, this breach can be strictly gated by checking if the moving average of volume has spiked by a specific multiplier, and if the breach distance exceeds an ATR-derived boundary.

• Friction-Adjusted R:R Filtration
To ensure that only mathematically viable structures are presented, the engine calculates the distance from the entry coordinate to the L-Pool Extraction target and the Risk Void. It then subtracts predefined slippage ticks and bidirectional percentage commissions from the gross reward. If this normalized Risk:Reward ratio falls below the minimum threshold, the sequence is silently invalidated and purged from the display.
snapshot
● 🎨 Visual Guide

• Sliced Geometric Fills
  • Shaded Polygons: When a structure is detected, the area between the upper and lower boundary vectors is filled with a translucent color, mapping the precise domain of the Void.
  • Bullish Fills: By default, structures projecting an upward L-Pool extraction are shaded with a specific bullish tone.
  • Bearish Fills: Structures projecting a downward extraction are shaded with a specific bearish tone.


• Projection Vectors
  • Entry Line (Yellowish): A dashed boundary indicating the exact price coordinate where the Kinetic Breach was validated.
  • Target Line (Greenish): A dashed boundary indicating the projected L-Pool extraction zone, calculated via measuring the maximum depth of the active Void.
  • Stop Line (Reddish): A dashed boundary denoting the Risk Void, typically placed beyond the opposite structural boundary or calculated as a percentage of the target distance.


• The Analytics Dashboard
  • Pattern Bias: Displays the active geometric trajectory (Bullish or Bearish).
  • Active Pattern: Outputs the specific topological classification of the current Void sequence.
  • Vol Spike: A visual bar meter and percentage evaluating the current volume kinetics relative to the moving average, indicating the strength of the breach.
  • R:R Quality: A dynamic gauge rating the mathematical viability of the projection after accounting for all execution friction.
  • Pivot Depth: Evaluates the density of the collected Void Anchors feeding the current Algorithmic Liquidity Matrix.

snapshot
● 📖 How to Use

• Sequence Identification
Allow the engine to operate without manual interference. When a new geometric Void is filled on the chart, visually inspect the projection vectors. The system has already filtered this sequence through the active tolerance parameters.

• Validating the Kinetic Breach
Do not front-run the Entry Line. The structure is mathematically confirmed only when the designated bar closes beyond the boundary (if strict closing is enabled) or pierces it with sufficient ATR momentum.

• Dashboard Confluence
Before executing any logic based on the mapped projection, consult the Analytics Dashboard. A high-quality sequence should ideally present a high Vol Spike percentage, confirming that the Kinetic Breach is supported by active market participation. Furthermore, ensure the R:R Quality gauge reflects a favorable asymmetry for your specific risk parameters.

• Extraction and Risk Management
The Target Line and Stop Line represent strict invalidation and extraction coordinates. If the price returns and breaches the Stop Line, the topological premise of the Void is mathematically nullified.

● ⚙️ Inputs and Settings

• General Tolerances
  • Symmetry Tolerance (%): The maximum allowed variance between Void Anchors to still be considered part of a uniform structure.
  • Level Tolerance (%): The strictness applied to horizontal alignment for flat-boundary formations.
  • Min Pattern Size: Gates out micro-structures by requiring the Void depth to exceed a specific ATR multiplier or raw price percentage.


• Structural Toggles
  • Allows the user to independently activate or disable the detection of specific topologies (e.g., bilateral compressions vs. horizontal channels).


• Void Anchor Parameters
  • Lookback Left/Right: The strict bar-count threshold used by the algorithm to confirm an isolated Void Anchor.
  • Max Pivots to Remember: Controls the depth of the historical array memory, optimizing engine performance.


• Filtration & Execution Costs
  • Require Candle Close/Body Breakout: Enforces strict logic where only the close or full body of the bar can trigger a Kinetic Breach.
  • Volume Spike Multiplier: The threshold of volume required relative to the SMA to validate the breach.
  • Min Risk:Reward Ratio: The baseline mathematical threshold for a valid setup.
  • Slippage (Ticks) & Commission (%): The raw friction metrics applied dynamically to the R:R calculation to ensure realistic projections.


● 🔍 Deconstruction of the Underlying Scientific and Academic Framework

The foundation of this system rests on the hypothesis of structural equilibrium within financial time-series data. Markets continuously cycle between phases of linear displacement and volumetric consolidation. During consolidation, price action forms distinct geometric boundaries driven by the algorithmic rebalancing of supply and demand. By quantifying these boundaries, we can treat the chart not as a random walk, but as a topological map of active liquidity matrices.

The engine utilizes an advanced array-based memory structure to index local extrema (Void Anchors). To prevent the algorithm from fitting noise into false geometries, it applies strict variance thresholds. This is scientifically akin to minimizing the residual sum of squares in regression models; if the coordinate points of the extrema deviate beyond the acceptable Z-Score-inspired boundaries of symmetry, the hypothesis of a coherent structure is rejected.

Upon the occurrence of a Kinetic Breach, the system applies standard deviation modifiers (Average True Range) to validate the momentum. A breach is only considered statistically significant if it occurs outside the normal distribution of localized volatility, essentially confirming a transition from equilibrium back into linear displacement. The volume moving average acts as a secondary confirmation factor, ensuring that the kinetic expansion is supported by a statistically anomalous influx of standard normal distribution participation.

Finally, the target projection relies on the concept of measured topological depth. The maximum amplitude of the consolidated Void is mathematically transposed to the point of the Kinetic Breach. This reflects the theory of energy conservation in market dynamics: the kinetic energy released during a breakout is roughly proportional to the potential energy stored during the preceding consolidation. By actively integrating execution friction (slippage and commission) into the final coordinate calculations, the engine shifts from purely theoretical geometry to applied quantitative modeling, providing a highly realistic framework for continuous market analysis.

⚠️ 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.
Release Notes
This update introduces a robust history tracking system and improves the rendering lifecycle for the detected price action patterns. These architectural changes ensure simultaneous multi-pattern management and enhanced visual clarity.

● Updates
  • Implementation of Persistent History Management
    snapshot
    The script has transitioned from a simple, single-pattern state to a comprehensive history tracking system. This new structure stores patterns and their associated drawings, allowing the indicator to manage multiple pattern instances simultaneously.
  • Enhanced Drawing Lifecycle
    snapshot
    The drawing management system was redesigned to systematically clear older data based on a defined limit. By iterating through the history storage, the script minimizes visual clutter while maintaining specific line and label instances for each pattern.
  • Optimized Breakout Detection
    snapshot
    The logic for identifying breakout points was improved by reversing the scanning direction. This adjustment enhances the script's efficiency when validating potential breakouts against historical data.
  • Improved User Interface Clarity
    snapshot
    Visual labels for entries, stops, and targets now include the specific name of the detected pattern. This provides better context when multiple patterns are displayed concurrently.
  • Decoupled Drawing Association
    The pattern detection and rendering functions were modified to link drawings directly to their parent pattern data. This architectural change ensures that visual elements are accurately tied to their respective detection results, preventing data contamination between different patterns.

📌 You can control the maximum number of patterns displayed on your chart via the user settings.

● Detected Patterns
  • Double Top: A bearish reversal pattern consisting of two consecutive peaks at nearly the same price level, signaling a potential trend exhaustion.
  • Double Bottom: A bullish reversal pattern featuring two consecutive troughs at similar levels, indicating a potential shift from selling to buying pressure.
  • Triple Top: A bearish reversal formation marked by three distinct peaks at a similar resistance level, reflecting repeated failures to break higher.
  • Triple Bottom: A bullish reversal pattern characterized by three consecutive lows at a similar support level, suggesting strong accumulation.
  • Head and Shoulders: A classic bearish reversal pattern featuring a higher central peak flanked by two lower peaks, representing a loss of upward momentum.
  • Inverted Head and Shoulders: A bullish reversal pattern consisting of a lower central trough surrounded by two higher troughs, indicating a shift toward an uptrend.
  • Bullish Flag: A short-term continuation pattern formed by a sharp price rise followed by a narrow, downward-sloping consolidation.
  • Bearish Flag: A continuation pattern occurring during a downtrend, where a sharp decline is followed by a narrow, upward-sloping consolidation.
  • Bullish Pennant: A continuation pattern defined by a sharp rise followed by a symmetrical, converging triangle consolidation.
  • Bearish Pennant: A continuation pattern featuring a sharp decline followed by a converging triangle formation before continuing the drop.
  • Rising Wedge: A reversal or continuation pattern where price consolidates between upward-sloping, converging trendlines, typically signaling potential weakness.
  • Falling Wedge: A pattern formed by downward-sloping, converging trendlines, often serving as a precursor to a bullish breakout.
  • Triangle: A consolidation phase where price narrows between converging trendlines, indicating an imminent breakout (Ascending, Descending, or Symmetrical).
  • Rectangle: A trading range where price moves horizontally between parallel support and resistance levels, indicating indecision before a breakout.
  • Cup and Handle: A bullish continuation pattern resembling a cup followed by a minor price dip, indicating potential for a new upward move.
  • Inverted Cup and Handle: A bearish continuation pattern formed by an upside-down cup and a handle, signaling downward pressure.
Release Notes
● Alert Integration
  • Introduced a new JSON-formatted alert system.
  • Triggered upon pattern confirmation.
  • Includes ticker, pattern name, bias, and trade levels for comprehensive automated notifications.
  • Optimized alert triggers to utilize barstate.isconfirmed to ensure signal reliability and prevent premature execution.


● Risk & Volatility Modules
  • Dynamic R:R Multiplier: User-configurable input to calibrate risk-to-reward parameters.
  • Normalized ATR Display: Provides a consistent view of volatility regardless of market fluctuations.
  • Table Tracking: Dedicated dashboard tracking for real-time volatility and R:R quality scoring.


● Enhanced UI/UX
  • Custom Label Scaling: Options for Small, Normal, and Large chart labels.
  • Allows for superior visibility control across diverse screen resolutions and chart settings.


● Dashboard Enhancements
  • Updated dashboard calculations to include dynamic visual bars.
  • Monitors Volatility, R:R, and Pivot depth.
  • Features conditional color-coding based on proprietary scoring logic for immediate visual assessment.
Release Notes
Alerts issue resolved.
Release Notes
Optimized alert

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.