Probability Cone [BAPig]

Probability Cone is based on the Expected Move. While Expected Move only shows the historical value band on every bar, probability panel extend the period in the future and plot a cone or curve shape of the probable range. It plots the range from bar 1 all the way to bar 31.

In this model, we assume asset price follows a log-normal distribution and the log return follows a normal distribution.
Note: Normal distribution is just an assumption; it's not the real distribution of return.

The area of probability range is based on an inverse normal cumulative distribution function. The inverse cumulative distribution gives the range of price for given input probability. People can adjust the range by adjusting the input probability in the settings. The probability of the entered standard deviation will be shown in the middle when the "show probability" setting is on.

Note: All these probabilities are based on the normal distribution assumption for returns. It's the estimated probability, not the actual probability.

Volatility Models :

Sample SD: traditional sample standard deviation, most commonly used, use (n-1) period to adjust the bias

Parkinson: Uses High/ Low to estimate volatility , assumes continuous no gap, zero mean no drift, 5 times more efficient than Close to Close

Garman Klass: Uses OHLC volatility , zero drift, no jumps, about 7 times more efficient

Yangzhang Garman Klass Extension: Added jump calculation in Garman Klass, has the same value as Garman Klass on markets with no gaps.
about 8 x efficient

Rogers: Uses OHLC, Assume non-zero mean volatility , handles drift, does not handle jump 8 x efficient.

EWMA: Exponentially Weighted Volatility . Weight recently volatility more, more reactive volatility better in taking account of volatility autocorrelation and cluster.

YangZhang: Uses OHLC, combines Rogers and Garmand Klass, handles both drift and jump, 14 times efficient, alpha is the constant to weight rogers volatility to minimize variance.

Median absolute deviation: It's a more direct way of measuring volatility . It measures volatility without using Standard deviation. The MAD used here is adjusted to be an unbiased estimator.

Volatility Period is the sample size for variance estimation. A longer period makes the estimation range more stable less reactive to recent price. Distribution is more significant on a larger sample size. A short period makes the range more responsive to recent price. Might be better for high volatility clusters.

People usually assume the mean of returns to be zero. To be more accurate, we can consider the drift in price from calculating the geometric mean of returns. Drift happens in the long run, so short lookback periods are not recommended.
The shape of the cone will be skewed and have a directional bias when the length of mean is short. It might be more adaptive to the current price or trend, but more accurate estimation should use a longer period for the mean.

Using a short look back for mean will make the cone having a directional bias.

When we are estimating the future range for time > 1, we typically assume constant volatility and the returns to be independent and identically distributed. We scale the volatility in term of time to get future range. However, when there's autocorrelation in returns( when returns are not independent), the assumption fails to take account of this effect. Volatility scaled with autocorrelation is required when returns are not iid. We use an AR(1) model to scale the first-order autocorrelation to adjust the effect. Returns typically don't have significant autocorrelation. Adjustment for autocorrelation is not usually needed. A long length is recommended in Autocorrelation calculation.
Note: The significance of autocorrelation can be checked on an ACF indicator.

Time back settings shift the estimation period back by the input number. It's the origin of when the probability cone start to estimation it's range.
E.g., When time back = 5, the probability cone start its prediction interval estimation from 5 bars ago. The entire length of estimation is 31 bars. So for time back = 5 , it estimates the probability range from 5 bars ago to 26 bars in the future.

The two labels on cone show the price level of the estimated future bars based on the "label time unit" input. The default setting is 7. It shows the range of the 7th future bar calculated from the source.
Note: For assets that have gaps, the position of the label will get distorted and not be on the 7th future bar. The value will still be the range of the 7th bar value.

There’s a bug in Tradingview’s panel display when the background isn’t black. The numbers and text will sometimes get blurred when users scroll in and out on the chart. To avoid that, users can tick “Dark background” options in the settings to have a black background. When text starts to get blurred, users can also tick and tick the dark background options to refresh.

For prices that require more decimal places, users can type in the decimals places they want in the “decimal” setting.

People should not blindly trust the probability. They should be aware of the risk evolves by using the normal distribution assumption. The real return has skewness and high kurtosis . While skewness is not very significant, the high kurtosis should be noticed. The Real returns have much fatter tails than the normal distribution, which also makes the peak higher. This property makes the tail ranges such as range more than 2SD highly underestimate the actual range and the body such as 1 SD slightly overestimate the actual range. For ranges more than 2SD, people shouldn't trust them. They should beware of extreme events in the tails.
The uncertainty in future bars makes the range wider. The overestimate effect of the body is partly neutralized when it's extended to future bars.

The probability is only for the closing price, not wicks. It only estimates the probability of the price closing at this level, not in between.
Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact balipour for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases you can find a good open-source alternative for free in our Community Scripts.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?

Warning: please read before requesting access.