Click here to Login




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)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1449 days ago

Profile Graphs
Posted 1554 days ago

QuantShare
Previous Posts

More Posts

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



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.