Indicator for future periods

 

I am basing my indicator of the Ichimoku indicator and I need the values of Senkou Span A and Senkou Span B.

The problem is that the indicator works for all the bars on the chart, but I the Senkou Span A and B are ahead or shift 26 periods forward and I can get my indicator to draw past the Bars on the chart like the Ichimoku.

Can someone help me with this?


My confusion is this, the senkou Span A code is this


//---- Senkou Span A
   i=Bars-a_begin+1;
   if(counted_bars>a_begin-1) i=Bars-counted_bars-1;
   while(i>=0)
     {
      price=(Kijun_Buffer[i]+Tenkan_Buffer[i])/2;
      SpanA_Buffer[i]=price;
      SpanA2_Buffer[i]=price;
      i--;
     }


and senkou SpanB is

//---- Senkou Span B
   i=Bars-Senkou;
   if(counted_bars>Senkou) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Senkou;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      price=(high+low)/2;
      SpanB_Buffer[i]=price;
      SpanB2_Buffer[i]=price;
      i--;
     }

Since they both are going off of two different time periodes I dont know how to sync the data.

I used tried to use iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, -26) and iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, -26); to get values but it messes up the calculation on the chart.

if I use iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, 0) and iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, 0);

and use


SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
in my init () function it calculates and draws perfectly only for the bars on the chart. I need it to draw perfectly all the way up to 26 periods ahead like that actual Ichimoku indicator.
 

Hi bro

did you find any solution?

Reason: