Cross Tenkansen and Kijunsen display indicator in the form of a histogram

Created at 24 Feb 2023, 01:38
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
hamed.karimi20's avatar

hamed.karimi20

Joined 13.04.2020

Cross Tenkansen and Kijunsen display indicator in the form of a histogram
24 Feb 2023, 01:38


Hello friends
I wanted to see if anyone has Cross Tenkensen and Kijunsen indicators that can be displayed in the form of a histogram at the bottom of the chart?
I want it to be similar to this indicator in MetaTrader 4

https://drive.google.com/file/d/1ghlbCVZ1XAHA9nZ3cb4k8frmzw4t7JTH/view?usp=share_link

 

I created this code, but I encountered these errors!
Can anyone help me fix these errors?

error CS0264 and error CS1501

............................................................................................

using System;
using cAlgo.API;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class IchimokuHistogram : Indicator
    {
        private IchimokuKinkoHyo _ichimoku;

        [Parameter("TenkanSen Periods", DefaultValue = 9)]
        public int TenkanSenPeriods { get; set; }

        [Parameter("KijunSen Periods", DefaultValue = 26)]
        public int KijunSenPeriods { get; set; }

        [Parameter("Histogram Bar Size", DefaultValue = 1)]
        public double BarSize { get; set; }

        [Output("Histogram", Color = Colors.Green)]
        public IndicatorDataSeries Histogram { get; set; }

        protected override void Initialize()
        {
            _ichimoku = Indicators.IchimokuKinkoHyo(TenkanSenPeriods, KijunSenPeriods);
        }

        public override void Calculate(int index)
        {
            if (_ichimoku.KijunSen.Result[index] > _ichimoku.TenkanSen.Result[index] && _ichimoku.KijunSen.Result[index - 1] <= _ichimoku.TenkanSen.Result[index - 1])
            {
                Histogram[index] = (_ichimoku.KijunSen.Result[index] - _ichimoku.TenkanSen.Result[index]) / BarSize;
            }
            else if (_ichimoku.KijunSen.Result[index] < _ichimoku.TenkanSen.Result[index] && _ichimoku.KijunSen.Result[index - 1] >= _ichimoku.TenkanSen.Result[index - 1])
            {
                Histogram[index] = (_ichimoku.TenkanSen.Result[index] - _ichimoku.KijunSen.Result[index]) / BarSize;
            }
            else
            {
                Histogram[index] = 0;
            }
        }
    }
}

 


@hamed.karimi20