Traders Dynamic Index CCI

by Jan in category Oscilator at 27/10/2019
Description

A combination of Commodity Channel Index , Bollinger Bands and Moving Averages.

This is my modification of the original Traders Dynamic Index https://ctrader.com/algos/indicators/show/215 (Thanks go to fzlogic !!). Original version uses RSI as the base indicator, I use CCI instead. Two MAs and BB values are calculated from CCI. 

CCI is a bit more responsive than RSI, so it is recommended to use higher period values than you would use in RSI. With CCI you get more signals which naturally result also more false signals.

 

Traditional Strategy:

Buy: The Price line is above the Signal line and above the middle Bollinger Band line.

Sell: The Signal line is above the Price line and middle Bollinger Band line.

--------------

Mean Reversion & Reversal Strategies:

Buy: Look for MAs upper-levels refusals, turnarounds & divergences 

Sell: Look for MAs lower-levels refusals, turnarounds & divergences 

--------------

The Bollinger Bands show the strength and direction of the trend.

--------------

More Advanced Strategy:

Look CCI to be below 0-level and below BB midline also look for weak CCI retrace where the price is not following CCI retrace - sell into this weakness. Use the opposite logic for buy.

 

Download
129 downloads
How to install
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.Indicators;

namespace cAlgo.Indicators
{
    [Levels(-200, -100, 0, 100, 200)]

    [Indicator(AccessRights = AccessRights.None)]
    public class TradersDynamicIndex_CCI : Indicator
    {
        private CommodityChannelIndex _CCI;
        private MovingAverage _price;
        private MovingAverage _signal;
        private BollingerBands _bollingerBands;


        [Parameter()]
        public DataSeries Source { get; set; }

        [Parameter("CCI Period", DefaultValue = 20)]
        public int CCIPeriod { get; set; }

        [Parameter("MA on CCI Price Period", DefaultValue = 2)]
        public int PricePeriod { get; set; }

        [Parameter("MA on CCI Signal Period", DefaultValue = 7)]
        public int SignalPeriod { get; set; }

        [Parameter("BB Period", DefaultValue = 34)]
        public int Volatility { get; set; }

        [Parameter("BB Adjustment", DefaultValue = 3)]
        public int adjustment { get; set; }


        [Parameter("BB Standard Deviations", DefaultValue = 1.8, Step = 0.1)]
        public double StDev { get; set; }

        [Parameter("Price Ma Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType PriceMaType { get; set; }

        [Parameter("Signal Ma Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType SignalMaType { get; set; }

        [Output("Upper Band", Color = Colors.Aquamarine)]
        public IndicatorDataSeries Up { get; set; }

        [Output("Lower Band", Color = Colors.Aquamarine)]
        public IndicatorDataSeries Down { get; set; }

        [Output("Middle Band", Color = Colors.Orange, Thickness = 2)]
        public IndicatorDataSeries Middle { get; set; }

        [Output("Price", Color = Colors.Green, Thickness = 2)]
        public IndicatorDataSeries PriceSeries { get; set; }

        [Output("Signal", Color = Colors.Red, Thickness = 2)]
        public IndicatorDataSeries SignalSeries { get; set; }

        //----------------------------------------------

        [Output("Level 1", Color = Colors.Gold, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries level1 { get; set; }

        [Output("Level -1", Color = Colors.Gold, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries mlevel1 { get; set; }

        [Output("Level 2", Color = Colors.Gold, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries level2 { get; set; }

        [Output("Level -2", Color = Colors.Gold, Thickness = 1, PlotType = PlotType.Points)]
        public IndicatorDataSeries mlevel2 { get; set; }

        [Output("ZeroLine", Color = Colors.Honeydew)]
        public IndicatorDataSeries zero { get; set; }

        protected override void Initialize()
        {

            _CCI = Indicators.CommodityChannelIndex(CCIPeriod);
            _bollingerBands = Indicators.BollingerBands(_CCI.Result, Volatility, StDev, MovingAverageType.Simple);
            _price = Indicators.MovingAverage(_CCI.Result, PricePeriod, PriceMaType);
            _signal = Indicators.MovingAverage(_CCI.Result, SignalPeriod, SignalMaType);


        }


        public override void Calculate(int index)
        {
            Up[index] = _bollingerBands.Top[index];
            Down[index] = _bollingerBands.Bottom[index];
            Middle[index] = _bollingerBands.Main[index];

            PriceSeries[index] = _price.Result[index];
            SignalSeries[index] = _signal.Result[index];

            level2[index] = 200;
            level1[index] = 100;
            zero[index] = 0;
            mlevel1[index] = -100;
            mlevel2[index] = -200;


        }


    }
}


Comments
0