OPEN-SOURCE SCRIPT
מעודכן

Auto Chart Patterns

8 236
Auto Chart Patterns automatically scans the chart for major technical patterns and marks them directly on price action. It detects:
• Head & Shoulders (bearish reversal)
• Inverse Head & Shoulders (bullish reversal)
• Rising and Falling Wedges
• Double / Triple Tops and Bottoms
• Cup & Handle (bullish continuation)

For each pattern, the script draws the structure (trendlines / neckline), shades the pattern zone, and places a label with the pattern name.

It also generates optional trade signals:
• “BUY” when a bullish pattern breaks out with confirmation
• “SELL” when a bearish pattern breaks down with confirmation

Confirmations can include:
• Follow-through candle in the breakout direction
• Volume spike vs recent average
• RSI momentum agreement

Inputs let you control:
• Pivot sensitivity (left/right bars)
• Pattern types to display
• Cup & Handle depth rules
• Confirmation rules for entry/exit signals

This tool is designed to help you visually spot reversal and continuation setups, highlight potential breakout levels (necklines / wedge boundaries), and time trades with clearer confirmation instead of guessing.

Disclaimer: This script is for educational/technical analysis purposes only. It does not guarantee future performance, does not execute trades, and is not financial advice. Always confirm signals with your own analysis and risk management before entering any position.
הערות שחרור
Auto Chart Patterns automatically scans the chart for major technical patterns and draws them directly on price action. It detects:

• Head & Shoulders (bearish reversal)
• Inverse Head & Shoulders (bullish reversal)
• Rising and Falling Wedges
• Double / Triple Tops and Bottoms
• Cup & Handle (bullish continuation)
• Ascending / Descending / Symmetrical Triangles
• Bull Flags, Bear Flags, and Pennants

For each detected structure, the script will:
• Draw the pattern boundaries (trendlines, neckline, channel, triangle, etc.)
• Shade the pattern zone to make it easy to see visually
• Place a clean text label on the chart with the pattern name

In addition to pattern marking, the script can optionally generate trade signals:
• “BUY” when a bullish setup confirms (for example: inverse H&S, double bottom, falling wedge, ascending triangle, bull flag) and price breaks above the key breakout level
• “SELL” when a bearish setup confirms (for example: H&S top, double top, rising wedge, descending triangle, bear flag) and price breaks below the key breakdown level

Confirmation logic is rules-based and configurable. A signal is only shown if the breakout/breakdown is “real enough” according to the filters you choose. You can require:
• Follow-through candle in the expected direction
• Volume spike vs recent average volume
• RSI momentum agreement (RSI turning up for bullish breakouts, down for bearish breakdowns)

Inputs let you control:
• Pivot sensitivity (left/right bar strength for swing highs and lows)
• Which pattern classes to show (Head & Shoulders, Wedges, Triangles/Flags, Cup & Handle, etc.)
• Cup & Handle depth / handle tolerance
• How triangle / wedge / flag zones are recognized
• Confirmation rules for plotting BUY / SELL labels

How to use it:

1. Visual scanning
The script highlights reversal patterns like Head & Shoulders, Double Top, and Rising Wedge, as well as continuation patterns like Bull Flag, Ascending Triangle, and Cup & Handle. You get immediate context of where momentum is exhausting or building.

2. Breakout / breakdown levels
Each pattern internally defines a “trigger level” (neckline, wedge boundary, triangle flat edge, flag channel break, etc.). This level is tracked as bullLevel (for bullish bias) or bearLevel (for bearish bias). The script waits for price to cross that level with confirmation.

3. Trade intent labels
When conditions align, the script plots “BUY” below the bar (bullish confirmation) or “SELL” above the bar (bearish confirmation). Think of these not as automatic entries, but as “the setup you’ve been watching just triggered.”

Important notes:
• Signals are NOT repaints of future data, but any pattern recognition can look clearer in hindsight. Always inspect live behavior.
• Thin / illiquid symbols and very low timeframes may generate noisy or unreliable structures.
• Not every wedge / triangle / flag leads to continuation — false breakouts are real.

Disclaimer:
This script is for educational and technical analysis purposes only. It does not guarantee future performance, does not execute trades, and is not financial advice. Markets are risky, and pattern-based trading can fail. Always confirm any signal with your own analysis, higher timeframe context, and proper risk management before entering or exiting a position.

Developed by Mohammed Bedaiwi
הערות שחרור
Auto Chart Patterns 2 — Span Restricted
Upgraded, span-aware version of “Auto Chart Patterns” by mbedaiwi2

What this script does
It scans the chart in real time for the most important classical chart patterns, marks their start on the chart, and arms “pending” BUY/SELL levels that are confirmed only when price action and context agree.

Detected patterns:
  • Head & Shoulders (bearish top) — H&S Top
  • Inverse Head & Shoulders (bullish bottom) — Inv. H&S
  • Rising / Falling Wedges — RW / FW
  • Double / Triple Tops & Bottoms — DT / TT
  • Cup & Handle (bullish continuation)
  • Triangles / Pennants / Flags:
    Ascending, Descending, Symmetrical Triangle / Pennant, Bull Flag, Bear Flag


What’s new vs the original “Auto Chart Patterns”
  • Span-restricted patterns
    Each pattern family has explicit min/max bar spans:
    Cup & Handle: CUP_MIN / CUP_MAXSymmetrical Triangle / Pennant: SYM_MIN / SYM_MAXBull/Bear Flags: FLAG_MIN / FLAG_MAXAscending/Descending Triangles: TRI_MIN / TRI_MAX
    This keeps the script focused on the structural swings you care about and avoids ultra-short “noise” patterns.

  • Multi-Top / Multi-Bottom quality filtersShoulder/peak similarity tolerance
    Required pullback depth (swingDepthTol)
    Min gap between pivots + min/max total span for Double/Triple patterns
    Optional reversal candle check at peaks/troughs
    Optional requirement for neckline break before drawing (clean patterns only)
  • Cleaner chartsOption to hide shaded boxes for multi-tops/bottoms (cleanMode)
    Min bar spacing between pattern labels
    Limit of max pattern labels per bar
    Per-bar stacking logic to avoid label overlap
    Vertical line + small label at the start of each pattern (drawPatternStart)
  • TASI-safe confirmation engineScript auto-detects TADAWUL:TASI and similar tickers
    Indices often have poor/no volume data → volume filter is automatically relaxed
    Optional relax of follow-through / RSI / volume filters on TASI and other indices
  • Context-aware confirmations
    For each armed level, the script can require:
    Follow-through candle (FT): close breaks the pattern level and continues in the same direction
    Volume spike (VS): volume > 20-bar average × multiplier
    RSI momentum (RSI): RSI moving in the same direction as the breakout

    All three filters can be turned on/off from inputs.

  • Single-bar BUY/SELL signalsA pattern sets pendingBull or pendingBear and a reference level
    When all active filters are satisfied → one-time bullSignal or bearSignalScript prints “BUY”/“SELL” labels plus compact LE/SE/LX/SX markers
    Pending state is reset right after the signal so you don’t get repeated alerts
  • Ready-to-use alerts & strategy hooks
    • Alert conditions for:
      Long Entry, Short Entry, Long Exit, Short Exit
    • Boolean series exposed in code:
      longEntry, shortEntry, longExit, shortExit
      — can be reused in a separate strategy for full backtesting.


Key Inputs (Summary)
  • Pivot Left/Right Strength – controls swing sensitivity (pivots for all patterns).
  • shoulderTol – how similar peaks/lows must be (H&S, DT/TT, Cup rims, etc.).
  • swingDepthTol – minimum pullback depth required for multi-tops/bottoms.
  • cupDepthMinPct / cupDepthMaxPct – min/max depth of the Cup.
  • handleDepthPct – max size of the Handle relative to cup depth.
  • lookbackCupBars – scanning window for Cup & Handle.
  • CUP_MIN / CUP_MAX – min/max bar span for Cup & Handle.
  • SYM_MIN / SYM_MAX – min/max span for Symmetrical Triangle / Pennant.
  • FLAG_MIN / FLAG_MAX – min/max span for Bull/Bear Flags.
  • TRI_MIN / TRI_MAX – min/max span for Ascending/Descending Triangles.
  • confirmNeckBreak – require neckline break before drawing DT/TT patterns.
  • cleanMode – hide shaded boxes for multi-tops/bottoms, keep chart minimal.
  • useFollowThrough / useVolumeSpike / useRSIMomentum – enable/disable confirmation filters.
  • relaxIndexFilters – automatically relax filters for TASI and other indices.


Abbreviation Guide
  • H&S – Head & Shoulders
  • DT – Double Top / Double Bottom
  • TT – Triple Top / Triple Bottom
  • RW / FW – Rising Wedge / Falling Wedge
  • FT – Follow-Through candle
  • VS – Volume Spike vs 20-bar average
  • LE / SE – Long Entry / Short Entry
  • LX / SX – Long Exit / Short Exit


How to use
  • Apply the indicator to your chart.
  • Choose which pattern families you want to track (H&S, Wedges, Cup, Triangles/Flags, DT/TT).
  • Adjust span limits so patterns match your trading style (intraday vs swing).
  • Tune confirmation filters (FT / VS / RSI) and the TASI relax option.
  • Create alerts from:
    Long Entry Signal, Short Entry Signal, Long Exit Signal, Short Exit Signal
    and route them to pop-ups, e-mail, mobile, or webhook.


Disclaimer
This script is a technical tool, not financial advice. No pattern or signal is guaranteed. Always use your own judgment, risk management, and protective stops. Past performance of any pattern does not guarantee future results.
```

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.