Get last deal type

To add comments, please log in or register
hpazzini
27
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

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...
Marco vd Heijden
Moderator
8176
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.
hpazzini
27
hpazzini  
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.

Marco vd Heijden
Moderator
8176
Marco vd Heijden  
What do you mean by anyones deal ?
hpazzini
27
hpazzini  
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.

Marco vd Heijden
Moderator
8176
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.

hpazzini
27
hpazzini  
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.

Alain Verleyen
36138
Alain Verleyen  
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).
hpazzini
27
hpazzini  
Alain Verleyen:
Use SymbolInfoTick() or CopyTicks(). And check the flags field (MqlTick structure).

Alain, it worked perfectly.

Thank you very much.

To add comments, please log in or register