OPEN-SOURCE SCRIPT
Candle Microstructure Classifier

Candle Microstructure Classifier
Public Description
The Candle Microstructure Classifier is a visual study designed to highlight meaningful single-candle behaviors based purely on price geometry. It classifies candles according to body size and wick structure, helping traders visually identify moments of aggression, commitment, failed pushes, and rejection directly on the price chart.
This script is a study only. It does not generate trade signals, entries, exits, or forecasts. Its purpose is to provide structural context that can be combined with other tools such as trend, volume, or volatility analysis.
Quantitative Description
Each candle is decomposed into its geometric components relative to its total range (high − low). All classifications are based on normalized fractions to remain scale‑independent across instruments and timeframes.
Definitions:
1. Candle Range (R):
R = High − Low
2. Body Size (B):
B = |Close − Open|
Body Fraction = B / R
3. Upper Wick (UW):
UW = High − max(Open, Close)
Upper Wick Fraction = UW / R
4. Lower Wick (LW):
LW = min(Open, Close) − Low
Lower Wick Fraction = LW / R
Candle Classifications:
• Commitment Candle:
Body Fraction ≥ Large Body Threshold
Upper Wick Fraction ≤ Tiny Wick Threshold
Lower Wick Fraction ≤ Tiny Wick Threshold
Interpretation: Strong directional acceptance with minimal intrabar rejection.
• Marubozu (Aggression):
Body Fraction ≥ Large Body Threshold
One wick effectively absent (near zero)
Interpretation: Pure directional aggression with no meaningful counter‑pressure.
• Trend Attempt Failure:
Body Fraction ≥ Large Body Threshold
One wick large, opposite wick small
Interpretation: Strong push followed by immediate rejection on one side.
• Rejection Candle:
Body Fraction ≤ Small Body Threshold
Upper Wick Fraction ≥ Large Wick Threshold
Lower Wick Fraction ≥ Large Wick Threshold
Interpretation: Two‑sided rejection indicating price discovery or balance.
• Pin Rejection (optional):
Body Fraction ≤ Small Body Threshold
Only one wick large
Interpretation: One‑sided rejection often occurring near support or resistance.
Notes and Context
This classifier intentionally avoids pattern names tied to prediction. Each classification describes observed auction behavior inside a single bar, not an expectation of future movement.
Sources and Further Reading
Candle structure and wick interpretation:
• Investopedia – Candlestick Patterns and Anatomy
investopedia.com/trading/candlestick-charting-what-is-it/
Volume and volatility context examples:
• Wyckoff Method – Effort vs Result (Volume + Price Structure)
school.stockcharts.com/doku.php?id=market_analysis:wyckoff_method
• CME Group – Using Volume and Volatility Together
cmegroup.com/education/articles-and-reports/volume-and-volatility.html
Example Applications:
1. A commitment candle occurring simultaneously with a volume spike may indicate institutional participation and acceptance at that price level.
2. A rejection candle forming during elevated volatility (ATR expansion) may signal failed price discovery and potential mean reversion zones.
Public Description
The Candle Microstructure Classifier is a visual study designed to highlight meaningful single-candle behaviors based purely on price geometry. It classifies candles according to body size and wick structure, helping traders visually identify moments of aggression, commitment, failed pushes, and rejection directly on the price chart.
This script is a study only. It does not generate trade signals, entries, exits, or forecasts. Its purpose is to provide structural context that can be combined with other tools such as trend, volume, or volatility analysis.
Quantitative Description
Each candle is decomposed into its geometric components relative to its total range (high − low). All classifications are based on normalized fractions to remain scale‑independent across instruments and timeframes.
Definitions:
1. Candle Range (R):
R = High − Low
2. Body Size (B):
B = |Close − Open|
Body Fraction = B / R
3. Upper Wick (UW):
UW = High − max(Open, Close)
Upper Wick Fraction = UW / R
4. Lower Wick (LW):
LW = min(Open, Close) − Low
Lower Wick Fraction = LW / R
Candle Classifications:
• Commitment Candle:
Body Fraction ≥ Large Body Threshold
Upper Wick Fraction ≤ Tiny Wick Threshold
Lower Wick Fraction ≤ Tiny Wick Threshold
Interpretation: Strong directional acceptance with minimal intrabar rejection.
• Marubozu (Aggression):
Body Fraction ≥ Large Body Threshold
One wick effectively absent (near zero)
Interpretation: Pure directional aggression with no meaningful counter‑pressure.
• Trend Attempt Failure:
Body Fraction ≥ Large Body Threshold
One wick large, opposite wick small
Interpretation: Strong push followed by immediate rejection on one side.
• Rejection Candle:
Body Fraction ≤ Small Body Threshold
Upper Wick Fraction ≥ Large Wick Threshold
Lower Wick Fraction ≥ Large Wick Threshold
Interpretation: Two‑sided rejection indicating price discovery or balance.
• Pin Rejection (optional):
Body Fraction ≤ Small Body Threshold
Only one wick large
Interpretation: One‑sided rejection often occurring near support or resistance.
Notes and Context
This classifier intentionally avoids pattern names tied to prediction. Each classification describes observed auction behavior inside a single bar, not an expectation of future movement.
Sources and Further Reading
Candle structure and wick interpretation:
• Investopedia – Candlestick Patterns and Anatomy
investopedia.com/trading/candlestick-charting-what-is-it/
Volume and volatility context examples:
• Wyckoff Method – Effort vs Result (Volume + Price Structure)
school.stockcharts.com/doku.php?id=market_analysis:wyckoff_method
• CME Group – Using Volume and Volatility Together
cmegroup.com/education/articles-and-reports/volume-and-volatility.html
Example Applications:
1. A commitment candle occurring simultaneously with a volume spike may indicate institutional participation and acceptance at that price level.
2. A rejection candle forming during elevated volatility (ATR expansion) may signal failed price discovery and potential mean reversion zones.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。