IchimokuKinkoHyo wrong or no value for ChikouSpan

Created at 30 Apr 2016, 11:41
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!
FX

fxsilversurfer

Joined 30.04.2016

IchimokuKinkoHyo wrong or no value for ChikouSpan
30 Apr 2016, 11:41


Hi,

  I'm trying to use the IchimokuKinkoHyo indicator in a cBot but it looks like the value returned for the ChikouSpan is either wrong (always the same as the price) or a NaN.

I'm using the latest version of cAlgo downloaded from spotware's site: v1.35.64939

I've also try it in my FxPro branded cAlgo as provided by FxPro, with the exact same results: v1.34.64939

Here's the test cBot I'm using to get all the values for the IchimokuKinkoHyo, can you please tell me how can I get the correct values on each Tick or Bar?

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class IchimokuKinkoHyoTest : Robot
    {
        [Parameter("Tenkan Sen Periods", DefaultValue = 9)]
        public int TenkanSenPeriods { get; set; }

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

        [Parameter("Senkou SpanB Periods", DefaultValue = 52)]
        public int SenkouSpanBPeriods { get; set; }

        private IchimokuKinkoHyo ichimoku;

        protected override void OnStart()
        {
            ichimoku = Indicators.IchimokuKinkoHyo(TenkanSenPeriods, KijunSenPeriods, SenkouSpanBPeriods);
        }

        protected override void OnTick()
        {
            Print("******************************************************************");
            Print("Symbol.Bid=" + Symbol.Bid);
            Print("Symbol.Ask=" + Symbol.Ask);

            var index = MarketSeries.Close.Count - 1;

            Print("ichimoku.ChikouSpan[" + index + "]=" + ichimoku.ChikouSpan[index]);
            Print("ichimoku.KijunSen[" + index + "]=" + ichimoku.KijunSen[index]);
            Print("ichimoku.SenkouSpanA[" + index + "]=" + ichimoku.SenkouSpanA[index]);
            Print("ichimoku.SenkouSpanB[" + index + "]=" + ichimoku.SenkouSpanB[index]);
            Print("ichimoku.TenkanSen[" + index + "]=" + ichimoku.TenkanSen[index]);

            Print("ichimoku.ChikouSpan.LastValue=" + ichimoku.ChikouSpan.LastValue);
            Print("ichimoku.KijunSen.LastValue=" + ichimoku.KijunSen.LastValue);
            Print("ichimoku.SenkouSpanA.LastValue=" + ichimoku.SenkouSpanA.LastValue);
            Print("ichimoku.SenkouSpanB.LastValue=" + ichimoku.SenkouSpanB.LastValue);
            Print("ichimoku.TenkanSen.LastValue=" + ichimoku.TenkanSen.LastValue);

        }
    }
}

Many thanks!


@fxsilversurfer
Replies

... Deleted by UFO ...

fxsilversurfer
02 May 2016, 17:42

RE:

Thanks!

I suppose that means that I need to compare the value of ichimoku.ChikouSpan[index] with the value of  MarketSeries.Close[index-26], correct?

malinga.ratwatte said:

This is because Chikou Span is only calculated after 26 future bars have elapsed. If you scroll to the end of the chart, you'll notice that the cloud is calculated in advance, and Chikou Span retrospectively.

 


@fxsilversurfer

... Deleted by UFO ...