Average RSI CCI Stochastic DeMarker & MF

by Jan in category Oscilator at 03/11/2019
Description

This indicator is a combination of RSI, CCI, Stochastic, DeMarker and Money Flow indicators
Indicator simply calculates the averaged values with adjustable weighting.

Stochastics is calculated from K% only.

CCI is capped at +-200, and has the lowest weight (1) due to having 4X the range of the other oscillators.(Issue fixed with Version update: 20191106, no more need for X4 weighting)

You can omit oscillator by inputting weight = 0.

Version update: 20191106:

Normalised CCI values to fit between 0-100

Added "Multiply All Periods" parameter, which will multiply all oscillator periods by the chosen value

Download
103 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

/*
This indicator is a combination of RSI, CCI, Stochastics, DeMarker and Money Flow indicators
Indicator simply calculates the averaged values with adjustable weighting.

Stochastics is calculated from K% only.

CCI is capped at +-200, and has the lowest weight (1) due to having 4X the range of the other oscillators.

You can omit oscillator by inputting weight = 0.

Version update: 20191106:

Normalised CCI values to fit between 0-100

Added "Multiply All Periods" parameter, which will multiply all oscillator periods by chosen value
*/

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

namespace cAlgo.Indicators
{

    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
    public class AverageRSI_CCI_Stoch_DeMarker_MoneyFlow : Indicator
    {



        [Parameter("Stochastic Period", DefaultValue = 9)]
        public int StochPeriod { get; set; }

        [Parameter("Stochastic K% Smooth", DefaultValue = 3)]
        public int KSmooth { get; set; }

        [Parameter("RSI Period:", DefaultValue = 14)]
        public int Period { get; set; }

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

        [Parameter("DeMarker Period", DefaultValue = 14)]
        public int DEMPeriod { get; set; }

        [Parameter("Money Flow Period", DefaultValue = 14)]
        public int MFPeriod { get; set; }

        [Parameter("** Stoch Weight", DefaultValue = 1)]
        public double StochWeight { get; set; }

        [Parameter("** RSI Weight", DefaultValue = 1)]
        public double RSIWeight { get; set; }

        [Parameter("** CCI Weight", DefaultValue = 1)]
        public double CCIWeight { get; set; }

        [Parameter("** DeMarker Weight", DefaultValue = 1)]
        public double DEMWeight { get; set; }

        [Parameter("** Money Flow Weight", DefaultValue = 1)]
        public double MFWeight { get; set; }

        [Parameter("Multiply All Periods", DefaultValue = 1, MinValue = 1)]
        public int MultAll { get; set; }

        [Parameter("Levels 1", DefaultValue = 70)]
        public int Level1 { get; set; }



        [Output("level 80", Color = Colors.Yellow, LineStyle = LineStyle.Dots, PlotType = PlotType.Line, Thickness = 2)]
        public IndicatorDataSeries level80 { get; set; }
        [Output("level 20", Color = Colors.Yellow, LineStyle = LineStyle.Dots, PlotType = PlotType.Line, Thickness = 2)]
        public IndicatorDataSeries level20 { get; set; }

        [Output("leve 50", Color = Colors.PeachPuff, LineStyle = LineStyle.Dots, PlotType = PlotType.Line, Thickness = 2)]
        public IndicatorDataSeries level50 { get; set; }

        [Output("Average Result", Color = Colors.Lime, PlotType = PlotType.Line, Thickness = 2)]
        public IndicatorDataSeries AverageResult { get; set; }

        private RelativeStrengthIndex rsi;
        private CommodityChannelIndex CCI;
        private StochasticOscillator Stoch;

        private IndicatorDataSeries deMin;
        private IndicatorDataSeries deMax;
        private MovingAverage deMinMA;
        private MovingAverage deMaxMA;
        private IndicatorDataSeries DMark;

        private MoneyFlowIndex moneyflow;

        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {

            deMin = CreateDataSeries();
            deMax = CreateDataSeries();
            deMinMA = Indicators.MovingAverage(deMin, DEMPeriod * MultAll, MovingAverageType.Simple);
            deMaxMA = Indicators.MovingAverage(deMax, DEMPeriod * MultAll, MovingAverageType.Simple);
            DMark = CreateDataSeries();


            Stoch = Indicators.StochasticOscillator(StochPeriod * MultAll, KSmooth, 0, MovingAverageType.Simple);
            CCI = Indicators.CommodityChannelIndex(CCIPeriod * MultAll);
            rsi = Indicators.RelativeStrengthIndex(MarketSeries.Typical, Period * MultAll);
            moneyflow = Indicators.MoneyFlowIndex(MFPeriod * MultAll);

        }

        public override void Calculate(int index)
        {


            deMin[index] = Math.Max(MarketSeries.Low[index - 1] - MarketSeries.Low[index], 0);
            deMax[index] = Math.Max(MarketSeries.High[index] - MarketSeries.High[index - 1], 0);

            var min = deMinMA.Result[index];
            var max = deMaxMA.Result[index];

            DMark[index] = max / (min + max);

            if (CCI.Result[index] >= 0)
            {
                CCI.Result[index] = Math.Min(CCI.Result[index], 200);
            }

            if (CCI.Result[index] < 0)
            {
                CCI.Result[index] = Math.Max(CCI.Result[index], -200);
            }

            CCI.Result[index] = (CCI.Result[index] / 4) + 50;


            AverageResult[index] = ((moneyflow.Result[index] * MFWeight) + (DMark[index] * 100 * DEMWeight) + (rsi.Result[index] * RSIWeight) + (CCI.Result[index] * CCIWeight) + (Stoch.PercentK[index] * StochWeight)) / (MFWeight + DEMWeight + RSIWeight + CCIWeight + StochWeight);



            level80[index] = Level1;
            level50[index] = 50;
            level20[index] = (100 - Level1);
        }
    }
}




Comments

jedimaster - November 06, 2019 @ 03:55

Very interesting approach, thanks for sharing. The difficult part now is to find out the right setting for each of the various inputs for a specific TF. 

Jan - November 06, 2019 @ 12:08

Now with the update and normalized CCI values indicator should be better. (CCi negative values influenced average too much even when capped to -+200 ). Now no need by default to weight other oscillators.

You can also use "Multiply All Periods"  to see longer term momentum

Jan - November 06, 2019 @ 12:12

... but the truth is no indicator will help one much, unless one understands the market maker dynamics and games... :)

jedimaster - November 10, 2019 @ 11:24

There is a kind of myth, a kind of Graal search of the "ultimate" indicator able to read the market whatever the market state or the instrument you're trading. Averaging is a way to have a more robust approach in these different conditions. I suggest adding a signal moving average (Period and MaType) on the average result to visualize, breakout or retracement in addition to the existing OB, OS and pivot levels.

0