How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Feature Request FAQ Help & Wiki Twitter

# Historical Volatility

240 1
Markets oscillate from periods of low volatility to high volatility
and back. The author`s research indicates that after periods of
extremely low volatility , volatility tends to increase and price
may move sharply. This increase in volatility tends to correlate
with the beginning of short- to intermediate-term moves in price.
They have found that we can identify which markets are about to make
such a move by measuring the historical volatility and the application
of pattern recognition.
The indicator is calculating as the standard deviation of day-to-day
logarithmic closing price changes expressed as an annualized percentage.
```////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 16/07/2014
// Markets oscillate from periods of low volatility to high volatility
// and back. The author`s research indicates that after periods of
// extremely low volatility, volatility tends to increase and price
// may move sharply. This increase in volatility tends to correlate
// with the beginning of short- to intermediate-term moves in price.
// They have found that we can identify which markets are about to make
// such a move by measuring the historical volatility and the application
// of pattern recognition.
// The indicator is calculating as the standard deviation of day-to-day
// logarithmic closing price changes expressed as an annualized percentage.
////////////////////////////////////////////////////////////
study(title="Historical Volatility")
LookBack = input(20, minval=1)
Annual = input(365, minval=1)
hline(0, color=purple, linestyle=dashed)
xPrice = log(close / close[1])
nPer = iff(isintraday or isdaily, 1, 7)
xPriceAvg = sma(xPrice, LookBack)
xStdDev = stdev(xPrice, LookBack)
HVol = (xStdDev * sqrt(Annual / nPer)) * 100
plot(HVol, color=blue, title="Historical Volatility")```
I was looking for the original HV code.

Thanks
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia

한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter