Category Volatility  Published on 05/08/2023

Normalized Volume indicator

An update for this algorithm is currently pending moderation. Please revisit this page shortly to access the algorithm's latest version.
Description

Normalized Volume is an indicator showing the normalized volume value. 

It displays the average volume within the bars range, in the form of a colored histogram with a threshold value.




mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mVolumeNormalised.algo
  • Rating: 5
  • Installs: 865
  • Modified: 05/08/2023 21:09
Comments
Log in to add a comment.
mfejza's avatar
mfejza · 1 year ago
using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

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

        [Output("normalised volume",LineColor = "Gray", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outVolumeNorm { get; set; }
        [Output("normalised volume into volatility", LineColor = "#008000", PlotType = PlotType.Histogram, LineStyle = LineStyle.Solid, Thickness = 3)]
        public IndicatorDataSeries outVolumeNormVolatil { get; set; }
        [Output("normalised volume into range", LineColor = "#ff0000", PlotType = PlotType.Histogram, LineStyle = LineStyle.Solid, Thickness = 3)]
        public IndicatorDataSeries outVolumeNormRange { get; set; }  
        
        private MovingAverage _vsmooth;        
        private IndicatorDataSeries _volnorm;
        

        protected override void Initialize()
        {
            _vsmooth = Indicators.MovingAverage(Bars.TickVolumes, inpPeriods, MovingAverageType.Simple);
            _volnorm = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _volnorm[i] = Bars.TickVolumes[i] / _vsmooth.Result[i] * 100;
            
            outVolumeNorm[i] = _volnorm[i];
            outVolumeNormVolatil[i] = _volnorm[i]>=100 ? _volnorm[i] : 0;
            outVolumeNormRange[i] = _volnorm[i]<100 ? _volnorm[i] : 0;
        }
    }
}