Direction — the direction of a deal, as a result of which the tick was generated: Buy or Sell.
Data on the direction is generally filled by the source of ticks, i.e. a gateway or a data feed. If the data source does not provide such information, the history server fills the direction automatically using the following algorithm:
If the last deal price is greater than or equal to the last ask price, the price is considered to be the result of a buy deal.
If the last deal price is less than or equal to the last bid price, the price is considered to be the result of a sell deal.
You're looking at last values which is the price/volume of the last trade at the exchange. It doesn't have a direction (one counterparty buys, seconds sells) so MT5 server tries to find who's market taker and sets this as direction, sometimes it can't recognize the direction and sets Buy/Sell or N/A.