Signals Help Center
  • About Signals
  • Getting Started
    • Tutorials
      • Your First Strategy
        • Create a New Strategy
        • Define Variables
        • Define Setup Method
        • Define Register Actions Method
        • Backtest
        • Deploy Strategy & Start Receiving Signals
    • Dashboard
    • Strategies
      • Strategy Tools and Settings
        • Editor
        • Strategy Detail
        • Backtests
          • Backtest Detail
          • Deploying a Backtest
          • Delete a Backtest
        • Deployments
          • Deployment Detail
          • Edit About, Rules & Alternative Markets
          • Undeploy an Active Deployment
          • (Un)Publish a Deployment
          • (Un)Follow a Deployment
          • Delete a Deployment
        • Followings
          • Following Detail
          • Unfollow a Deployment
          • Delete Record of Following
      • Strategies Marketplace
        • Follow a Strategy
        • Publish Strategy
      • Strategy Details
      • Strategy Metrics
        • Initial Capital
        • Initial Capital (USDT)
        • Strategy Balance
        • Strategy Balance (USDT)
        • Total Performance
        • Total Performance (USDT)
      • Strategy Types
        • Single Market Strategy
        • Multi Market Strategy
    • Account
      • Change Plan
      • Change or Reset Password
      • Change Name, Username, or E-mail
  • Framework Documentation
    • Strategy
      • Methods
        • Setup()
          • DataMarketplace
          • IndicatorsMarketplace
        • RegisterActions()
        • Orders Management
          • CancelOrder()
          • CancelAllPendingOrders()
          • EnterLong()
          • EnterLongLimit()
          • EnterShort()
          • EnterLongStop()
          • EnterShortLimit()
          • ExitLong()
          • EnterShortStop()
          • ExitLongLimit()
          • ExitShort()
          • ExitShortLimit()
          • ExitLongStop()
          • ExitShortStop()
        • Risk Management
          • SetProfitTarget()
          • SetStopLoss()
      • Properties
        • Market
        • Markets
        • PendingOrders
        • Position
        • Time
      • Types
        • IOrder
        • PendingOrder
    • Data
    • Logs
  • Knowledge Base
    • Vocabulary
      • Base currency
      • Deployment
      • Following
      • Quote currency
      • Strategy
    • Technical Indicators
      • Oscillators
        • Average Directional Index (ADX)
        • Momentum Indicator (MOM)
        • Moving Average Convergence Divergence (MACD)
        • Relative Strength Index (RSI)
        • Stochastic RSI (STOCH RSI)
      • Volatility
        • Average True Range (ATR)
        • Bollinger Bands (BB)
      • Trend Analysis
        • Exponential Moving Average (EMA)
        • Simple Moving Average (SMA)
        • Volume-weighted Moving Average (VWMA)
        • Weighted Moving Average (WMA)
      • Volume
        • Accumulation/Distribution Line (ADL)
  • Have a question?
    • FAQ
    • Ask on the forums
    • Contact us
Powered by GitBook
On this page
  • Trading application
  • Calculation
  • Parameters
  • Examples
  1. Knowledge Base
  2. Technical Indicators
  3. Volatility

Average True Range (ATR)

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.

Trading application

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.

Calculation

ATR=[(PriorATRx(Periodāˆ’1))+CurrentTR]/PeriodATR = [(Prior ATR x (Period-1)) + Current TR] / PeriodATR=[(PriorATRx(Periodāˆ’1))+CurrentTR]/Period

Parameters

Input Parameters

Name

Type

Range of value

Description

period

int

<1, int.MaxValue>

Number of bars used in the calculation.

Output Parameters

Indicator ouptuts a single value.

Type

Range of value

double

(0, double.MaxValue)

Examples

// 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 value
atr = indicators.ATR(20).Keep(2).OnSeries(dailyBars);
Log("The previous ATR value is " + atr.Values[1].ToString());

Complete example

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 value
            Log("The current ATR value is " + atr.Value.ToString());

            // Prints the previous ATR value
            Log("The previous ATR value is " + atr.Values[1].ToString());
        });
    }
}

PreviousVolatilityNextBollinger Bands (BB)

Last updated 5 years ago