You are here:


This function is part of XTRADE functions group which is a collection of several technical indicators for creating technical trading rules. XTRADE.VOLATILITY calculates Close-to-Close or Open-High-Low-Close (OHLC) Garman and Klass volatility.


Due to many factors, over which we have no control, performance and/or outcomes may differ substantially from any estimates, projections or predictions that have been made by our services or functions. We use several software and services from sources believed to be reliable, however accuracy and completeness cannot be guaranteed. Loss of all or part of the original capital invested in an investment or investment strategy derived by these functions and/or services may occur. Any investments and/or transactions implied by our services or functions are done at your own risk.


AXCEL.XTRADE.VOLATILITY(stockprice, [n], [N], [meanZero], [dateFormat], [plot])

The AXCEL.XTRADE.VOLATILITY function syntax has the following arguments:

stockprice Required. This is a table of stock price. The format must be table of two columns, first column for time/date index and the second column. Here is an example:

DateClose Price

Or, it could be a table of five or six columns, including time/date, Open, High, Low, Close and Volume (optional), respectively. Here is an example:

DateOpenHighLowCloseVolume (optional)

If 5 column data is provided, this function uses OHLC data and applies Garman-Klass methodology for calculating volatility while a standard Close-Close volatility calculation is used when data is provided in 2 columns. Volume is not considered in calculations and will be used for visualization only. For both cases, the names of the columns are not restricted. However, the user must provide data columns in the same order presented before.

n Required. Number of periods for the volatility estimate.

N Optional. Number of periods per year. Default is 260.

meanZero Optional. If TRUE, use a mean of 0 rather than the sample mean. Default is FALSE.

dateFormat Optional. If the date in Date columns is Excel standard date format, you do not need to provide any format, and Axcel will automatically identify the date format and applies the conversion. However, if the date is provided in TEXT format, you should define the dateFormat for appropriate conversion. Here are the elements of the date format:

/ or - : Separators
%d: day
%m: month
%y: 2-digit year (for example 98 or 07)
%Y: 4-digit year (for example 1998 or 2007)

Here are some examples of the date format:

for "08/22/2019" : "%m/%d/%Y"
for "19/08/22" : "%y/%m/%d"
for "2019-08-22" : "%Y-%m-%d"

plot Optional. The default is FALSE. If you set it TRUE, Axcel provides you an advanced interactive visualization showing a candlestick chart (if you provide OHLC data as explained above) and volatilities.

Here is an example without Volume:

and if you provide Volume column, it will be included in your graph as example below:

when you type =AXCEL.XTRADE.VOLATILITY the Intellisense guides you through required and optional (shown in brackets []) entries as shown below:

In this example, we have:


which means that our data is located at cells from A1 to E300, we would like to have 10-day volatility estimates, the number of trading days per year is 260, volatility estimates are based on mean 0. Also, since we use Excel standard date format, we skipped the dateFormat entry and we would like to have visualization by setting the plot to TRUE. Here is the outcome:

As presented above, Axcel calculates volatilities and reports them in columns volatility. Since OHLC data is provided, calculations are based on Garman-Klass. Also, the outcome is visualized in the task pane and ready to be expanded in your browser. In this example, since this function needs a minimum of 10 days of historical records for calculation of volatility (we set n to 10), the first 9 records show NA after execution.

See also: All other AXCEL.XTRADE functions.