OPEN-SOURCE SCRIPT

Adaptive Candlestick Context Scanner

114
OVERVIEW

Adaptive Candlestick Context Scanner is a contextual candlestick-pattern study designed to evaluate candle formations together with the market conditions in which they develop.

Rather than treating every matching candle shape equally, the scanner combines pattern geometry with prior trend, ATR-normalized measurements, and structural swing location.

The analytical workflow is:

Pattern Geometry → Prior Trend → Volatility Normalization → Structural Location → Context Quality → Confirmed Classification

The objective is to provide a structured way to study candlestick behavior while reducing some of the ambiguity associated with shape-only pattern recognition.

CORE METHODOLOGY

1. Pattern Geometry

The scanner evaluates candle bodies, upper and lower wicks, relative candle relationships, and multi-candle structures according to transparent pattern definitions.

STANDARD mode uses broader geometric requirements, while STRICT mode applies tighter qualifying conditions.

2. Prior Trend Context

Certain candlestick formations have different contextual meaning depending on the movement preceding them.

An adaptive trend component therefore evaluates the preceding price structure before contributing to a pattern's contextual assessment.

3. ATR Normalization

Fixed price-distance thresholds can behave inconsistently across instruments and volatility regimes.

ATR normalization allows relevant geometric and location measurements to scale with current market volatility.

4. Structural Location

The scanner evaluates whether a formation develops near recent swing extremes.

This provides an additional structural layer instead of evaluating the candle formation in isolation.

5. Context Quality

Qualified patterns receive a Context Quality measurement derived from pattern anatomy, prior-trend context, and structural location.

This value measures conformity to the scanner's internal contextual criteria.

Context Quality is not a probability, expected win rate, or forecast of future performance.

PATTERN COVERAGE

The scanner includes bullish, bearish, and neutral candlestick families, including single-candle and multi-candle structures.

Examples include:

Hammer and Inverted Hammer
Hanging Man and Shooting Star
Bullish and Bearish Engulfing
Bullish and Bearish Harami
Piercing Line and Dark Cloud Cover
Morning Star and Evening Star
Tweezer Bottom and Tweezer Top
Counter Attack formations
Sash formations
Separating Lines
Rising and Falling Windows
Rising Three and Falling Three
Three White Soldiers and Three Black Crows
Doji, High Wave, and Spinning Top
Bullish and Bearish Marubozu

PER-PATTERN CONTROL

Individual pattern families can be configured independently.

Available states include:

DEFAULT — follows the scanner's primary detection mode
OFF — disables the selected pattern
STANDARD — uses standard qualification criteria
STRICT — applies tighter qualification criteria

This allows the scanner to be adapted without requiring every candlestick family to use identical detection settings.

MULTIPLE-PATTERN RESOLUTION

More than one candlestick definition can occasionally qualify around the same price structure.

The scanner provides configurable resolution behavior, including:

Highest Quality — prioritizes the strongest contextual assessment
Highest Priority — follows the scanner's defined pattern hierarchy
All Qualified — allows qualified formations to be retained according to the selected display behavior

This helps control visual density while preserving analytical flexibility.

VISUAL SYSTEM

The scanner includes:

Premium bullish and bearish candle styling
Directional pattern markers
Full or compact pattern names
Context-quality labels
Controlled historical label retention
A compact real-time information dashboard

The dashboard displays the current detection mode, prior-trend context, most recently confirmed pattern, its Context Quality reading, and the selected resolution method.

ALERTS

Alert functionality is available for confirmed contextual pattern detections.

Directional alert categories support bullish, bearish, and neutral formations, while the scanner can also provide pattern-specific information through its dynamic alert workflow.

Alerts should be treated as notifications that a defined pattern condition has been detected, not as trade instructions.

HOW TO USE

The scanner can be used to study how candlestick formations interact with broader price context.

A pattern appearing near a relevant structural location with stronger contextual alignment may warrant different analytical attention than the same geometric formation appearing in an unrelated part of the price structure.

Users can adjust detection strictness, minimum Context Quality, pattern selection, and display behavior according to the instrument and timeframe being studied.

The scanner is designed as an analytical and educational tool and should be combined with broader market structure, risk management, and independent analysis where appropriate.

CONFIRMATION AND LIMITATIONS

Pattern labels are evaluated on confirmed bars.

Multi-candle formations require their defining candles to complete before classification.

Candlestick formations describe observed price structure; they do not guarantee subsequent market direction.

Context Quality represents conformity to the scanner's internal evidence criteria and must not be interpreted as probability, expected profitability, or future performance.

Different instruments, sessions, volatility regimes, and timeframes can produce materially different pattern behavior.

ORIGINALITY

Adaptive Candlestick Context Scanner uses an independently developed contextual framework that integrates transparent candlestick geometry with trend context, volatility normalization, structural location, contextual scoring, conflict resolution, and controlled visualization.

Its purpose is not to reproduce a proprietary candlestick methodology, but to provide an original framework for contextual pattern analysis.

Release Notes — v1.1

Adaptive Candlestick Context Scanner v1.1

This update expands the scanner's configuration and contextual-analysis framework.

Key improvements include per-pattern DEFAULT/OFF/STANDARD/STRICT controls, configurable multiple-pattern resolution, independent compact/full pattern naming, enhanced contextual quality assessment, expanded alert handling, and dashboard refinements.

The underlying objective remains unchanged: evaluate confirmed candlestick formations within market context rather than treating candle geometry as a standalone directional signal.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน