Rainbow3 free

by srm_bcn in category Trend at 21/03/2021
Description

Rainbow3 projects the calculated lines as possible supports in search of possible resistances.

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
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Rainbow3 : Indicator
    {
        [Parameter(DefaultValue = 15)]
        public int Periods { get; set; }

        [Output("Result1", LineColor = "White")]
        public IndicatorDataSeries Result1 { get; set; }

        [Output("Result2", LineColor = "DimGray")]
        public IndicatorDataSeries Result2 { get; set; }

        [Output("Result3", LineColor = "DimGray")]
        public IndicatorDataSeries Result3 { get; set; }

        [Output("Result4", LineColor = "DimGray")]
        public IndicatorDataSeries Result4 { get; set; }

        [Output("Result5", LineColor = "DimGray")]
        public IndicatorDataSeries Result5 { get; set; }

        [Output("Result6", LineColor = "DimGray")]
        public IndicatorDataSeries Result6 { get; set; }

        [Output("Result7", LineColor = "DimGray")]
        public IndicatorDataSeries Result7 { get; set; }

        [Output("Result8", LineColor = "DimGray")]
        public IndicatorDataSeries Result8 { get; set; }

        [Output("Result9", LineColor = "DimGray")]
        public IndicatorDataSeries Result9 { get; set; }

        [Output("Result10", LineColor = "DimGray")]
        public IndicatorDataSeries Result10 { get; set; }

        [Output("Result11", LineColor = "DimGray")]
        public IndicatorDataSeries Result11 { get; set; }

        [Output("Result12", LineColor = "DimGray")]
        public IndicatorDataSeries Result12 { get; set; }

        [Output("Result13", LineColor = "DimGray")]
        public IndicatorDataSeries Result13 { get; set; }

        [Output("Result14", LineColor = "DimGray")]
        public IndicatorDataSeries Result14 { get; set; }

        [Output("Result15", LineColor = "DimGray")]
        public IndicatorDataSeries Result15 { get; set; }

        [Output("Result16", LineColor = "DimGray")]
        public IndicatorDataSeries Result16 { get; set; }

        [Output("Result17", LineColor = "DimGray")]
        public IndicatorDataSeries Result17 { get; set; }

        [Output("Result18", LineColor = "DimGray")]
        public IndicatorDataSeries Result18 { get; set; }

        [Output("Result19", LineColor = "DimGray")]
        public IndicatorDataSeries Result19 { get; set; }

        private SimpleMovingAverage sma1;
        private SimpleMovingAverage sma2;
        private SimpleMovingAverage sma3;
        private SimpleMovingAverage sma4;
        private SimpleMovingAverage sma5;
        private SimpleMovingAverage sma6;
        private SimpleMovingAverage sma7;
        private SimpleMovingAverage sma8;
        private SimpleMovingAverage sma9;
        private SimpleMovingAverage sma10;

        protected override void Initialize()
        {
            sma1 = Indicators.SimpleMovingAverage(Bars.ClosePrices, Periods);
            sma2 = Indicators.SimpleMovingAverage(sma1.Result, Periods);
            sma3 = Indicators.SimpleMovingAverage(sma2.Result, Periods);
            sma4 = Indicators.SimpleMovingAverage(sma3.Result, Periods);
            sma5 = Indicators.SimpleMovingAverage(sma4.Result, Periods);
            sma6 = Indicators.SimpleMovingAverage(sma5.Result, Periods);
            sma7 = Indicators.SimpleMovingAverage(sma6.Result, Periods);
            sma8 = Indicators.SimpleMovingAverage(sma7.Result, Periods);
            sma9 = Indicators.SimpleMovingAverage(sma8.Result, Periods);
            sma10 = Indicators.SimpleMovingAverage(sma9.Result, Periods);
        }

        public override void Calculate(int index)
        {
            Result1[index] = sma1.Result[index];
            Result2[index] = sma2.Result[index];
            Result3[index] = sma3.Result[index];
            Result4[index] = sma4.Result[index];
            Result5[index] = sma5.Result[index];
            Result6[index] = sma6.Result[index];
            Result7[index] = sma7.Result[index];
            Result8[index] = sma8.Result[index];
            Result9[index] = sma9.Result[index];
            Result10[index] = sma10.Result[index];
            Result11[index] = sma1.Result[index] + sma1.Result[index] - sma2.Result[index];
            Result12[index] = sma1.Result[index] + sma1.Result[index] - sma3.Result[index];
            Result13[index] = sma1.Result[index] + sma1.Result[index] - sma4.Result[index];
            Result14[index] = sma1.Result[index] + sma1.Result[index] - sma5.Result[index];
            Result15[index] = sma1.Result[index] + sma1.Result[index] - sma6.Result[index];
            Result16[index] = sma1.Result[index] + sma1.Result[index] - sma7.Result[index];
            Result17[index] = sma1.Result[index] + sma1.Result[index] - sma8.Result[index];
            Result18[index] = sma1.Result[index] + sma1.Result[index] - sma9.Result[index];
            Result19[index] = sma1.Result[index] + sma1.Result[index] - sma10.Result[index];
        }
    }
}
Comments
0