#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

Using Average True Range to Measure Intraday Volatility

Updated on 2013-03-21

Volatility is a measure that allows you to estimate the "risk" of an asset.

There are different types of volatility:
Implied volatility: This is the estimated volatility of an asset's price.
Historical volatility: This is the realized volatility of an asset over a specific time period. It is also called the statistical volatility.

For intraday traders and those looking for an easier way to measure volatility, you can use the true range to measure intraday volatility.

True Range

The True range indicator was developed by J. Welles Wilder Jr. in the 1970's. It is a better measure of the intraday volatility than the "Range" (which the difference between the session/period high and low) because the latter understates the volatility since it only measures volatility that occurs during a bar/session and ignores overnight volatility.
To fix this, the True Range uses the bar's high, low and previous bar's close. By combining these variables, the true range considers both the intraday and overnight part of the price's volatility.

The true range is calculated by taking the greatest of the following variables:
- High (current bar) less low
- High (current bar) less previous bar's close
- Previous bar's close less low (current bar)

Implementing the Average True Range Indicator

First, let us implement the different variables described in the previous paragraph then find which one is the greatest (true range).

a = high - low;
b = high - close[1];
c = close[1] - low;

tr = max(a, max(b, c));

To calculate the average true range (ATR), we simply apply a moving average to the true range.

d = sma(tr, 10);

This will return the 10-bar average true range.

Note that QuantShare already has a built-in function ("Atr") that calculates the average true range.

Example:
d = Atr(10);

How Day Traders Measure Intraday Volatility

Let us say you are working with one-minute data and you want to calculate the intraday volatility (Average true range based on session high, low and close).
As you might have guessed, the calculation of the intraday volatility must be based on daily data.

Steps:

- Change the time frame to daily

TimeframeSet(-1);

We use negative time frame to reference daily data when working with intraday data (1 = 1-day period = daily)

- Calculate the average true range of the previous 10 trading days

a = atr(10);

- Restore the default time frame (one-minute data)

TimeframeRestore();

- Decompress the result so that daily data is synchronized with the one-minute data

a = timeframedecompress(a);

The complete formula is as follows:

TimeframeSet(-1);
a = atr(10);
TimeframeRestore();
a = timeframedecompress(a);
plot(a, "ATR");

There is also another way to implement the same thing. Here is the formula:

b = TimeframeApply(-1, atr(10));
b = timeframedecompress(b);
plot(b, "ATR", colorGreen);

The "TimeframeApply" function calculates a specific series in a different time frame. It replaces the "TimeframeSet" and "TimeframeRestore" functions.

Example of Strategy Using the true range Indicator

Let us implement the following trading system:

- Buy when the intraday volatility as measured by ATR is increasing and when price crosses above 10-bar moving average
- Sell at the end of the trading session

Here is how to create a trading system:
How to create a trading system

And here is the formula that you should use to implement the above strategy:
rule1 = TimeframeApply(-1, atr(1) > ref(atr(1), 1)); // Ref: Reference previous bar's value
rule1 = timeframedecompress(rule1);
buy = rule1 and cross(close, sma(10));
sell = hour() >=16;

 no comments (Log in)

 Search Posts Recent Posts How to Create an Automated Trading System in QuantShare Posted 66 days ago QuantShare Trading Software: New Features in the 3.6.0 Version Posted 158 days ago 6 New Ways to Download Free Intraday Data for the U.S. Stock Market Posted 242 days ago Lock, Link and Undock your Charts Posted 295 days ago 10 New Ways to Download Historical Stock Quotes for Free Posted 395 days ago Introduction to the Events Monitor Tool Posted 493 days ago How to Adjust the Time Displayed in your Intraday Charts Posted 661 days ago Previous Posts Using Average True Range to Measure Intraday Volatility Posted 2194 days ago How to Backtest Your Trading System for Each Industry Posted 2202 days ago Create Profitable Trading Strategies with Exchange Traded Funds (ETFs) Posted 2215 days ago 3 Market Indicators based on Fundamental Data Posted 2228 days ago How to Send Commands to QuantShare from Excel or Other Applications Posted 2252 days ago How to make sure your Historical Price Data is Split Adjusted Posted 2258 days ago How to Select the Best Market Indicator for your Trading System Posted 2277 days ago 4 Market Composite Indicators Based on Industry Data Posted 2291 days ago Industry Analysis - How to Compare Stocks with their Industries Posted 2299 days ago How to Backtest Each Stock or Asset Individually Posted 2320 days ago QuantShare Programming Language Tutorial Posted 2327 days ago Sentiment Analysis: How to measure the sentiment score of your stock tweets Posted 2334 days ago Running QuantShare on Amazon's EC2 Cloud & Automate Strategies Signals Posted 2340 days ago

 Support Contact Us Trading Forum How-to Lessons Manual Company About Us Privacy Terms of Use Copyright © 2019 QuantShare.com Social Media Follow us on Facebook Follow us on Twitter

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.