Category Volatility  Published on 20/08/2014

ATR in Deposit Currency

Description

ATR in Deposit Currency is nothing other than the ATR indicator, but its values ​​are expressed in money.

Parameters:

  • Period - ATR period
  • MAType - Moving average type for ATR
  • Volume - volume for transfer rate movement to money

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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ATRinDepositCurrency : Indicator
    {
        private AverageTrueRange _atr;

        [Parameter(DefaultValue = 14)]
        public int Period { get; set; }

        [Parameter(DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MAType { get; set; }

        [Parameter(DefaultValue = 10000)]
        public int Volume { get; set; }

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

        protected override void Initialize()
        {
            _atr = Indicators.AverageTrueRange(Period, MAType);
        }

        public override void Calculate(int index)
        {
            Result[index] = _atr.Result[index] * Volume * (Symbol.PipValue / Symbol.PipSize);
        }
    }
}


modarkat's avatar
modarkat

Joined on 25.12.2013

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: ATR in Deposit Currency.algo
  • Rating: 0
  • Installs: 3366
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
No comments found.