Category Oscilators  Published on 19/06/2023

Williams Accumulation Distribution zones

Description

Williams Accumulation Distribution is traded on divergences. When the price makes a new high and the indicator fails to exceed its previous high, distribution is taking place. When the price makes a new low and the WAD fails to make a new low, accumulation is occurring.

Williams Accumulation Distribution was created by Larry Williams. 

In this custom version, you are able to identify zones price pressure equilibrium through smoothing with short and long-term pressure.



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

namespace cAlgo
{
    [Levels(0)]
    //[Cloud("MACD", "Signal", Opacity = 0.2, FirstColor = "FF7CFC00")]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mADzones : Indicator
    {
        [Parameter("Period Fast (5)", DefaultValue = 5)]
        public int inpPeriodFast { get; set; }
        [Parameter("Period Slow (34)", DefaultValue = 34)]
        public int inpPeriodSlow { get; set; }
        [Parameter("Smooth Type (sma)", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType inpSmoothType { get; set; }

        [Output("Fast Component", LineColor = "Red", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outFastComponent { get; set; }
        [Output("Slow Component", LineColor = "Black", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outSlowComponent { get; set; }
        
        private WilliamsAccumulationDistribution _AD;
        private MovingAverage _mafast, _maslow;
        private IndicatorDataSeries _deltafast, _deltaslow;
        

        protected override void Initialize()
        {
            _AD = Indicators.WilliamsAccumulationDistribution();
            _mafast = Indicators.MovingAverage(_AD.Result, inpPeriodFast, inpSmoothType);
            _maslow = Indicators.MovingAverage(_AD.Result, inpPeriodSlow, inpSmoothType);
            _deltafast = CreateDataSeries();
            _deltaslow = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _deltafast[i] = _mafast.Result[i] - _maslow.Result[i];
            _deltaslow[i] = _AD.Result[i] - _maslow.Result[i];
            
            outFastComponent[i] = _deltafast[i];
            outSlowComponent[i] = _deltaslow[i];
        }
    }
}



mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mADzones.algo
  • Rating: 0
  • Installs: 397
  • Modified: 21/11/2023 07:53
Comments
Log in to add a comment.
No comments found.