CopyBuffer with Ichimoku chikou renders junk

 

So I am working with an EA that gets info from Ichimoku, here is my code:

int i_def = iIchimoku(_Symbol,_Period,9,26,52);
double tenkan[],kijun[],senkouA[],senkouB[],chikou[];
ArraySetAsSeries(tenkan,true);
ArraySetAsSeries(kijun,true);
ArraySetAsSeries(senkouA,true);
ArraySetAsSeries(senkouB,true);
ArraySetAsSeries(chikou,true);

...

if ( CopyBuffer(i_def,4,0,9,chikou) == -1) {
        Print("need to fill out chikou");
        ichimoku_ready = false;
        return;
}

... 
for ( i = 0; i < 9; i++ ) {
        // Alread here it is junk:
        //Setting chikou[0]=179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000
        LogString( StringFormat("Setting chikou[%d]=%f",i,chikou[i]) );
        ichimoku[4][i] = chikou[i];
}                               

Now, in the Ichimoku example, there is:

SetIndexBuffer(4,ExtChikouBuffer,INDICATOR_DATA);

Which, in the example, OnCalculate fills it this wise:

ExtChikouBuffer[i]=close[i];

Is it that the Ichimoku Indicator that comes with MT5 does not have this buffer? I left out bits of code that 1) work fine and as expected (all other buffers are correct), and 2) would just make things difficult to read.


Am I doing something massively wrong? All the other buffers are copied correctly. This can't be the real value?, besides, all the values for the entire copied buffer are the same, or seem to be.


Any help would be appreciated.

 
JolieRouge:

...

Any help would be appreciated.

After rooting around, the answer is this: Because Chikou is 26 candles in the past, you actually have to start copying at 25.


if ( CopyBuffer(i_def,4,25,9,chikou) == -1) {
                                Print("need to fill out chikou");
                                ichimoku_ready = false;
                                return;
                        }
 
JolieRouge:

After rooting around, the answer is this: Because Chikou is 26 candles in the past, you actually have to start copying at 25.


thanks