OPEN-SOURCE SCRIPT
Green/Red Candle Conditional Probability V2

Conditional Next-Candle Probability Analyzer
This indicator calculates the historical probability of the next candle being green based on current market conditions. Unlike simple candle counters, it tracks conditional probabilities.
How It Works:
Monitors 20+ market conditions across trend, momentum, volatility, volume, and candle patterns
For each condition, tracks: "When this was true, what % of next candles were green?"
Combines active conditions into a weighted probability prediction
Weights by sample size (more historical data = more influence)
Conditions Tracked:
Trend alignment (EMA 7 / SMA 20 / SMA 200)
RSI levels and momentum
MACD position, histogram, and crosses
Consecutive candle streaks (3-4 in a row)
Bollinger Band touches and squeeze/expansion
Volume spikes and anomalies
Large candles and rejection wicks
Table Display:
P(Grn): Probability next candle is green when condition is active
Edge: Deviation from 50% (how predictive the condition is)
N: Sample size (historical occurrences)
► marks currently active conditions
Signals:
Plots arrows when multiple conditions align with sufficient confidence (configurable threshold).
Use Cases:
Identify which setups have actual predictive value on your asset/timeframe
Find confluence zones where multiple high-edge conditions align
Backtest mean-reversion vs momentum characteristics
Note: Edges are typically small (2-5%). Best used for confluence confirmation, not standalone signals.
This indicator calculates the historical probability of the next candle being green based on current market conditions. Unlike simple candle counters, it tracks conditional probabilities.
How It Works:
Monitors 20+ market conditions across trend, momentum, volatility, volume, and candle patterns
For each condition, tracks: "When this was true, what % of next candles were green?"
Combines active conditions into a weighted probability prediction
Weights by sample size (more historical data = more influence)
Conditions Tracked:
Trend alignment (EMA 7 / SMA 20 / SMA 200)
RSI levels and momentum
MACD position, histogram, and crosses
Consecutive candle streaks (3-4 in a row)
Bollinger Band touches and squeeze/expansion
Volume spikes and anomalies
Large candles and rejection wicks
Table Display:
P(Grn): Probability next candle is green when condition is active
Edge: Deviation from 50% (how predictive the condition is)
N: Sample size (historical occurrences)
► marks currently active conditions
Signals:
Plots arrows when multiple conditions align with sufficient confidence (configurable threshold).
Use Cases:
Identify which setups have actual predictive value on your asset/timeframe
Find confluence zones where multiple high-edge conditions align
Backtest mean-reversion vs momentum characteristics
Note: Edges are typically small (2-5%). Best used for confluence confirmation, not standalone signals.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.