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?