Get last deal type

 

Hi, I am trying to get the last deal type (Buy or Sell). I tried to find it in  https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_chart_mode 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.

Thanks

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
To obtain the current market information there are several functions: SymbolInfoInteger(), SymbolInfoDouble() and SymbolInfoString(). The first parameter is the symbol name, the values of the second function parameter can be one of the identifiers of ENUM_SYMBOL_INFO_INTEGER, ENUM_SYMBOL_INFO_DOUBLE and ENUM_SYMBOL_INFO_STRING. Some symbols...
 
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.
 
Marco vd Heijden:
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 ?
 
Marco vd Heijden:
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.

 
Marco vd Heijden:

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.

 
hpazzini:

Hi, I am trying to get the last deal type (Buy or Sell). I tried to find it in  https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_chart_mode 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.

Thanks

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

Alain, it worked perfectly.

Thank you very much.