Exploring Historical Price Volatility

Volatility can be measured in a number of ways. The most common methods include standard deviation, variance, a day range (High – Low) and historical volatility calculations. Bollinger bands are one way to measure price volatility that incorporates the visual aspects of channels while having the versatility of moving averages. The bands are basically a group of moving averages set a defined number of standard deviations apart. The general theory is that prices will tend to stay within the bands until higher price volatility takes over, at which point, they may violate either the high or low band. This violation can be used as a signal for price movement.

Bollinger Bands

Three arguments are required to calculate a Bollinger band. The first is the instrument (an equity or future contract of choice). The second is the number of days over which to calculate the curve. As a rule of thumb, keep the number of days between 20 and 250. Anything under 20 days tends to be too reactive and anything over 1 year is generally too smooth. 180 days is a good starting point and is generally what is used in technical analysis texts. The third argument is the number of standard deviations that should generally be kept between 0.5 and 2.5. Anything under 0.5 will generate signals on low volatility and anything over 2.5 is probably too rare.[3] The greater the number of standard deviations used, the smaller the frequency distribution and the more volatile the security must be to reach one of the bands. Bollinger bands expand (i.e. the gap between the high and low band increases) during times of high volatility and contract during low price volatility. The query below shows a graph of Home Depot stock with 75 day Bollinger bands set at 1 standard deviation:

SHOW 
  1: bollinger_high ( HD, 75 days, 1 ) 
  2: bollinger_low ( HD, 75 days, 1 ) 
  3: HD 
WHEN 
  Date is within 1 year 

You can then translate this into a signal by asking XMIM what happens to Home Depot 1 week later when the daily price closes beneath its Bollinger low band in the last year.

 SHOW 
     1: percent_move from today to 1 week later  of HD  
   WHEN 
       Date is within 1 year 
     AND 
       HD crosses below bollinger_low ( HD, 75 days, 1 )[4]
      Date   Day          1
 
02/22/2001   Thu     3.7500 
03/14/2001   Wed    -0.2883 
03/20/2001   Tue     3.5995 
04/11/2001   Wed     9.9036 
08/29/2001   Wed    -2.1489 
10/04/2001   Thu     9.9770 
10/29/2001   Mon     7.5867 
 
             Avg     4.6257 
          AvgPos     6.9634 
          AvgNeg    -1.2186 
          PctPos    71.4286 
          PctNeg    28.5714 
         Maximum     9.9770 
         Minimum    -2.1489 
          StdDev     4.7806 
           ZStat     0.9676 
        Variance    22.8540 
7 Occurrences

While this type of query can have many different applications, when used alone, it does not account for the amount of time that the price spends below/above the Bollinger band. In other words, just because the price drops below a certain level, doesn’t mean that it won’t stay below that level. A much more interesting application of XMIM allows the analyst to measure the number of days, historically, that HD has been below its Bollinger low band. Then, based on the number of days HD has been down below that band, shows the reaction for the following week.

On a theoretical level, you are taking into account not only that the price has dropped below a particular level, but also the time that the price continues to trade under that level. XMIM will loop through all combinations of days down and return the week later moves for each. For example, when HD was down below its 75 day Bollinger low band for 4 days, it is up 92% of the time the following week (please see the following page.)

In the example below: the variable “sumit” basically loops through and sums up the number of days in a row that the price of “theSec” has been below the Bollinger band and records them. The variable “theNumb” tells XMIM the number of days to loop through. I set it to no more than 20 days because the occurrences of the price lingering below the Bollinger band longer than that are too sparse. 20 days is probably an over-estimation as the number of occurrences normally starts dwindling into the single digits around 15. Again, this will completely depend on the standard deviation you are using and the number of days you specify for the moving average.

LET 
     theSec = HD
 
   LET 
     ATTR mark = IF 
                     theSec is less than bollinger_low ( theSec, 75 days, 1 ) 
                 THEN 1 
                 ENDIF  
 
   LET 
     ATTR sumit = IF 
                      mark is DEFINED 
                    AND 
                    1 day later 
                      mark is not DEFINED 
                  THEN sum from previous { 
                         mark is not DEFINED }  to today of mark  
                  ENDIF  
 
   LET 
     ATTR theNumb = 1 TO 20 BY 1 
 
   SHOW 
     1: sumit 
     2: percent_move from today to 1 week later  of theSec  
   WHEN 
       sumit is exactly theNumb
theNumb = 4.000000
 
      Date   Day          1          2
 
11/01/1990   Thu     4.0000     4.2917 
03/11/1992   Wed     4.0000     6.7346 
04/29/1992   Wed     4.0000     2.8282 
08/09/1994   Tue     4.0000    10.2485 
05/19/1995   Fri     4.0000     1.5625 
06/09/1995   Fri     4.0000    -1.2158 
09/01/1995   Fri     4.0000     5.3125 
09/15/1995   Fri     4.0000     1.5723 
12/31/1996   Tue     4.0000     2.4938 
08/10/1999   Tue     4.0000    11.3687 
03/08/2000   Wed     4.0000     8.5714 
10/09/2001   Tue     4.0000     9.8153 
 
             Avg     4.0000     5.2986 
          AvgPos     4.0000     5.8909 
          AvgNeg        NaN    -1.2158 
          PctPos   100.0000    91.6667 
          PctNeg     0.0000     8.3333 
         Maximum     4.0000    11.3687 
         Minimum     4.0000    -1.2158 
          StdDev     0.0000     4.0428 
           ZStat        NaN     1.3106 
        Variance     0.0000    16.3442 
 
12 Occurrences[5]
         

This technique gives the XMIM user more insight into the reaction of a security using a dynamic rather than a static signal. In other words, you can measure the duration of a signal through time instead of just one instance. This query can be augmented to use Bollinger high bands or other types of signals like moving average crossovers, correlations or spreads. For example, measure the number of days that a spread crosses above a certain level and show the following price reaction. You can also execute it using intra-day data and change “theNumb” to fractional instead of whole number increments thereby compiling answers on an hourly or even minute basis.



[3] The range recommendations are mentioned for relative purposes, using daily data. They are not intended to set hard, fast rules for Bollinger bands. There are trading scenarios that will require more extreme values for standard deviation and number of days especially when using tick data.

[4] HD is the stock ticker for Home Depot

[5] Answers are abbreviated