Pattern 123 Finder
- Indicateurs
- Version: 2.2
- Activations: 5
ABC Breakout Pattern Finder (1-2-3 Pattern Algo) for MetaTrader 5
ABC Breakout Pattern Finder is a professional algorithmic trading indicator designed for MetaTrader 5 (converted from Pine Script v6). It automatically detects, validates, and visualizes classic 1-2-3 (A-B-C) Price Action patterns in real time, projecting dynamic entry levels, stop-loss orders, and multi-tier Fibonacci/ATR profit targets directly onto the chart.
Key Features
- Strict Structural Pattern Validation: Filters out false market noise using dynamic Zigzag pivot detection ($PivotBarsLeft / Right$) and strict retracement ratios ($BC/AB$ ratio validation between 0.50 and 0.80 by default).
- Volatility (ATR) Impulse Filter: Requires the initial $A \to B$ impulse leg to exceed a configurable multiple of the Average True Range (ATR), ensuring that only high-momentum price legs trigger trade signals.
- Dual Execution Modes:
- ATR Mode (Classic Breakout): Enters upon a confirmed breakout candle close beyond Pivot $B$, setting the Stop Loss at Pivot $C$ and projecting targets via Risk-Reward multiples ($R:R$).
- FIB Mode (Early Swing / Fib Extensions): Triggers an entry immediately upon confirmation of Pivot $C$, anchoring the Stop Loss to the extreme of the $C$-bar and calculating profit targets via structural Fibonacci extensions projected from $B$ ($1.000$, $1.272$, $1.618$).
- Pending Setup Invalidation: Automatically cancels an unconfirmed ATR setup if price closes beyond the extreme of Pivot $C$ prior to the breakout, keeping the chart free of obsolete setups.
- Overlap Protection: Prevents redundant or conflicting pattern signals from forming inside the range of previously active setups.
- On-Chart Live Performance Tracker: Built-in statistical display tracking historical win rates for $TP1$, $TP2$, and $TP3$ over a user-defined lookback window using strict bar-priority rules ($SL$ takes precedence on neutral candles).
- Clean Single-Setup Visuals: Dynamically shifts Entry, SL, and TP lines so that only the latest active/selected setup is rendered forward on the chart, avoiding clutter.
- EA-Ready Integration: Exposes 6 indicator buffers ($Buy$, $Sell$, $StopLoss$, $TP1$, $TP2$, $TP3$) for direct calling via iCustom() inside automated Expert Advisors.
Trading Logic & Methodology
1. Pattern Structure
- Bullish 1-2-3 Setup:
- Point $A$: Swing Low
- Point $B$: Higher High (Impulse Move)
- Point $C$: Higher Low (Retracement, must remain strictly above $A$)
- Bearish 1-2-3 Setup:
- Point $A$: Swing High
- Point $B$: Lower Low (Impulse Move)
- Point $C$: Lower High (Retracement, must remain strictly below $A$)
2. Execution Modes Comparison
| Feature | ATR Breakout Mode | Fibonacci Mode |
| Entry Trigger | Candle close beyond Pivot $B$ | Confirmed close of Pivot $C$ bar |
| Entry Level | Pivot $B$ Price | Close of bar $C$ (or Pivot $B$ projection) |
| Stop Loss | Pivot $C$ Price | High/Low of bar $C$ |
| TP Targets | Risk multiples ($0.5R$, $1.0R$, $2.0R$) | Fibonacci expansions ($100\%$, $127.2\%$, $161.8\%$) |
| Invalidation | Candle close beyond Pivot $C$ cancels trade | Immediate activation on $C$ detection |
Input Parameters
Zigzag
- Pivot Bars Left (Default: 13 ): Left lookback period for pivot high/low detection.
- Pivot Bars Right (Default: 5 ): Right lookback period required to confirm a swing point.
Pattern Rules
- Min ABC Ratio (Default: 0.50 ): Minimum allowed $BC$ retracement relative to the $AB$ leg.
- Max ABC Ratio (Default: 0.80 ): Maximum allowed $BC$ retracement relative to the $AB$ leg.
- Min AB Size (ATR Multiple) (Default: 2.0 ): Minimum length of the $AB$ impulse leg expressed as a multiple of ATR.
- ATR Length (Default: 14 ): Period for the underlying ATR volatility gauge.
- Disallow Pattern Overlap (Default: true ): Suppresses new patterns originating inside confirmed historical zones.
- Invalidate Pending On Close Beyond C (Default: true ): Cancels pending ATR breakout setups if price breaches Pivot $C$.
Trade Mode & Targets
- FIB Mode (Default: false ): Enables structural Fibonacci targets; if false , ATR risk-reward mode is active.
- TP1 / TP2 / TP3 Risk Reward Ratio (Default: 0.5 / 1.0 / 2.0 ): Multiples of $BC$ risk used in ATR mode.
- TP1 / TP2 / TP3 Fib Extension (Default: 1.000 / 1.272 / 1.618 ): Fibonacci expansion projections from $B$ in FIB mode.
Visuals & Alerts
- Trade Display Bars Forward (Default: 10 ): Number of bars active levels extend to the right of the price.
- Show Trade Levels / Show ABC Lines / Show ABC Labels : Individual visibility toggles for chart graphics.
- Show AC Line (Default: true ): Draws a clean segment directly between Pivot $A$ and Pivot $C$.
- Show Stats Window (Default: true ): Displays the win/loss statistical table on the chart.
- Alerts (Default: true ): Terminal alerts and mobile push notifications for pattern detection, confirmation, and invalidation.
Indicator Buffers for Expert Advisors (iCustom)
Developers can read all signal and price data directly into an EA using CopyBuffer() :
- Buffer 0 ( BufferBuySignal ): Price value on confirmed Buy signals ( EMPTY_VALUE otherwise).
- Buffer 1 ( BufferSellSignal ): Price value on confirmed Sell signals ( EMPTY_VALUE otherwise).
- Buffer 2 ( BufferStopLoss ): Stop Loss price level for the signal bar.
- Buffer 3 ( BufferTakeProfit1 ): Target 1 price level.
- Buffer 4 ( BufferTakeProfit2 ): Target 2 price level.
- Buffer 5 ( BufferTakeProfit3 ): Target 3 price level.
