This script was developed for personal use and the idea is spotting candles that are at least 99% bigger than average (using N = 3) as they will cross the upper and lower confidence interval limits. N = 2 would roughly provide a 95% confidence interval.
I recommend the standard values N = 2 and N = 3 that provide, respectively, approximately 95% and 99% confidence intervals.
Note: I suggest using smaller sample sizes (between the 30 and 100 last candles) for sigma estimation as they tend to represent better the recent volatility. I also suggest to use sample size=400 for long-term average volatility.
Remark: the original interpretation is a bit misleading. When the series crosses over the interval limits, one can say that the current candle length is 95% or 99% as extreme as the expected length.
Also in hypothesis testing, one could say that the hypothesis of the candle length being within the expected range is rejected at 5% or 1% significance level.
As closing prices can be seen as a random walk on chart, this series is basically modelling its error.
An analogous approach for candle length is just thinking of it as changes in the closing price ( I would rename ir as Price Change Outlier Detector if TV allowed it!).
A green column means a positive change in price and a red column means a negative change in price. These changes are always relative to the last price.
If a column crosses from from the inner band to the outer band, the change in price is considered to be approximately 95% as extreme as expected.
If it crosses both bands, the change in price it considered to be approximately 99% as extreme as expected.
Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Rumah. Anda boleh menyukai skrip ini untuk menggunakannya pada carta.