Category Volatility  Published on 13/02/2022

Average True Range pips

Description

Simple Average True Range

But in pips




v1 : code fix as stated by @emil.kupco


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 ATRPIPv1 : Indicator
    {
//
        [Parameter("MA Type")]
        public MovingAverageType matype { get; set; }

        [Parameter("Period", DefaultValue = 20)]
        public int atrper { get; set; }

        [Output("atrpips")]
        public IndicatorDataSeries Result { get; set; }


        AverageTrueRange atr;
        protected override void Initialize()
        {

            atr = Indicators.AverageTrueRange(atrper, matype);


        }

        public override void Calculate(int index)
        {

            Result[index] = atr.Result[index] / Symbol.PipSize;

        }
    }
}


fundspreader's avatar
fundspreader

Joined on 30.01.2017

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: ATR PIP v1.algo
  • Rating: 0
  • Installs: 2834
  • Modified: 13/02/2022 14:37
Comments
Log in to add a comment.
fundspreader's avatar
fundspreader · 2 years ago

Thank you for mentioning it

EM
emil.kupco · 3 years ago

You should probably check your code more carefully before releasing it. It is simple to fix but not everybody can probably do it ( see "matype" and "emaatr")

XE
xeulav · 3 years ago

Hello,

Very interesting indicator, could you please contact me on Telegram (username: xeulav).

Thanks a lot!