Historical Volatility Indicator: How to Use in MetaStock

What is Historical Volatility?

Historical volatility measures how much the price of a security deviates from its average over a specified period of time. It is most commonly calculated by the standard deviation, although this is not the only way.

This article shows you some alternative ways to find volatile stocks.

Volatility is generally used as a measure of “riskiness” for a security or market index. The higher the volatility, the riskier the underlying instrument.

However, as you will see below, this is not always a bad thing for traders.

Understanding Historical Volatility

As mentioned, historical volatility measures the average deviation of a financial instrument from its average price over a given period.

It’s important to remember that this says nothing about the direction of a security, only the magnitude of its price fluctuations around an average – up or down.

In a trending market, we tend to refer to a moving average. When a stock is in a smooth trend, we expect to see small price deviations around this moving average.

That’s how a stock in a strong trend can have low volatility; even though the price might have changed significantly over a long period of time.

Calculating Historical Volatility

The most common way to calculate historical volatility is with standard deviation.

Standard Deviation

Standard deviation is a statistical measure for the amount of dispersion in a set of values. In this context, the set of values are the continuously compounded returns of a security over a given period.

To calculate it, you add up the squared differences of each periods return with the average, divide by the number of periods minus 1, and take the square root.

This resembles the following formula:

standard deviation formula

Here is a step-by-step procedure to calculate the standard deviation (historical volatility):

  1. Collect the historical prices of the security: P0, … , Pn,
  2. Calculate the continuously compounded returns for each period: Ri = ln(Pi/Pi-1)
  3. Compute the average (mean) of the returns to find Ravg
  4. Calculate the difference between the average and each period’s return
  5. Square each of the differences in step 4
  6. Add up all of the squared differences from step 5
  7. Divide the answer from step 6 by n-1
  8. Take the square root of the answer from step 7

How to Use the Historical Volatility Indicator in MetaStock

MetaStock’s intuitive coding language makes it very easy to plot the historical volatility of an asset.

For example, to create an indicator for the 10-day historical volatility, you simply plug the following formula into the “Indicator Builder”.

historical volatility

Note, multiplying daily standard deviation by Sqrt(365) converts it to an annualized number. And multiplying it by 100 puts it in percentage form instead of decimal form.

Now you can drag and drop it from the indicator menu into any chart you like. In the chart below, the historical volatility is represented by the red line in the bottom window.

MetaStock HVOL

MetaStock Custom Formulas

Now, you may be asking yourself how to use that red line. It’s not exactly obvious, right?

Luckily, however, MetaStock has a strong online community of fellow traders who share their wisdom on such things.

The best place to start is the “Resources” section on MetaStock’s website. Here, you’ll find forums, primers, and a library of custom formula suggestions.

Essentially, everything you need to know about the what’s, how’s, and why’s of technical indicators and trading systems. There’s even a “Formula Request” section where you can ask MetaStock to create a custom formula or trading system for you.

For a closer look at all of MetaStock’s features, check out my MetaStock review.

MetaStock HVI System

This following system is taken from the MetaStock “Custom Formula Collection“, and is one example of how to use historical volatility in trading.

First, create an indicator for the 100-day historical volatility, exactly the same way we created the 10-day volatility earlier.

Now, in the “Indicator Builder”, create a new indicator that divides the 10-day volatility by the 100-day volatility. Name this the Historical Volatility Indicator (HVI).

historical volatility indicator

Next, open up the “Expert Advisor” and create the following buy and sell symbols.

The buy rule triggers whenever the security’s closing price crosses above the 20-day exponential moving average (EMA) and the HVI was below 0.5 in any of the last 10 days.

HVI buy signal

A sell signal occurs when the price crosses below the 20-day EMA and the HVI was below 0.5 in any of the last 10 days.

HVI sell signal

To plot these trading signals, attach this new “Expert Advisor” to any chart.

historical volatility indicator expert advisor

For example, this is what the HVI system looks like on Apple’s chart.

historical volatility in MetaStock

Now, we have a volatility based trend following system at our disposal. You can play around with the parameters to get a system that suits your trading style. Or, you could even optimize it with MetaStock’s backtesting function to find the settings that worked best in the past.

Another stock screener that includes the historical volatility is Scanz. Read my Scanz review to find out more about this platform.

Using Historical Volatility in Trading

There are a number of different ways to use historical volatility in trading. Unlike other technical indicators, like the MACD and RSI, there are no specific trading rules or overbought/oversold levels with historical volatility. It is simply a line that represents the dispersion of historical price changes.

Having said that, some traders argue that high volatility usually precedes significant price reversals. As such, you can wait for periods of high volatility and use use it as a contrarian indicator.

Historical volatility is also a key component of other technical indicators such as Bollinger Bands and the Average True Range (ATR).

In the case of Bollinger Bands, volatility is used to compute a range around a central (moving) average, similar to confidence intervals.

The average is usually a 20-period moving average and the upper and lower bands are plotted 2 standard deviations above and below this moving average, respectively.

When the price gets too close to either one of the red or green lines, it means that the move has become extreme by historical standards. Therefore, traders tend to look for reversals at these points.

All of these examples show why traders like volatility in markets – it presents them with trading opportunities.

High relative volume stocks usually display this volatility that traders look for.

Historical Volatility vs. Implied Volatility

Unlike historical volatility, which tells us about the past, implied volatility only concerns future price movements.

It derives from options prices, and tells investors how volatile the market expects a stock to be in the future.

As such, it provides a good gauge about how fearful investors are about the future. This is captured by something called the Volatility Index (VIX), which is the average implied volatility of S&P 500 stocks. The VIX is otherwise known as the “fear index”.

Options traders often use historical and implied volatility in conjunction with one another. Specifically, they compare the current implied volatility of a stock against its historical volatility.

Historical volatility is used as the baseline for where we should expect implied volatility to be. If implied volatility is above historical volatility, then an option is said to be overvalued, but if it’s below then it’s said to be undervalued. Traders look to capitalize on significant deviations between these two metrics.