OPEN-SOURCE SCRIPT
מעודכן

Smart Candlestick Pattern Filter [MarkitTick]

10 560
💡 This Script is a sophisticated technical analysis tool designed to identify, grade, and display over 40 distinct candlestick formations based on a proprietary strength and context filtering system. Unlike standard pattern finders that often clutter charts with conflicting signals, this script utilizes a hierarchy logic to display only the most significant pattern detected on any given candle, ensuring chart clarity and actionable data.

● Originality and Utility

The primary utility of this script lies in its filtering engine. Standard indicators often flag every minor Doji or Spinning Top, creating noise. This indicator categorizes patterns into five distinct levels of strength, ranging from simple indecision to very strong reversal or continuation signals.

Furthermore, it incorporates a Trend Context filter, which checks the relationship between price and a Simple Moving Average (SMA). This ensures that reversal patterns (like Hammers) are prioritized during downtrends, while continuation patterns are highlighted during established moves, reducing false positives.

● Methodology

The indicator evaluates price action using specific ratios between the Open, High, Low, and Close, alongside the body size relative to the total range. It assigns a strength score to each detected pattern.

• Pattern Strength Grading
  • Strength 1 (Indecision): Includes patterns like Doji, Spinning Tops, Dragonfly, and Gravestone Dojis. These signal a pause in momentum.
  • Strength 2 (Weak): Includes patterns like Hanging Man, Inverted Hammer, Belt Holds, and In-Neck lines. These suggest potential movement but often require confirmation.
  • Strength 3 (Moderate): Includes classic reversals like Hammers, Shooting Stars, Haramis, Dark Cloud Cover, and Piercing Lines.
  • Strength 4 (Strong): Includes major signals like Engulfing patterns, Morning/Evening Stars, and Marubozu candles.
  • Strength 5 (Very Strong): Reserved for rare, high-probability multi-candle formations like Three White Soldiers, Three Black Crows, Rising/Falling Three Methods, and Breakaway gaps.


The script calculates all potential patterns for the current bar and then compares their strength scores. Only the pattern with the highest strength is displayed. If the Show Trend Context option is enabled, the script further validates the pattern against the current market direction (determined by the SMA and slope) before plotting.

● How to Use

Traders can use this tool to identify potential entry and exit points based on the strength of the signal.

• Visual Signals
Patterns are labeled directly on the chart:
  • Green Labels/Text: Indicate Bullish patterns.
  • Red Labels/Text: Indicate Bearish patterns.
  • Gray/White Labels: Indicate Indecision or Weak patterns.

Hovering over any label provides the full name of the pattern and its strength rating (e.g., "Bullish Engulfing - Strength: Strong").

• Trading Logic
  • High Strength Signals (Levels 4-5): These can be used as primary triggers for trend reversals or strong continuations.
  • Moderate Signals (Level 3): Useful for adding confluence to existing analysis or anticipating a setup.
  • Indecision (Level 1): Often useful for taking profits or tightening stop-losses, as they indicate the current trend may be stalling.


● Settings

  • Show Only Strong Patterns: When enabled, filters out Strength 1, 2, and 3, showing only the most significant signals (Strength >= 4).
  • Max Patterns to Display: Limits the number of historical labels to prevent chart clutter.
  • Max Candles to Check Engulfing: Adjusts how far back the script looks to validate the size of an engulfing candle.
  • Trend Detection Period: Sets the length of the SMA used to determine the background trend context.
  • Show Only Trend-Appropriate Patterns: If checked, bullish reversals are only shown in downtrends, and bearish reversals in uptrends.


● 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.
הערות שחרור
list of candlestick patterns , categorized by their signal strength:

● Strength 1: Indecision Patterns
  • D: Doji 1
  • ST+: Bullish Spinning Top 2
  • ST-: Bearish Spinning Top 3
  • DD: Dragonfly Doji 4
  • GD: Gravestone Doji 5
  • LLD: Long-Legged Doji 6


● Strength 2: Weak Reversal & Continuation
  • HM: Hanging Man (Weak Bearish Reversal) 7
  • IH: Inverted Hammer (Weak Bullish Reversal) 8
  • BB+: Bullish Belt Hold (Weak Bullish Reversal) 9
  • BB-: Bearish Belt Hold (Weak Bearish Reversal) 10
  • ON: On-Neck (Weak Bearish Continuation) 11
  • IN: In-Neck (Weak Bearish Continuation) 12
  • TH: Thrusting (Weak Bearish Continuation) 13


● Strength 3: Moderate Reversal & Continuation
  • H: Hammer (Moderate Bullish Reversal) 14
  • SS: Shooting Star (Moderate Bearish Reversal) 15
  • BH: Bearish Harami (Moderate Bearish Reversal) 16
  • BH: Bullish Harami (Moderate Bullish Reversal) 17
  • PL: Piercing Line (Moderate Bullish Reversal) 18
  • DC: Dark Cloud Cover (Moderate Bearish Reversal) 19
  • TB: Tweezer Bottom (Moderate Bullish Reversal) 20
  • TT: Tweezer Top (Moderate Bearish Reversal) 21
  • ML: Matching Low (Moderate Bullish Support) 22
  • MH: Matching High (Moderate Bearish Resistance) 23
  • SL+: Separating Lines Bullish (Moderate Continuation) 24
  • SL-: Separating Lines Bearish (Moderate Continuation) 25
  • CA+: Counterattack Bullish (Moderate Reversal) 26
  • CA-: Counterattack Bearish (Moderate Reversal) 27
  • 3IU: Three Inside Up (Moderate Bullish Reversal) 28
  • 3ID: Three Inside Down (Moderate Bearish Reversal) 29


● Strength 4: Strong Patterns
  • BE+: Bullish Engulfing 30
  • BE-: Bearish Engulfing 31
  • MS: Morning Star (Strong Bullish Reversal) 32
  • ES: Evening Star (Strong Bearish Reversal) 33
  • MZ+: Bullish Marubozu (Strong Bullish) 34
  • MZ-: Bearish Marubozu (Strong Bearish) 35
  • 3OU: Three Outside Up (Strong Bullish Reversal) 36
  • 3OD: Three Outside Down (Strong Bearish Reversal) 37
  • ABB: Abandoned Baby Bullish (Strong Bullish Reversal) 38
  • ABB: Abandoned Baby Bearish (Strong Bearish Reversal) 39


● Strength 5: Very Strong Patterns
  • 3WS: Three White Soldiers (Very Strong Bullish) 40
  • 3BC: Three Black Crows (Very Strong Bearish) 41
  • BK+: Bullish Kicker (Very Strong Bullish) 42
  • BK-: Bearish Kicker (Very Strong Bearish) 43
  • 3LS+: Three Line Strike Bullish (Very Strong Continuation) 44
  • 3LS-: Three Line Strike Bearish (Very Strong Continuation) 45
  • R3M: Rising Three Methods (Very Strong Bullish Continuation) 46
  • F3M: Falling Three Methods (Very Strong Bearish Continuation) 47
  • UTG: Upside Tasuki Gap (Very Strong Bullish Continuation) 48
  • DTG: Downside Tasuki Gap (Very Strong Bearish Continuation) 49
  • BRK+: Breakaway Bullish (Very Strong Bullish Reversal) 50
  • BRK-: Breakaway Bearish (Very Strong Bearish Reversal) 51
הערות שחרור
🛠️ Improves:

• 11 new patterns: (Doji Star, Harami Cross, Rising/Falling Window, Morning/Evening Doji Star, Tri-Star, Long Shadow patterns)

• Better accuracy: body position checks, shadow ratio validation, trend context enforcement

• Academic compliance:All patterns now conform to Steve Nison's (Japanese Candlestick Charting Techniques) and Thomas Bulkowski's (Encyclopedia of Candlestick Charts) academic standards.
הערות שחרור
  • 🛠️adding granular visibility controls for each strength level (1 through 5)
  • and refactoring the color management to use user-defined inputs as per professional Pine Script v6 standards

כתב ויתור

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