Category Volatility  Published on 11/01/2022

Normalized ATR

Description

ATR (Average True Range) is usually used to assess volatility of the market.

But since it is not bounded, we can not really know if some extremes of the volatility (maximal or minimal, whichever we are looking for) is reached. This version is using a min/max normalization to attempt to add those bounds and thus, to add a criteria if minimum or maximum is reached

 


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ATRNorm : Indicator
    {
        [Parameter(DefaultValue = 14.0)]
        public int period { get; set; }

        [Parameter("Method", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType method { get; set; }

        [Output("Main")]
        public IndicatorDataSeries natr { get; set; }

        private AverageTrueRange atr;
        private Bars price;
        //   private IndicatorDataSeries natr;


        protected override void Initialize()
        {
            atr = Indicators.AverageTrueRange(period, method);
            //    natr=CreateDataSeries()

        }

        public override void Calculate(int index)
        {
            double atrMax = atr.Result.Maximum(period);
            double atrMin = atr.Result.Minimum(period);

            natr[index] = (atr.Result[index] - atrMin) / (atrMax - atrMin);
            //  natr[index] = 100 * atr.Result[index] / Bars.ClosePrices[index];
        }
    }
}


KA
kaneida84

Joined on 25.04.2021

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: ATRNorm.algo
  • Rating: 0
  • Installs: 1197
  • Modified: 11/01/2022 21:37
Comments
Log in to add a comment.
LI
libraana43 · 2 years ago

Normalized ATR is so essential for developing technical analysis for measuring the volatility level, which is so normalized to seeing but there is also very systematic and reliable dissertation writing London available to get from them all the way to the UK, London city reactively.