Average True Range (ATR)
For a list of all members of this type, see ATR Members.
System.Object
RQuant.Indicator.TTimeArray
RQuant.Indicator.TDoubleArray
RQuant.Indicator.TIndicator
RQuant.Indicator.ATR
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
The Average True Range indicator identifies periods of high and low volatility in a market. High volatility describes a market with ongoing price fluctuation, whereas low volatility is used to label a market with little price activity. Measuring market volatility can help in identifying buy and sell signals and, additionally, risk potential. Markets with high price fluctuation offer more risk/reward potential, because prices rise and fall in a short time, giving the investor the opportunity to buy or sell at, supposedly, the right moment.
When a market becomes increasingly volatile, the ATR tends to peak rising in value, and during periods of little volatility, the ATR bottoms out decreasing in value. A market will usually keep the direction of the initial price move, though this is certainly not a rule. Analysts, therefore, tend to use Average True Range to measure market volatility and other technical indicators to help identify market direction.
This indicator is described in more details in the Steve Achelis' book "Technical Analysis from A to Z".
Note, that there are two styles of indicator ATR. Some trading systems use the formula (which is a little bit distinguished from classical) for calculation of this indicator. Therefore Quant Studio gives an opportunity to use two styles ATR - classical (QuantStudio style) and little bit changed (MetaStock style.)
ATR has QuantStudio style by Default.
Formula for Quant Studio (classical) style:
TDataManager.cd("Demo");
TDailyArray Daily1 = TDataManager.GetStock("YHOO").DailyArray;
DateTime Date1 = DateTime.Parse("1999/02/08");
DateTime Date2 = DateTime.Parse("2000/12/29");
TDailyArray Daily = Daily1.Clone(Date1, Date2);
TCanvas Canvas = new TCanvas("Canvas","ATR DEMO",600,400);
Canvas.Divide(1,2);
ATR ATR = new ATR(Daily, 14);
Canvas.cd(1);
Daily.Draw("c");
Canvas.cd(2);
ATR.Draw(Color.Red);
Formula for MetaStock style:
TDataManager.cd("Demo");
TDailyArray Daily1 = TDataManager.GetStock("YHOO").DailyArray;
DateTime Date1 = DateTime.Parse("1999/02/08");
DateTime Date2 = DateTime.Parse("2000/12/29");
TDailyArray Daily = Daily1.Clone(Date1, Date2);
EIndicatorStyle Style = EIndicatorStyle.MetaStock;
TCanvas Canvas = new TCanvas("Canvas","ATR DEMO",600,400);
Canvas.Divide(1,2);
ATR ATR = new ATR(Daily, 14, Style);
Canvas.cd(1);
Daily.Draw("c");
Canvas.cd(2);
ATR.Draw(Color.Red);
Namespace: RQuant.Indicator
Assembly: RQuant.Indicator (in RQuant.Indicator.dll)
ATR Members | RQuant.Indicator Namespace