OPEN-SOURCE SCRIPT
Top and Bottom Probability

The top and bottom probability oscillator is an educational indicator that estimates the probability of a local top or bottom using four ingredients:
It plots RSI, two probability histograms (Top %, Bottom %), and an optional 0–100 velocity gauge.
How to read it
RSI & Levels: Standard RSI with OB/OS lines (70/30 by default).
Prob Top (%): Red histogram, 0–100. Higher values suggest increasing risk of a local top after an RSI overbought anchor.
Prob Bottom (%): Green histogram, 0–100. Higher values suggest increasing chance of a local bottom after an RSI oversold anchor.
Velocity (0–100): Optional line. Above 50 = positive/upward DMV; below 50 = negative/downward DMV. DMV pushes Top risk when trending down and Bottom chance when trending up.
These are composite, scale-free scores, not certainties or trade signals.
What the probabilities consider
Price Delta: How far price has moved beyond the last OB (for tops) or below the last OS (for bottoms). More extension → higher probability.
Time Since OB/OS: Longer time since the anchor → higher probability (until capped by the “Time Normalization (bars)” input).
Oscillator Divergence: RSI pulling away from its last OB/OS reading in the opposite direction implies weakening momentum and increases probability.
Directional Momentum Velocity (DMV):
Computes a regression slope of hlc3 vs. bar index, normalized by ATR, then squashed with tanh.
Downward DMV boosts Top probability; upward DMV boosts Bottom probability.
Toggle the velocity plot and adjust its sensitivity with Velocity Lookback, ATR Length, and Velocity Gain.
All four terms are blended with user-set weights. If Normalize Weights is ON, weights are rescaled to sum to 1.
Inputs (most useful)
RSI Length / OB / OS: Core RSI setup.
Time Normalization (bars): Sets how quickly the “time since OB/OS” term ramps from 0→1.
Weights:
Price Delta, Time Since OB/OS, Osc Divergence, Directional Velocity.
Turn Normalize Weights ON to keep the blend consistent when you experiment.
Settings:
Velocity Lookback: Window for slope estimation (shorter = more reactive).
ATR Length: Normalizes slope so symbols/timeframes are comparable.
Velocity Gain: Steepens or softens the tanh curve (higher = punchier extremes).
Show Velocity (0–100): Toggles the DMV display.
Tip: If you prefer momentum measured on RSI rather than price, in the DMV block replace hlc3 with rsi (concept stays identical).
Practical tips
Use Top/Bottom % as context, not triggers. Combine with structure (S/R), trend filters, and risk management.
On strong trends, expect the opposite probability (e.g., Top % during an uptrend) to stay suppressed longer.
Calibrate weights: e.g., raise Osc Divergence on mean-reversion symbols; raise Velocity in trending markets.
For lower noise: lengthen Velocity Lookback and ATR Length, or reduce Velocity Gain.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.