Kijun-Sen free

by kaneida84 in category Trend at 23/05/2021
Description

Just Kijun-Sen from Ichimoku system. Plain and simple

Shift option is added and 2 different modes for calculation

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 KijunSen : Indicator
    {

        public enum Mode
        {

            Close,
            HighLow

        }

        [Parameter("Period", DefaultValue = 26)]
        public int Period { get; set; }
        [Parameter("Shift", DefaultValue = 0)]
        public int shift { get; set; }

        [Parameter("Mode", DefaultValue = Mode.HighLow)]
        public Mode Moden { get; set; }


        [Output("Middle", LineColor = "Gray", PlotType = PlotType.Line, LineStyle = LineStyle.LinesDots, Thickness = 1)]
        public IndicatorDataSeries MiddleResult { get; set; }

        private double UpperResult;
        private double LowerResult;

        protected override void Initialize()
        {


        }

        public override void Calculate(int index)
        {

            UpperResult = (Moden == Mode.Close) ? Bars.ClosePrices.Maximum(Period) : Bars.HighPrices.Maximum(Period);
            LowerResult = (Moden == Mode.Close) ? Bars.ClosePrices.Minimum(Period) : Bars.LowPrices.Minimum(Period);

            MiddleResult[index + shift + 1] = LowerResult + ((UpperResult - LowerResult) / 2);

        }

    }

}
Comments
0