Strange issue recalling comment from most recent deal in history

 

Hey gang,

I'm trying to get my comment from the most recent deal in my trade history. All of the values I'm trying are returning fine except my comment.

ulong ticket = 0;
      ulong dealHistory = HistorySelect(0, TimeCurrent());
      ulong lastDealTicket = HistoryDealGetTicket(HistoryDealsTotal() - 1);
      Print(HistoryDealGetString(lastDealTicket, DEAL_COMMENT));
      Print(HistoryDealGetString(lastDealTicket, DEAL_SYMBOL));
      Print(HistoryDealGetDouble(lastDealTicket, DEAL_PROFIT));
      Print(HistoryDealGetInteger(lastDealTicket, DEAL_TIME)); 

I'm a bit perplexed. Any reason why this might be happening?

The other thing I'm noticing is that

HistoryDealGetInteger(ticket, DEAL_TICKET));

does NOT return my expected ticket ID. It's giving me an ID that I'm not sure where it's coming from, I don't see it in my history. But like I said, all of the other double, int, and string values I'm calling are coming back correct.

 
rrsch:

Hey gang,

I'm trying to get my comment from the most recent deal in my trade history. All of the values I'm trying are returning fine except my comment.

I'm a bit perplexed. Any reason why this might be happening?

The other thing I'm noticing is that

does NOT return my expected ticket ID. It's giving me an ID that I'm not sure where it's coming from, I don't see it in my history. But like I said, all of the other double, int, and string values I'm calling are coming back correct.

I figured it out. Novice error. I need to be fetching the  ORDER_POSITION_ID enum.

Good to know.