why in oncalculate if call Time not return a right Time ?

 

Hi  in simply function oncalculate  in indicator , when i try to print Time[0] , bar (in formation) return me 2023.09.22 02:20:00        0_o why ?

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{

 
    Print("time[0] (current candle): ", time[0]);


 return 0;
}    
 

[0] is the oldest bar

the newest bar is [rates_total-1]

 

You can make time[0] reflect the open time of the current bar if you set the buffer to time series indexing

ArraySetAsSeries(time, true);