Category Other  Published on 28/01/2023

Japsian (IchimokuPlus)

Description

This indicator is based on "Ichimoku", and with its additional and useful features, it can help traders to get the right positions and help analysts to have an accurate analysis.
Additional features used in this indicator are:

  1. It has two extra KijunSen that user can adjust the period and properties of their lines.(eg 103 and 207)
  2. It has a QualityLine and DirectionLine, which is the same KijunSen that shift 26 Candle to the front and back.
    Using these two lines can be a great help in Trading and analysis.
  3. There is a separate "KijunSen" and "TenkanSen" With different settings for shifting forward or backward to the user's desired number
  4. Adjust and modify the Kumo and Chikou and TenkenSen and extra KijunSen and QualityLine and DirectionLine shift to the desired value.
  5. Adjust and change the color of the Kumo.
  6. Show the maximum and minimum Price lines for Last month on the chart.
    These two lines are very powerful and strong resistance and support.
  • All features above have the ability to enable or disable, And the user can change their properties, such as color, thickness and type of lines.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{

    [Indicator(IsOverlay = true, TimeZone = TimeZones.EasternStandardTime, AccessRights = AccessRights.None, AutoRescale = false)]
    [Cloud("Kumo Up", "Kumo Down", Opacity = 0.4), Cloud("Last Monthly", "Last Monthly Low", Opacity = 0.1)]

    public class Japsian : Indicator
    {

        #region parameters

        [Parameter("TenkanSen", DefaultValue = 9, MinValue = 1, Group = "Period")]
        public int TenkanSenPeriods { get; set; }

        [Parameter("KijunSen", DefaultValue = 26, MinValue = 1, Group = "Period")]
        public int KijunSenPeriods { get; set; }

        [Parameter("SenkouSpanB", DefaultValue = 52, MinValue = 1, Group = "Period")]
        public int SenkouSpanBPeriods { get; set; }

        [Parameter("KijunSen extra1", DefaultValue = 103, MinValue = 1, Group = "Period")]
        public int KijunSenExtra1Periods { get; set; }

        [Parameter("KijunSen extra2", DefaultValue = 207, MinValue = 1, Group = "Period")]
        public int KijunSenExtera2Periods { get; set; }

        [Parameter("TenkanSen +17", DefaultValue = 9, MinValue = 1, Group = "Period")]
        public int TenkanSen17Periods { get; set; }

        [Parameter("QualityLine", DefaultValue = 26, MinValue = 1, Group = "Period")]
        public int QualityLinePeriod { get; set; }

        [Parameter("DirectionLine", DefaultValue = 26, MinValue = 1, Group = "Period")]
        public int DirectionLinePeriod { get; set; }

        [Parameter("ChikouSpan Shift", DefaultValue = -26, MaxValue = 9999, Group = "Shift")]
        public int ChikouSpanShift { get; set; }

        [Parameter("Kumo Shift", DefaultValue = 26, MinValue = -9999, Group = "Shift")]
        public int KumoShift { get; set; }

        [Parameter("TenkanSen +17", DefaultValue = 17, MinValue = -9999, Group = "Shift")]
        public int TenkanSen17Shift { get; set; }

        [Parameter("QualityLine", DefaultValue = 26, MinValue = -9999, Group = "Shift")]
        public int QualityLineShift { get; set; }

        [Parameter("DirectionLine", DefaultValue = -26, MaxValue = 9999, Group = "Shift")]
        public int DirectionLineShift { get; set; }

        [Parameter("KijunSen extra1", DefaultValue = 0, MinValue = -9999, Group = "Shift")]
        public int KijunSenExtra1Shift { get; set; }

        [Parameter("KijunSen extra2", DefaultValue = 0, MinValue = -9999, Group = "Shift")]
        public int KijunSenExtra2Shift { get; set; }

        [Output("TenkanSen", PlotType = PlotType.Line, LineColor = "Red")]
        public IndicatorDataSeries TenkanSenResult { get; set; }

        [Output("KijunSen", PlotType = PlotType.Line, LineColor = "Blue")]
        public IndicatorDataSeries KijunSenResult { get; set; }

        [Output("ChikuSpan", PlotType = PlotType.Line, LineColor = "Green")]
        public IndicatorDataSeries ChikouSpanResult { get; set; }

        [Output("Kumo Up", PlotType = PlotType.Line, LineColor = "Green")]
        public IndicatorDataSeries KumoUpResult { get; set; }

        [Output("Kumo Down", PlotType = PlotType.Line, LineColor = "FFFF6666")]
        public IndicatorDataSeries KumoDownResult { get; set; }

        [Output("SenkouSpanA", PlotType = PlotType.Line, LineColor = "Green")]
        public IndicatorDataSeries SenkouSpanAResult { get; set; }

        [Output("SenkouSpanB", PlotType = PlotType.Line, LineColor = "FFFF6666")]
        public IndicatorDataSeries SenkouSpanBResult { get; set; }

        [Output("KijunSen extra1", PlotType = PlotType.Line, LineColor = "green")]
        public IndicatorDataSeries KijunSenExtra1Result { get; set; }

        [Output("KijunSen extra2", PlotType = PlotType.Line, LineColor = "orange")]
        public IndicatorDataSeries KijunSenExtra2Result { get; set; }

        [Output("Tenkan +17", PlotType = PlotType.Line, LineColor = "yellow")]
        public IndicatorDataSeries TenkanSen17Result { get; set; }

        [Output("QualityLine", PlotType = PlotType.Line, LineColor = "Black")]
        public IndicatorDataSeries QualityLineResult { get; set; }

        [Output("DirectionLine", PlotType = PlotType.Line, LineColor = "Purple")]
        public IndicatorDataSeries DirectionLineResult { get; set; }

        [Output("Last Monthly High", LineColor = "Gray", Thickness = 2, PlotType = PlotType.Line)]
        public IndicatorDataSeries LastMonthlyHigh { get; set; }

        [Output("Last Monthly Low", LineColor = "Gray", Thickness = 2, PlotType = PlotType.Line)]
        public IndicatorDataSeries LastMonthlyLow { get; set; }

        [Output("Last Monthly", LineColor = "Gray", Thickness = 1, PlotType = PlotType.Line)]
        public IndicatorDataSeries LastMonthly { get; set; }

        double maxfast, minfast, maxmedium, minmedium, maxmedium1, minmedium1,
        maxslow, minslow, maxslow1, minslow1, maxslow2, minslow2;

        #endregion

        #region Global Variables

        private Bars mseries2;
        private Bars mseries_mn;
        private int TimeframeIndex;
        private IchimokuKinkoHyo Ichimoku;
        #endregion

        protected override void Initialize()
        {
        // Initialize and create nested indicators
   
        Ichimoku = Indicators.IchimokuKinkoHyo( TenkanSenPeriods, KijunSenPeriods, SenkouSpanBPeriods);
            
            
                mseries2 = MarketData.GetBars(TimeFrame);
                mseries_mn = MarketData.GetBars(TimeFrame.Monthly);
            }

        
        //END METHOD INITIALIZE

        public override void Calculate(int index)
        {
            {
                TimeframeIndex = mseries_mn.OpenTimes.GetIndexByTime(mseries2.OpenTimes[index]);
                LastMonthlyHigh[index] = mseries_mn.HighPrices[TimeframeIndex - 1];
                LastMonthlyLow[index] = mseries_mn.LowPrices[TimeframeIndex - 1];
                LastMonthly[index] = mseries_mn.HighPrices[TimeframeIndex - 1];

            }

            if ((index < QualityLinePeriod) || (index < DirectionLinePeriod))
            {
                return;
            }

            maxfast = Bars.HighPrices[index];
            minfast = Bars.LowPrices[index];
            maxmedium = Bars.HighPrices[index];
            minmedium = Bars.LowPrices[index];
            maxmedium1 = Bars.HighPrices[index];
            minmedium1 = Bars.LowPrices[index];
            maxslow = Bars.HighPrices[index];
            minslow = Bars.LowPrices[index];
            maxslow1 = Bars.HighPrices[index];
            minslow1 = Bars.LowPrices[index];
            maxslow2 = Bars.HighPrices[index];
            minslow2 = Bars.LowPrices[index];
            maxmedium1 = Bars.HighPrices[index];
            minmedium1 = Bars.LowPrices[index];


         
            for (int i = 0; i < SenkouSpanBPeriods; i++)
            {
                if (maxslow < Bars.HighPrices[index - i])
                {
                    maxslow = Bars.HighPrices[index - i];
                }
                if (minslow > Bars.LowPrices[index - i])
                {
                    minslow = Bars.LowPrices[index - i];
                }
            }

            for (int i = 0; i < TenkanSen17Periods; i++)
            {
                if (maxfast < Bars.HighPrices[index - i])
                {
                    maxfast = Bars.HighPrices[index - i];
                }
                if (minfast > Bars.LowPrices[index - i])
                {
                    minfast = Bars.LowPrices[index - i];
                }
            }
            for (int i = 0; i < QualityLinePeriod; i++)
            {
                if (maxmedium < Bars.HighPrices[index - i])
                {
                    maxmedium = Bars.HighPrices[index - i];
                }
                if (minmedium > Bars.LowPrices[index - i])
                {
                    minmedium = Bars.LowPrices[index - i];
                }
            }
            for (int i = 0; i < DirectionLinePeriod; i++)
            {
                if (maxmedium1 < Bars.HighPrices[index - i])
                {
                    maxmedium1 = Bars.HighPrices[index - i];
                }
                if (minmedium1 > Bars.LowPrices[index - i])
                {
                    minmedium1 = Bars.LowPrices[index - i];
                }
            }
            for (int i = 0; i < KijunSenExtra1Periods; i++)
            {
                if (maxslow1 < Bars.HighPrices[index - i])
                {
                    maxslow1 = Bars.HighPrices[index - i];
                }
                if (minslow1 > Bars.LowPrices[index - i])
                {
                    minslow1 = Bars.LowPrices[index - i];
                }
            }
            for (int i = 0; i < KijunSenExtera2Periods; i++)
            {
                if (maxslow2 < Bars.HighPrices[index - i])
                {
                    maxslow2 = Bars.HighPrices[index - i];
                }
                if (minslow2 > Bars.LowPrices[index - i])
                {
                    minslow2 = Bars.LowPrices[index - i];
                }
            }

            TenkanSen17Result[index + TenkanSen17Shift] = ((maxfast + minfast) / 2);
            QualityLineResult[index + QualityLineShift] = ((maxmedium + minmedium) / 2);
            DirectionLineResult[index + DirectionLineShift] = ((maxmedium1 + minmedium1) / 2);
            KijunSenExtra1Result[index + KijunSenExtra1Shift] = ((maxslow1 + minslow1) / 2);
            KijunSenExtra2Result[index + KijunSenExtra2Shift] = ((maxslow2 + minslow2) / 2);

            TenkanSenResult[index] = Ichimoku.TenkanSen[index];
            KijunSenResult[index] = Ichimoku.KijunSen[index];
            ChikouSpanResult[index + ChikouSpanShift] = Bars.ClosePrices[index];
            SenkouSpanAResult[index + KumoShift] = (TenkanSenResult[index] + KijunSenResult[index]) / 2;
            SenkouSpanBResult[index + KumoShift] = ((maxslow + minslow) / 2);
            KumoUpResult[index + KumoShift] = (TenkanSenResult[index] + KijunSenResult[index]) / 2;
            KumoDownResult[index + KumoShift] = ((maxslow + minslow) / 2);

        }
        //END METHOD CALCULATE
    }
    //END class DisplayDWMPipsonCharts
}
//END namespace cAlgo



ichimoku.trader's avatar
ichimoku.trader

Joined on 27.03.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Japsian.algo
  • Rating: 5
  • Installs: 863
Comments
Log in to add a comment.
matfx's avatar
matfx · 1 year ago

Thanks for sharing. Interesting piece of indicator. It does help people that solely using ichimoku kinko hyo trading strategy