oco trades

 

Hello All


I am long and short the same trade USD/EUR at the same time, for the same amount.


Is it correct to say on MT5, ones doesn't cancels the other order?


At another broker, the 2 trades would cancel one another out, is that not the case on MT5?

Please let me know

 
Hookway:

Hello All


I am long and short the same trade USD/EUR at the same time, for the same amount.


Is it correct to say on MT5, ones doesn't cancels the other order?


At another broker, the 2 trades would cancel one another out, is that not the case on MT5?

Please let me know

If hedging is enabled on your platform, then the short will not cancel out the long.  


Account Properties

To obtain information about the current account there are several functions: AccountInfoInteger(), AccountInfoDouble() and AccountInfoString(). The function parameter values can accept values from the corresponding ENUM_ACCOUNT_INFO enumerations.

For the function AccountInfoInteger()

ENUM_ACCOUNT_INFO_INTEGER

Identifier

Description

Type

ACCOUNT_LOGIN

Account number

long

ACCOUNT_TRADE_MODE

Account trade mode

ENUM_ACCOUNT_TRADE_MODE

ACCOUNT_LEVERAGE

Account leverage

long

ACCOUNT_LIMIT_ORDERS

Maximum allowed number of active pending orders

int

ACCOUNT_MARGIN_SO_MODE

Mode for setting the minimal allowed margin

ENUM_ACCOUNT_STOPOUT_MODE

ACCOUNT_TRADE_ALLOWED

Allowed trade for the current account

bool

ACCOUNT_TRADE_EXPERT

Allowed trade for an Expert Advisor

bool

ACCOUNT_MARGIN_MODE

Margin calculation mode

ENUM_ACCOUNT_MARGIN_MODE

ACCOUNT_CURRENCY_DIGITS

The number of decimal places in the account currency, which are required for an accurate display of trading results

int

ACCOUNT_FIFO_CLOSE

An indication showing that positions can only be closed by FIFO rule. If the property value is set to true, then each symbol positions will be closed in the same order, in which they are opened, starting with the oldest one. In case of an attempt to close positions in a different order, the trader will receive an appropriate error.

 

For accounts with the non- hedging position accounting mode (ACCOUNT_MARGIN_MODE!=ACCOUNT_MARGIN_MODE_RETAIL_ HEDGING ), the property value is always false.

bool

ACCOUNT_HEDGE_ALLOWED

Allowed opposite positions on a single symbol


Check to see what your  ACCOUNT_FIFO_CLOSE and  ACCOUNT_HEDGE_ALLOWED are set to on the broker you are using ... a long can cancel a short of the same lot size --OR-- both the long and the short can exist simultaneously ... depends on the settings you choose (or the broker chose for you) when you opened up the brokerage account.  Some countries don't allow true hedging (long and short at the same time on e.g. the same currency pair), as I understand.

run this code to find out:

   // get the current state of the trading terminal regarding its ability to hedge with long and short of the same e.g. currency pair

bool fifo_BOOL = (bool)AccountInfoInteger(ACCOUNT_FIFO_CLOSE);

bool hedgeAllowed_BOOL = (bool)AccountInfoInteger(ACCOUNT_HEDGE_ALLOWED);

 
Thank you for these details!