Category Volatility  Published on 07/02/2023

QMASMAdelta indicator

Description

QMASMAdelta is a volatility indicator based on the quadratic moving average and this indicator is compared it with standard deviation indicator, but is a bit more sensitive in price.


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

namespace cAlgo
{
    [Levels(0)]
    [Indicator(AccessRights = AccessRights.None)]
    public class mQMASMAdelta : Indicator
    {
        [Parameter("Periods (14)", DefaultValue = 100)]
        public int inpPeriods { get; set; }

        [Output("QMA/SMA Delta", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 2)]
        public IndicatorDataSeries outQMASMAdelta { get; set; }
        
        private SimpleMovingAverage _sma, _pma;
        private IndicatorDataSeries _pow;
        

        protected override void Initialize()
        {
            _pow = CreateDataSeries();
            _sma = Indicators.SimpleMovingAverage(Bars.ClosePrices, inpPeriods);
            _pma = Indicators.SimpleMovingAverage(_pow, inpPeriods);
        }

        public override void Calculate(int i)
        {
            _pow[i] = Math.Pow(Bars.ClosePrices[i],2);
            
            outQMASMAdelta[i] = (Math.Sqrt(_pma.Result[i]) - _sma.Result[i]) / Symbol.TickSize;
        }
    }
}

mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mQMASMAdelta.algo
  • Rating: 5
  • Installs: 638
  • Modified: 07/02/2023 12:34
Comments
Log in to add a comment.
SP
spearira · 1 year ago

Re: snake game

That's right! It's a little more price sensitive.

WE
weelmedia · 1 year ago

Thank you for your post. I have read through several similar topics! However, your article gave me a very special impression, unlike other articles. I hope you continue to have valuable articles like this or more to share with everyone! trap the cat