In an order-by-order depth-of-book feed, the trade direction is based on the taking order. If an incoming BUY order is immediately matched with a standing SELL order, the direction is BUY.
Things get a bit more interesting with icebergs and auction orders, in which case the trade direction is typically opposite of the earliest of the two originating orders.
.001,001,20.00,100,B (100 display of 300 iceberg order, 200 hidden)
.002,003,15.00,100,B (100 display of 300 iceberg order, 100 hidden)
.002,004,15.00,100,B (100 display of 300 iceberg order, 0 hidden)
The trade direction of all three trades above is SELL.
I don't think comparing prices of consecutive trades is a meaningful indicator of direction. But I have the feed available where the direction (aka side) is classified by the exchange itself and I could run some tests on empirical data.