Cumulative Delta Volume free

by cW22Trader in category Trend at 12/06/2022
Description

This is an cumulative volume indicator based of the version by LonesomeTheBlue on TradinbView:

Here is how to use it:

 

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("Close", "Open", FirstColor = "Lime", SecondColor = "Crimson")]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CumulativeDeltaVolume : Indicator
    {
        [Parameter("As Heiken Ashi", DefaultValue = false)]
        public bool AsHeikenAshi { get; set; }

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

        [Parameter("Show Bars", DefaultValue = true)]
        public bool ShowBars { get; set; }



        [Output("Open", PlotType = PlotType.DiscontinuousLine, LineColor = "Gray", Thickness = 1)]
        public IndicatorDataSeries Open { get; set; }

        [Output("Close", PlotType = PlotType.DiscontinuousLine, LineColor = "Gray", Thickness = 1)]
        public IndicatorDataSeries Close { get; set; }

        [Output("High", PlotType = PlotType.Points, LineColor = "Green", Thickness = 3)]
        public IndicatorDataSeries High { get; set; }

        [Output("Low", PlotType = PlotType.Points, LineColor = "Red", Thickness = 3)]
        public IndicatorDataSeries Low { get; set; }



        private IndicatorDataSeries delta;
        private IndicatorDataSeries cumDelta;
        private IndicatorDataSeries O;
        private IndicatorDataSeries C;
        private IndicatorDataSeries H;
        private IndicatorDataSeries L;
        private ExponentialMovingAverage ema;
        private int candleWidth;



        protected override void Initialize()
        {
            delta = CreateDataSeries();
            cumDelta = CreateDataSeries();
            O = CreateDataSeries();
            C = CreateDataSeries();
            H = CreateDataSeries();
            L = CreateDataSeries();

            ema = Indicators.ExponentialMovingAverage(cumDelta, Period);

            if (ShowBars)
            {
                UpdateVisibleCandles();

                Chart.ZoomChanged += OnZoomChanged;
                Chart.SizeChanged += OnSizeChanged;
                Chart.DragEnd += OnDragEnd;
                Chart.ScrollChanged += OnScrollChanged;
            }
        }

        void OnZoomChanged(ChartZoomEventArgs obj)
        {
            UpdateVisibleCandles();
        }

        void OnSizeChanged(ChartSizeEventArgs obj)
        {
            UpdateVisibleCandles();
        }

        void OnDragEnd(ChartDragEventArgs obj)
        {
            UpdateVisibleCandles();
        }

        void OnScrollChanged(ChartScrollEventArgs obj)
        {
            UpdateVisibleCandles();
        }

        public override void Calculate(int index)
        {
            double volume = Bars.TickVolumes[index];
            double open = Bars.OpenPrices[index];
            double close = Bars.ClosePrices[index];
            double high = Bars.HighPrices[index];
            double low = Bars.LowPrices[index];

            double topWick = high - Math.Max(open, close);
            double bottomWick = Math.Min(open, close) - low;
            double body = Math.Abs(close - open);

            delta[index] = ((topWick + bottomWick) / 2.0 + body) / (topWick + bottomWick + body);
            delta[index] = volume * (double.IsNaN(delta[index]) ? 0.5 : close >= open ? delta[index] : -delta[index]);

            double cumDeltaPrev = double.IsNaN(cumDelta[index - 1]) ? 0.0 : cumDelta[index - 1];
            cumDelta[index] = delta[index] + cumDeltaPrev;

            O[index] = ema.Result[index - 1];
            C[index] = ema.Result[index];
            H[index] = double.IsNaN(ema.Result[index - 1]) ? ema.Result[index] : Math.Max(ema.Result[index], ema.Result[index - 1]);
            L[index] = double.IsNaN(ema.Result[index - 1]) ? ema.Result[index] : Math.Min(ema.Result[index], ema.Result[index - 1]);

            if (AsHeikenAshi)
            {
                Open[index] = double.IsNaN(Open[index - 1]) ? (O[index] + C[index]) / 2.0 : (Open[index - 1] + Close[index - 1]) / 2.0;
                Close[index] = (O[index] + H[index] + L[index] + C[index]) / 4.0;
                High[index] = Math.Max(Math.Max(H[index], Open[index]), Close[index]);
                Low[index] = Math.Min(Math.Min(L[index], Open[index]), Close[index]);
            }
            else
            {
                Open[index] = O[index];
                Close[index] = C[index];
                High[index] = H[index];
                Low[index] = L[index];
            }

            if (ShowBars)
            {
                UpdateCandle(index);
            }
        }

        void UpdateVisibleCandles()
        {
            candleWidth = (int)(IndicatorArea.Width / (0.666 * Chart.MaxVisibleBars));
            candleWidth = candleWidth < 3 ? 3 : candleWidth;

            for (int i = Chart.FirstVisibleBarIndex; i <= Chart.LastVisibleBarIndex; i++)
            {
                UpdateCandle(i);
            }
        }

        void UpdateCandle(int index)
        {
            Color color = Open[index] > Close[index] ? Color.OrangeRed : Color.Lime;

            IndicatorArea.DrawTrendLine("line" + index, index, High[index], index, Low[index], color, 1, LineStyle.Solid);
            IndicatorArea.DrawTrendLine("candle" + index, index, Open[index], index, Close[index], color, candleWidth, LineStyle.Solid);
        }
    }
}
Comments

Annarose1700 - June 13, 2022 @ 05:47

Thank you for sharing a very meaningful article, I think it will be very helpful for me and everyone one. Play to Mahjong online free

ericnicholls99 - June 17, 2022 @ 06:02

Wordle's word limitless variant is Quordle. It's one of the most popular online games, with millions of participants worldwide.

drunkardmember - June 17, 2022 @ 11:07

have fun with games  Word Hurdle

miked54610 - June 20, 2022 @ 07:41

ADWEBSTUDIO

 

krapraneath123 - June 28, 2022 @ 11:58

Based on the version by LonesomeTheBlue on TradinbView, this  waffle game cumulative volume indicator: 

callumhowarth121 - July 04, 2022 @ 10:56

We are able to give you with an excellent Nursing Essay Writing Services that will undoubtedly satisfy all of your wants and specifications. Our experts have years of experience in this subject in many academic disciplines, and they have written papers for several institutions, high schools, and universities located all around the world. All of the work you see here will be completely free of plagiarism and grammatical problems because our authors proofread each piece numerous times.

lenkalee266 - July 04, 2022 @ 12:15

Thanks for sharing this article. I am glad to see this amazing post. Nerdle game

 

 

usessaywriterinfo - July 04, 2022 @ 12:40

Gosh! What was that! This was the first time in my life that I never understood a thing. This is why it’s said the work suits the one who is skilled to do so. Now; I must rush to buy services from https://www.ukassignmenthelp.uk/buy-assignment/ because I have the assignment to submit and I’ve not even placed my order as yet.

hamzamaq9166 - July 18, 2022 @ 18:10

The schedule is normative for the running of the shows for the jumpers. The sentiment of the Tools Dorset is bought for the goals. The purchase is fit for the offers. Target is consumed for the ruined report for the citizens.

junealexis001 - September 12, 2022 @ 12:06

Great site i love it keep posting more!   https://fencecompanyshreveport.com

0