OPEN-SOURCE SCRIPT
BUY & SELL Probability (M5..D1) - MTF

MTF Probability Indicator (M5 to D1) - Dual Color Histogram with Smoothing and Buy/Sell LabelsOverviewThis indicator calculates a probabilistic bias for buy or sell opportunities across multiple timeframes (from 5-minute to Daily), combining trend analysis from EMA (200-period), momentum from MACD, and strength from ADX. It incorporates higher timeframe weighting, momentum emphasis, and Smart Money Concept (SMC) influences via ADX scoring. Additionally, it adjusts for proximity to recent support/resistance levels to refine the probability.The output is visualized as:A dual-color histogram in a sub-panel (green for bullish bias ≥50%, red for bearish <50%), smoothed for reduced noise.
Buy/Sell percentage labels on the main chart, displayed above (Buy) and below (Sell) the last candle for quick reference.
Probabilities are clamped between 0% and a user-defined max (default 100%), ensuring realistic outputs. This tool is designed for traders seeking multi-timeframe confluence, helping identify potential entry points in trending or ranging markets.Key FeaturesMulti-Timeframe Analysis: Aggregates data from M5, M15, H1, H4, and D1, starting from the current chart's timeframe upward. Weights can be customized for each TF to emphasize lower or higher frames.
Component Weights: Balances trend (EMA-based), momentum (MACD), and SMC/strength (ADX) with adjustable ratios.
Smoothing: Applies a simple moving average (SMA) to the buy probability for smoother readings.
Support/Resistance Adjustment: Influences the score based on proximity to recent highs/lows within a lookback period, adding a price action layer.
Boost for Current TF: Optionally amplifies the weight of the starting timeframe for more responsive signals on lower charts.
Visuals: Histogram for trend bias visualization; labels for precise % readouts on the last bar.
How It WorksTrend Score: Derived from price position relative to EMA(200) on each TF (+100% if above, -100% if below).
Momentum Score: Based on MACD line vs. signal (+100% if bullish cross, -100% if bearish).
ADX Score: Measures trend strength (scaled to 0-100%, where higher ADX boosts the directional bias).
Aggregation: Scores are weighted by TF percentages and component weights (Trend, Momentum, SMC), then combined.
S/R Adjustment: Adds/subtracts influence based on closeness to recent highs (resistance) or lows (support).
Probability Calculation: Final buy % = 50% + (total score / 2), clamped; sell % = 100% - buy %.
Smoothing & Display: Buy % is smoothed via SMA; histogram shows deviation from 50%; labels update on the last bar.
InterpretationBuy Bias (Green Histogram >0): Suggests bullish probability >50%. Higher bars indicate stronger confluence.
**Sell Bias (Red Histogram <0)**: Suggests bearish probability >50%. Lower bars indicate stronger downside bias.
Labels: "BUY: XX%" above the candle (lime background) and "SELL: YY%" below (red background). Use these for quick probability checks—e.g., BUY 70% implies a 70/30 bullish edge.
Neutral Zone: Around 50% indicates low confluence; avoid trading or wait for confirmation.
Best Use: Combine with price action, volume, or other indicators. Ideal for swing trading on H1+ charts or scalping on M5/M15 with higher TF weights.
Input ParametersEMA 200 Period: Length for the trend EMA (default: 200).
MACD Settings: Fast (12), Slow (26), Signal (9).
ADX Period: For trend strength (14).
Weights:Higher Time Frame (Trend): 0.4
Momentum: 0.4
SMC (ADX): 0.3
TF Weights (%): M5 (40), M15 (0), H1 (30), H4 (30), D1 (0). Total should sum to 100% for normalization.
Used Timeframe Boost: Multiplier for the starting TF (1.0 = no boost).
Probability Clamp: Max buy % (100.0).
Smoothing Period: SMA length for buy prob (3).
S/R Lookback: Bars for high/low detection (50).
S/R Proximity Influence: Strength of adjustment (10.0).
Colors: Buy (lime), Sell (red).
Notes & LimitationsThis is not financial advice—use for educational/informational purposes only. Backtest thoroughly.
Performance may vary by asset; optimize weights for stocks, forex, or crypto.
On very low timeframes (<M5), it starts from M5 upward.
Histogram is in a separate pane; labels only appear on the last bar to avoid clutter.
Version 6: Added dual-color histogram, smoothing, and on-chart labels for enhanced usability.
If you encounter issues (e.g., labels not displaying), ensure the chart is in real-time mode and the indicator is added correctly. For customization or feedback, feel free to comment!
Buy/Sell percentage labels on the main chart, displayed above (Buy) and below (Sell) the last candle for quick reference.
Probabilities are clamped between 0% and a user-defined max (default 100%), ensuring realistic outputs. This tool is designed for traders seeking multi-timeframe confluence, helping identify potential entry points in trending or ranging markets.Key FeaturesMulti-Timeframe Analysis: Aggregates data from M5, M15, H1, H4, and D1, starting from the current chart's timeframe upward. Weights can be customized for each TF to emphasize lower or higher frames.
Component Weights: Balances trend (EMA-based), momentum (MACD), and SMC/strength (ADX) with adjustable ratios.
Smoothing: Applies a simple moving average (SMA) to the buy probability for smoother readings.
Support/Resistance Adjustment: Influences the score based on proximity to recent highs/lows within a lookback period, adding a price action layer.
Boost for Current TF: Optionally amplifies the weight of the starting timeframe for more responsive signals on lower charts.
Visuals: Histogram for trend bias visualization; labels for precise % readouts on the last bar.
How It WorksTrend Score: Derived from price position relative to EMA(200) on each TF (+100% if above, -100% if below).
Momentum Score: Based on MACD line vs. signal (+100% if bullish cross, -100% if bearish).
ADX Score: Measures trend strength (scaled to 0-100%, where higher ADX boosts the directional bias).
Aggregation: Scores are weighted by TF percentages and component weights (Trend, Momentum, SMC), then combined.
S/R Adjustment: Adds/subtracts influence based on closeness to recent highs (resistance) or lows (support).
Probability Calculation: Final buy % = 50% + (total score / 2), clamped; sell % = 100% - buy %.
Smoothing & Display: Buy % is smoothed via SMA; histogram shows deviation from 50%; labels update on the last bar.
InterpretationBuy Bias (Green Histogram >0): Suggests bullish probability >50%. Higher bars indicate stronger confluence.
**Sell Bias (Red Histogram <0)**: Suggests bearish probability >50%. Lower bars indicate stronger downside bias.
Labels: "BUY: XX%" above the candle (lime background) and "SELL: YY%" below (red background). Use these for quick probability checks—e.g., BUY 70% implies a 70/30 bullish edge.
Neutral Zone: Around 50% indicates low confluence; avoid trading or wait for confirmation.
Best Use: Combine with price action, volume, or other indicators. Ideal for swing trading on H1+ charts or scalping on M5/M15 with higher TF weights.
Input ParametersEMA 200 Period: Length for the trend EMA (default: 200).
MACD Settings: Fast (12), Slow (26), Signal (9).
ADX Period: For trend strength (14).
Weights:Higher Time Frame (Trend): 0.4
Momentum: 0.4
SMC (ADX): 0.3
TF Weights (%): M5 (40), M15 (0), H1 (30), H4 (30), D1 (0). Total should sum to 100% for normalization.
Used Timeframe Boost: Multiplier for the starting TF (1.0 = no boost).
Probability Clamp: Max buy % (100.0).
Smoothing Period: SMA length for buy prob (3).
S/R Lookback: Bars for high/low detection (50).
S/R Proximity Influence: Strength of adjustment (10.0).
Colors: Buy (lime), Sell (red).
Notes & LimitationsThis is not financial advice—use for educational/informational purposes only. Backtest thoroughly.
Performance may vary by asset; optimize weights for stocks, forex, or crypto.
On very low timeframes (<M5), it starts from M5 upward.
Histogram is in a separate pane; labels only appear on the last bar to avoid clutter.
Version 6: Added dual-color histogram, smoothing, and on-chart labels for enhanced usability.
If you encounter issues (e.g., labels not displaying), ensure the chart is in real-time mode and the indicator is added correctly. For customization or feedback, feel free to comment!
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.