UDAY_C_Santhakumar

Historical Volatility based Standard Deviation_V2

This Plots the Standard Deviation Price Band based on the Historical Volatility. SD 1, 2, 3.

Version update:
Fixed the Standard Deviation mistake on Version 1.
Added Smoothing Options for those who prefer a less choppy version.
Standard Deviation 3 plot is not set to Default

Uday C Santhakumar
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?
//Created by UCSgears
//Plots Standard deviation on pricechart based on Historical Volatility. 
//This Code will be revised when Implied Volatility is available in trading view.

study(title="UCS_Standard Deviation-Historical Volatility_V2", shorttitle="UCS_StdDev(HV)", overlay = true)

length = input(10, minval=1)
DaystoExpire = input (30, minval=1) 
stddev1=input(true,title="Standard Deviation 1")
stddev2=input(true,title="Standard Deviation 2")
stddev3=input(false,title="Standard Deviation 3")
Smooth = input(true)
sm = input (21, title = "Smooth Length")

annual = 365
per = isintraday or isdaily and interval == 1 ? 1 : 7
hv = stdev(log(close / close[1]), length) * sqrt(annual / per)
stdhv = close*hv*sqrt(DaystoExpire/365) 
stdhv1 = Smooth ? sma(stdhv,sm) : stdhv
stdhv2 = stdhv1*2
stdhv3 = stdhv1*3

Stdhv1u = plot(stddev1 ? (close+stdhv1):na, color = red, title = "1st Standard Deviation Upperband")
Stdhv1d = plot(stddev1 ? (close-stdhv1):na, color = red, title = "1st Standard Deviation Lowerband")
Stdhv2u = plot(stddev2 ? (close+stdhv2):na, color = blue, title = "2nd Standard Deviation Upperband")
Stdhv2d = plot(stddev2 ? (close-stdhv2):na, color = blue, title = "2nd Standard Deviation Lowerband")
Stdhv3u = plot(stddev3 ? (close+stdhv3):na, color = black, title = "3rd Standard Deviation Upperband")
Stdhv3d = plot(stddev3 ? (close-stdhv3):na, color = black, title = "3rd Standard Deviation Lowerband")