Current Time Behind Position Open Time

if(trade.Buy(0.1,_Symbol,ask,0,(ask + (10*_Point)),NULL))
      {
      int total = PositionsTotal();
      for (int c = 0; c <= total; c++)
         {ulong ticket = PositionGetTicket(c);
            if (PositionSelectByTicket(ticket))
            {
            datetime open_time = PositionGetInteger(POSITION_TIME);
            datetime current_time = TimeCurrent();
            bar_count = Bars(_Symbol,_Period,open_time,current_time);
            Comment("Candle count = ",bar_count,
                    ". Position time = ",open_time,
                    ". Current time = ",current_time,
                    ". Position ticket = ",ticket,".");
            }
               
         }
      }

Greetings! I’m trying to use the above as a bar counting method but my current time seems to be behind my position open time. May anyone know why?

int total = PositionsTotal();
      for (int c = 0; c <= total; c++)                          // Must be < as you have total positions indexed from 0 to total-1
         {ulong ticket = PositionGetTicket(c);
            if (PositionSelectByTicket(ticket))                 // Useless as your position is already selected by previous PositionGetTicket()
            {
            datetime open_time = PositionGetInteger(POSITION_TIME);
            datetime current_time = TimeCurrent();
            bar_count = Bars(_Symbol,_Period,open_time,current_time);
            Comment("Candle count = ",bar_count,
                    ". Position time = ",open_time,
                    ". Current time = ",current_time,
                    ". Position ticket = ",ticket,".");
            }
               
         }

What is the output produced ?

The time on the chart isn’t updating. Tried using the TimeTradeServer() function and a modified TimeGMT() function as well. The aim is to count the bars after opening a position.

I know what is the aim, I am asking you “what is the output”, what is printed on the chart ? What are the values ?

Files: Chart.jpg 155 KB

changed the current time to SymbolInfoInteger(_Symbol,SYMBOL_TIME) and the time started updating. The only problem is that it would increase the position volume every time it did and would not update if it could not increase the volume.