CCI_TickVolume free

by Danis in category Trend at 21/03/2021
Description

CCI_TickVolume indicator use one combination of four of most used Forex indicators: Volume, Commodity Channel Index, Welles Wilder Smothing and as and add-on, independently from the indicator, the HeikenAshi signal status.

For more detalis please visit my website www.festkapital.de

 

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Indicators
{
    [Cloud("CCI Line", "Signal", Opacity = 0.4)]
    [Levels(0)]
    [Indicator(IsOverlay = false, AutoRescale = true, ScalePrecision = 3, AccessRights = AccessRights.None)]

    public class CCI_TickVolume : Indicator
    {
        [Parameter("CCI Periods", DefaultValue = 30)]
        public int cciPeriod { get; set; }
        [Parameter("WWS Period", DefaultValue = 8)]
        public int wwsPeriod { get; set; }
        [Parameter("TickVolume EMA Period", DefaultValue = 10)]
        public int tkePeriod { get; set; }
        [Parameter("TickVolume DEMA Period", DefaultValue = 10)]
        public int tkdPeriod { get; set; }
        [Parameter("TickVolume TEMA Period", DefaultValue = 5)]
        public int tktPeriod { get; set; }

        [Output("Up Bar", LineColor = "#FFAEDFC8", PlotType = PlotType.Histogram, Thickness = 5)]
        public IndicatorDataSeries upBar { get; set; }
        [Output("Down Bar", LineColor = "#FFFFBBBD", PlotType = PlotType.Histogram, Thickness = 5)]
        public IndicatorDataSeries downBar { get; set; }
        [Output("CCI Line", LineColor = "#FF16BB47", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries cciline { get; set; }
        [Output("Signal", LineColor = "#FFFF3236")]
        public IndicatorDataSeries wwsline { get; set; }
        [Output("Level 0", LineColor = "#9d159d", LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries level0 { get; set; }

        public IndicatorDataSeries tkv;
        public IndicatorDataSeries _xOpen, _xClose, _xHigh, _xLow;
        private IndicatorDataSeries UpTick, DnTick, TVI_Calculate;

        private ExponentialMovingAverage EMA_UpTick;
        private ExponentialMovingAverage EMA_DnTick;
        private ExponentialMovingAverage DEMA_UpTick;
        private ExponentialMovingAverage DEMA_DnTick;
        private ExponentialMovingAverage TVI;
        private CommodityChannelIndex cci;
        private WellesWilderSmoothing cci_wws;

        private double O, C, H, L;

        protected override void Initialize()
        {
            var index = Bars.ClosePrices.Count - 1;

            _xOpen = CreateDataSeries();
            _xClose = CreateDataSeries();
            _xHigh = CreateDataSeries();
            _xLow = CreateDataSeries();

            tkv = CreateDataSeries();
            UpTick = CreateDataSeries();
            DnTick = CreateDataSeries();
            TVI_Calculate = CreateDataSeries();

            cci = Indicators.CommodityChannelIndex(cciPeriod);
            cci_wws = Indicators.WellesWilderSmoothing(cci.Result, wwsPeriod);

            EMA_UpTick = Indicators.ExponentialMovingAverage(UpTick, tkePeriod);
            EMA_DnTick = Indicators.ExponentialMovingAverage(DnTick, tkePeriod);
            DEMA_UpTick = Indicators.ExponentialMovingAverage(EMA_UpTick.Result, tkdPeriod);
            DEMA_DnTick = Indicators.ExponentialMovingAverage(EMA_DnTick.Result, tkdPeriod);
            TVI = Indicators.ExponentialMovingAverage(TVI_Calculate, tktPeriod);
        }

        public override void Calculate(int index)
        {
            level0[index] = 0;

            wwsline[index] = cci_wws.Result[index];
            cciline[index] = cci.Result[index];

            UpTick[index] = (Bars.TickVolumes[index] + (Bars.ClosePrices[index] - Bars.OpenPrices[index]) / Symbol.TickSize) / 2;
            DnTick[index] = Bars.TickVolumes[index] - UpTick[index];

            TVI_Calculate[index] = 100 * ((DEMA_UpTick.Result[index] - DEMA_DnTick.Result[index]) / (DEMA_UpTick.Result[index] + DEMA_DnTick.Result[index]));
            tkv[index] = TVI.Result[index];

            if (tkv.IsRising())
            {
                upBar[index] = cci.Result[index];
            }
            else
            {
                downBar[index] = cci.Result[index];
            }

            O = Bars.OpenPrices[index];
            C = Bars.ClosePrices[index];
            H = Bars.HighPrices[index];
            L = Bars.LowPrices[index];

            var xClose = (((Math.Min(O, C) + L) / 2) + ((Math.Max(O, C) + H) / 2)) / 2;
            double xOpen;
            if (index > 7)
                xOpen = (_xOpen[index - 1] + _xClose[index - 1]) / 2;
            else
                xOpen = (O + C) / 2;

            _xClose[index] = xClose;
            _xOpen[index] = xOpen;
            _xHigh[index] = Math.Max(Math.Max(H, xOpen), xClose);
            _xLow[index] = Math.Min(Math.Min(L, xOpen), xClose);
        }
    }
}
Comments
0