Category Trend  Published on 27/02/2023

Ichimoku Kinko Hyo ind. smoothed by FIR

Description

Ichimoku Kinko Hyo indicator smoothed by FIR. 

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


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; }
 
        private IndicatorDataSeries _firh, _firl, _firc, _tenkansen, _kijunsen, _chikouspan, _senkouspana, _senkouspanb;
 
 
        protected override void Initialize()
        {
            _firh = CreateDataSeries();
            _firl = CreateDataSeries();
            _firc = CreateDataSeries();
            _tenkansen = CreateDataSeries();
            _kijunsen = CreateDataSeries();
            _chikouspan = CreateDataSeries();
            _senkouspana = CreateDataSeries();
            _senkouspanb = CreateDataSeries();
        }
 
        public override void Calculate(int i)
        {
            _firh[i] = i>4 ? (Bars.HighPrices[i] + 2.0 * Bars.HighPrices[i-1] + 2.0 * Bars.HighPrices[i-2] + Bars.HighPrices[i-3]) / 6.0 : Bars.HighPrices[i];
            _firl[i] = i>4 ? (Bars.LowPrices[i] + 2.0 * Bars.LowPrices[i-1] + 2.0 * Bars.LowPrices[i-2] + Bars.LowPrices[i-3]) / 6.0 : Bars.LowPrices[i];
            _firc[i] = i>4 ? (Bars.ClosePrices[i] + 2.0 * Bars.ClosePrices[i-1] + 2.0 * Bars.ClosePrices[i-2] + Bars.ClosePrices[i-3]) / 6.0 : Bars.ClosePrices[i];

            _tenkansen[i] = (_firh.Maximum(inpPeriodFast) + _firl.Minimum(inpPeriodFast)) / 2;
            _kijunsen[i] = (_firh.Maximum(inpPeriodMedium) + _firl.Minimum(inpPeriodMedium)) / 2;
            _chikouspan[i] = _firc[i];
            _senkouspana[i] = (_tenkansen[i] + _kijunsen[i]) / 2;
            _senkouspanb[i] = (_firh.Maximum(inpPeriodSlow) + _firl.Minimum(inpPeriodSlow)) / 2;

            outTenkanSen[i] = _tenkansen[i];
            outKijunSen[i] = _kijunsen[i];
            outChikouSpan[i-inpDisplacementChikou] = _chikouspan[i];
            outSenkouSpanA[i+inpDisplacementCloud] = _senkouspana[i];
            outSenkouSpanB[i+inpDisplacementCloud] = _senkouspanb[i];
        }
    }
}

mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mIchimokuFIR.algo
  • Rating: 5
  • Installs: 987
  • Modified: 27/02/2023 08:29
Comments
Log in to add a comment.
MA
marryliaee · 1 year ago

play connect 4 entertainment after school with friends