The AS_SERIES flag can't be set for multi-dimensional arrays or static arrays (arrays, whose size in square brackets is preset already on the compilation stage). Indexing in timeseries differs from a common array in that the elements of timeseries are indexed from the end towards the beginning (from the newest to oldest data).

Example: Indicator that shows bar number

#propertyindicator_chart_window#propertyindicator_buffers 1//--- indicator buffersdouble NumerationBuffer[];//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit() { //--- indicator buffers mappingSetIndexBuffer(0,NumerationBuffer,INDICATOR_DATA);//--- set buffer styleSetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,CLR_NONE); //--- set indexing for the buffer like in timeseriesArraySetAsSeries(NumerationBuffer,true);//--- set accuracy of showing in DataWindowIndicatorSetInteger(INDICATOR_DIGITS,0);//--- how the name of the indicator arry is displayed in DataWindowIndicatorShortName("Bar #"); //--- return(INIT_SUCCEEDED); }//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,constint prev_calculated,constdatetime &time[],constdouble &open[],constdouble &high[],constdouble &low[],constdouble &close[],constlong &tick_volume[],constlong &volume[],constint &spread[]) {//--- we'll store the time of the current zero bar openingstaticdatetime currentBarTimeOpen=0;//--- revert access to array time[] - do it like in timeseriesArraySetAsSeries(time,true);//--- If time of zero bar differs from the stored oneif(currentBarTimeOpen!=time[0]) {//--- enumerate all bars from the current to the chart depthfor(int i=rates_total-1;i>=0;i--) NumerationBuffer[i]=i; currentBarTimeOpen=time[0]; }//--- return value of prev_calculated for next callreturn(rates_total); }