Category Other  Published on 05/02/2016

Cyf_Stochastic_ADX

Description

This is a combination of Stochastic Indicator and ADX component of the DMS system 

needles to say : when using ADX .. its not giving you direction but Strength of The trend 

 

Note: 

Because cAlgo can't choose colors based on Hex values & because of different color Schemes used traders

you should choose the colors of the ADX , try to choose a color with some Transparency .


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

namespace cAlgo
{
    [Indicator(IsOverlay = false, ScalePrecision = 0, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Cyf_Stochastic_ADX : Indicator
    {
        private DirectionalMovementSystem dms;
        private StochasticOscillator stoc;

        [Parameter(DefaultValue = 14)]
        public int ADX_Periods { get; set; }

        [Parameter("K_Periods", DefaultValue = 8, MinValue = 1)]
        public int K_Period { get; set; }

        [Parameter("Slow_K", DefaultValue = 3, MinValue = 2)]
        public int Slow_K { get; set; }

        [Parameter("D_Period", DefaultValue = 3, MinValue = 0)]
        public int D_Period { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MAType { get; set; }

        [Output("ADX", Color = Colors.Gray, PlotType = PlotType.Histogram, Thickness = 3)]
        public IndicatorDataSeries ADX { get; set; }

        [Output("%D", Color = Colors.Blue, PlotType = PlotType.Line, LineStyle = LineStyle.Lines)]
        public IndicatorDataSeries Percent_D { get; set; }

        [Output("%K", Color = Colors.Red)]
        public IndicatorDataSeries Percent_K { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators
            dms = Indicators.DirectionalMovementSystem(ADX_Periods);
            stoc = Indicators.StochasticOscillator(K_Period, Slow_K, D_Period, MAType);
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
            ADX[index] = dms.ADX.LastValue;
            Percent_K[index] = stoc.PercentK.LastValue;
            Percent_D[index] = stoc.PercentD.LastValue;

        }
    }
}


cyfer's avatar
cyfer

Joined on 27.09.2015

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Cyf_Stochastic_ADX.algo
  • Rating: 0
  • Installs: 3652
Comments
Log in to add a comment.
No comments found.