Ichimoku Kinko Hyo ind. smoothed by FIR free

by mfejza in category Trend at 08/09/2022
Description

Ichimoku Kinko Hyo indicator smoothed by FIR. 

FIR indicator (ctrader.com/algos/indicators/show/3081)

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
{
    [Cloud("SenkouSpanA", "SenkouSpanB")]
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class mIchimokuFIR : Indicator
    {
        [Parameter("Fast Period (9)", DefaultValue = 9)]
        public int inpPeriodFast { get; set; }
        [Parameter("Medium Period (26)", DefaultValue = 26)]
        public int inpPeriodMedium { get; set; }
        [Parameter("Fast Period (52)", DefaultValue = 52)]
        public int inpPeriodSlow { get; set; }
        [Parameter("Chikou Displacement (26)", DefaultValue = 26)]
        public int inpDisplacementChikou { get; set; }
        [Parameter("CloudDisplacement (26)", DefaultValue = 26)]
        public int inpDisplacementCloud { get; set; }

        [Output("TenkanSen", LineColor = "Red")]
        public IndicatorDataSeries outTenkanSen { get; set; }
        [Output("Kijunsen", LineColor = "Blue")]
        public IndicatorDataSeries outKijunSen { get; set; }
        [Output("ChikouSpan", LineColor = "DarkViolet")]
        public IndicatorDataSeries outChikouSpan { get; set; }
        [Output("SenkouSpanA", LineColor = "Green", LineStyle = LineStyle.Dots)]
        public IndicatorDataSeries outSenkouSpanA { get; set; }
        [Output("SenkouSpanB", LineColor = "Red", LineStyle = LineStyle.Dots)]
        public IndicatorDataSeries outSenkouSpanB { get; set; }

        double maxfast, minfast, maxmedium, minmedium, maxslow, minslow;
        private IndicatorDataSeries _firh;
        private IndicatorDataSeries _firl;
        private IndicatorDataSeries _firc;


        protected override void Initialize()
        {
            _firh = CreateDataSeries();
            _firl = CreateDataSeries();
            _firc = CreateDataSeries();
        }

        public override void Calculate(int index)
        {
            if (index < 4)
            {
                _firh[index] = Bars.HighPrices[index];
                _firl[index] = Bars.LowPrices[index];
                _firc[index] = Bars.ClosePrices[index];
            }
            else
            {
                _firh[index] = (Bars.HighPrices[index] + 2.0 * Bars.HighPrices[index - 1] + 2.0 * Bars.HighPrices[index - 2] + Bars.HighPrices[index - 3]) / 6.0;
                _firl[index] = (Bars.LowPrices[index] + 2.0 * Bars.LowPrices[index - 1] + 2.0 * Bars.LowPrices[index - 2] + Bars.LowPrices[index - 3]) / 6.0;
                _firc[index] = (Bars.ClosePrices[index] + 2.0 * Bars.ClosePrices[index - 1] + 2.0 * Bars.ClosePrices[index - 2] + Bars.ClosePrices[index - 3]) / 6.0;
            }

            if ((index < inpPeriodFast) || (index < inpPeriodSlow))
                return;

            maxfast = _firh[index];
            minfast = _firl[index];
            maxmedium = _firh[index];
            minmedium = _firl[index];
            maxslow = _firh[index];
            minslow = _firl[index];

            for (int i = 0; i < inpPeriodFast; i++)
            {
                if (maxfast < _firh[index - i])
                    maxfast = _firh[index - i];
                if (minfast > _firl[index - i])
                    minfast = _firl[index - i];
            }
            for (int i = 0; i < inpPeriodMedium; i++)
            {
                if (maxmedium < _firh[index - i])
                    maxmedium = _firh[index - i];
                if (minmedium > _firl[index - i])
                    minmedium = _firl[index - i];
            }
            for (int i = 0; i < inpPeriodSlow; i++)
            {
                if (maxslow < _firh[index - i])
                    maxslow = _firh[index - i];
                if (minslow > _firl[index - i])
                    minslow = _firl[index - i];
            }

            outTenkanSen[index] = (maxfast + minfast) / 2;
            outKijunSen[index] = (maxmedium + minmedium) / 2;
            outChikouSpan[index - inpDisplacementChikou] = _firc[index];
            outSenkouSpanA[index + inpDisplacementCloud] = (outTenkanSen[index] + outKijunSen[index]) / 2;
            outSenkouSpanB[index + inpDisplacementCloud] = (maxslow + minslow) / 2;
        }
    }
}
Comments

junealexis001 - September 12, 2022 @ 11:51

Interesting post i love it keep posting more!  https://paintersbatonrougela.com

SEOOO - November 25, 2022 @ 12:06

hggjhjhk

0