OPEN-SOURCE SCRIPT
Standard Deviation Volatility Indicator

Standard Deviation Volatility Indicator
This indicator is constructed using the logarithmic returns of a price series and computing its standard deviation to estimate volatility. It then uses this volatility estimate to produce levels above and below the current price. It concludes by calculating the stochastic value based on these volatility levels.
Settings and Inputs:
SD Settings:
Standard Deviation Source: Defines the price series for which volatility is being calculated, default is the closing price.
Standard Deviation Period: A factor used to adjust the standard deviation.
Standard Deviation Length: Defines the number of periods over which the standard deviation is calculated.
Enable Smoothing?: Option to activate a smoothing function for the final output of the indicator.
MA Smoothing Length: Defines the number of periods for the moving average used to smooth the final output.
Indicator Logic:
Logarithmic Returns: Calculates the natural logarithm of the ratio of consecutive price values to determine returns.
Standard Deviation: Computes the standard deviation of these returns over a specified length n.
Historical Volatility (Hv): Uses the previously computed standard deviation as a proxy for historical volatility.
Levels Calculation: Uses the historical volatility to derive multiple levels above (SD1, SD2, SD3) and below (SD1_, SD2_, SD3_) the current price. An average for both sets of levels is then computed (SDM and SDM_).
Stochastic Value: The indicator calculates a stochastic value using the third level of the above and below computed values (SD3 and SD3_).
Smoothing: If smoothing is enabled, the stochastic value is smoothed using an exponential moving average of a specified length.
Output:
If the smoothing option is selected, the final output is the smoothed stochastic value.
Otherwise, the raw stochastic value is given.
This indicator is constructed using the logarithmic returns of a price series and computing its standard deviation to estimate volatility. It then uses this volatility estimate to produce levels above and below the current price. It concludes by calculating the stochastic value based on these volatility levels.
Settings and Inputs:
SD Settings:
Standard Deviation Source: Defines the price series for which volatility is being calculated, default is the closing price.
Standard Deviation Period: A factor used to adjust the standard deviation.
Standard Deviation Length: Defines the number of periods over which the standard deviation is calculated.
Enable Smoothing?: Option to activate a smoothing function for the final output of the indicator.
MA Smoothing Length: Defines the number of periods for the moving average used to smooth the final output.
Indicator Logic:
Logarithmic Returns: Calculates the natural logarithm of the ratio of consecutive price values to determine returns.
Standard Deviation: Computes the standard deviation of these returns over a specified length n.
Historical Volatility (Hv): Uses the previously computed standard deviation as a proxy for historical volatility.
Levels Calculation: Uses the historical volatility to derive multiple levels above (SD1, SD2, SD3) and below (SD1_, SD2_, SD3_) the current price. An average for both sets of levels is then computed (SDM and SDM_).
Stochastic Value: The indicator calculates a stochastic value using the third level of the above and below computed values (SD3 and SD3_).
Smoothing: If smoothing is enabled, the stochastic value is smoothed using an exponential moving average of a specified length.
Output:
If the smoothing option is selected, the final output is the smoothed stochastic value.
Otherwise, the raw stochastic value is given.
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.