Indicator that measures the actual volatility of the market.

Average True Range (ATR) measures the actual volatility of the market. It can be used for dynamic placing of Profit Target and Stop Loss actions. ATR is a moving average, generally covering 14 days of volatility measurements. It was created to allow traders to more accurately measure the daily volatility of an asset by using simple calculations. Indicator does not provide an indication of price direction, just volatility.

ATR does not provide an indication of price direction, just volatility. Trades can use shorter periods to have more actual value of ATR without lag. If they wish to analyze volatility of an asset over a period of five trading days, they could use five-day ATR on end-of-day data. Assuming the historical price data is arranged in reverse chronological order, the trader finds the maximum of the absolute value of the current high minus the current low, the absolute value of the current high minus the previous close, and the absolute value of the current low minus the previous close. These True Range (TR) calculations are used in creating a moving average and this is known as ATR. Typically, the ATR is based on 14 periods and can be calculated on an intraday, daily, weekly or monthly basis. For the following example, the ATR will be based on daily data.

$ATR = [(Prior ATR x (Period-1)) + Current TR] / Period$

Name | Type | Range of value | Description |

| int | <1, int.MaxValue> | Number of bars used in the calculation. |

Indicator ouptuts a single value.

Type | Range of value |

double | (0, double.MaxValue) |

// Prints the current value of a 20 period ATR using// the daily bars close price value.atr = indicators.ATR(20).OnSeries(dailyBars);Log("The current ATR value is " + atr.Value.ToString());â€‹// Prints the previous ATR valueatr = indicators.ATR(20).Keep(2).OnSeries(dailyBars);Log("The previous ATR value is " + atr.Values[1].ToString());

using Signals.DataSeries.Bars;using Signals.Framework;using Signals.Indicators.ATR;â€‹public class MyStrategy : SingleMarketStrategy{private Bars dailyBars;private ATR atr;â€‹public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators){dailyBars = data.Bars(BarPeriodType.Day, 1).WithOffset(25);atr = indicators.ATR(20).Keep(2).OnSeries(dailyBars);}â€‹public override void RegisterActions(){OnUpdateOf(dailyBars).Do(() =>{// Prints the current ATR valueLog("The current ATR value is " + atr.Value.ToString());â€‹// Prints the previous ATR valueLog("The previous ATR value is " + atr.Values[1].ToString());});}}

â€‹