How to determine if last order executed is BUY or SELL?

Hi, I am trying to get the last deal type (Buy or Sell). I tried to find it in as I am using SYMBOL_VOLUME to get the last deal volume, but i couldn’t find anything similar to that.

I also tried to find it in some topics, but the only thing I found was how to get my last deals types and I want anyone’s deal type.


Hello you can use order open time to find the last opened order first and then you can check the type of that particular order.

PositionsTotal will bring my opened positions, right?

I am trying to check anyone’s deal, not mine.

What do you mean by anyones deal ?

SYMBOL_VOLUME will bring me information about the last deal, it doesn’t need to be mine.

It does not specify a type of deal.

It can also specify the volume of the last deal.

SYMBOL_VOLUME Volume of the last deal long

Or it can specify the min and max volume of the position you can take on.

SYMBOL_VOLUME_MIN Minimal volume for a deal double
SYMBOL_VOLUME_MAX Maximal volume for a deal double
SYMBOL_VOLUME_STEP Minimal volume change step for deal execution double
SYMBOL_VOLUME_LIMIT Maximum allowed aggregate volume of an open position and pending orders in one direction (buy or sell) for the symbol. For example, with the limitation of 5 lots, you can have an open buy position with the volume of 5 lots and place a pending order Sell Limit with the volume of 5 lots. But in this case you cannot place a Buy Limit pending order (since the total volume in one direction will exceed the limitation) or place Sell Limit with the volume more than 5 lots. double

I’m still not sure what you mean though.

I know it doesn’t specify the type of the last deal and that’s what I want.

Use SymbolInfoTick() or CopyTicks(). And check the flags field (MqlTick structure).

@vpeabody1 , it worked perfectly.

Thank you very much.