still ichimoku problems

Created at 29 Apr 2020, 11:18
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!
LU

luca.tocchi

Joined 25.03.2020

still ichimoku problems
29 Apr 2020, 11:18


this is the part of my program where the error is

I used : var indexssa = MarketSeries.Close.Count - 1;
             var indexssb = MarketSeries.Close.Count - 1;

to print the values of the ssa and ssb corresponding to the last candle, but they are wrong

private Random random = new Random();
        private IchimokuKinkoHyo ichimoku;
        private ParabolicSAR parabolicSAR;
        //public int Miogoto;
        Symbol _symbol;

        protected override void OnStart()
        {
            Inizio:
            RefreshData();

            string EURUSD = Symbols[random.Next(Symbols.Count)];
            Symbols.GetSymbol("EURUSD");
            Print(EURUSD);

            var _symbol = MarketData.GetSymbol(EURUSD);

            var MaxSpread = _symbol.Bid + (_symbol.PipSize * 2.5);

            ichimoku = Indicators.IchimokuKinkoHyo(MarketData.GetBars(TimeFrame.Minute10, EURUSD), 9, 26, 52);
            parabolicSAR = Indicators.ParabolicSAR(MarketData.GetBars(TimeFrame.Minute10, EURUSD), 0.02, 0.2);

            var EURUSDSeries = MarketData.GetBars(TimeFrame.Minute10, EURUSD);
            var volumeInUnits = _symbol.QuantityToVolumeInUnits(Volume);
            var indexssa = MarketSeries.Close.Count - 1;
            var indexssb = MarketSeries.Close.Count - 1;
            //var index3 = MarketSeries.Close.Count - 4;

            Print("SSA" + ichimoku.SenkouSpanA[indexssa]);
            Print("SSB" + ichimoku.SenkouSpanB[indexssb]);

these are the printed values and the shown on the graph


@luca.tocchi
Replies

PanagiotisCharalampous
29 Apr 2020, 12:12

Hi Luca,

As explained in another post, the Ichimoku indicator is projecting results in the future, hence you need to take that into account. Here is an example of how to adjust your indexing so that you can get the indicator value corresponding to the last bar

            var last = ichimoku.SenkouSpanA.Count - Bars.ClosePrices.Count;

            Print("Span A: ", ichimoku.SenkouSpanA.Last(last));
            Print("Span B: ", ichimoku.SenkouSpanB.Last(last));

You will need to adjust your logic based on this fact.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

luca.tocchi
29 Apr 2020, 12:14

RE:

PanagiotisCharalampous said:

Hi Luca,

As explained in another post, the Ichimoku indicator is projecting results in the future, hence you need to take that into account. Here is an example of how to adjust your indexing so that you can get the indicator value corresponding to the last bar

            var last = ichimoku.SenkouSpanA.Count - Bars.ClosePrices.Count;

            Print("Span A: ", ichimoku.SenkouSpanA.Last(last));
            Print("Span B: ", ichimoku.SenkouSpanB.Last(last));

You will need to adjust your logic based on this fact.

Best Regards,

Panagiotis 

Join us on Telegram

 

Thanks I was unable to resolve. Now yes instead


@luca.tocchi