What will happen if I open a limit buy and limit sell order at the same time?

312

I open a limit sell order and limit buy order both with take profit 300 points above the one price. For example:

Order 1: limit buy at 1.08000, take profit at 1.08300, no stop loss

Order 2: limit sell at 1.08000, take profit at 1.07700, no stop loss

What I expect is when the price oscillating around one price point, e.g.: 1.08000, both orders will be executed with 300*2 points profit. But the actual result is both order are fulfilled and take profit not triggered.  It looks like the two orders cancelled out each other in EA test.

The final profit is 0, and loss is also 0. What is going on? What should I expect if send the above Order 1 and Order 2 at the same time?

956

nicolasxu:

I open a limit sell order and limit buy order both with take profit 300 points above the one price. For example:

Order 1: limit buy at 1.08000, take profit at 1.08300, no stop loss

Order 2: limit sell at 1.08000, take profit at 1.07700, no stop loss

What I expect is when the price oscillating around one price point, e.g.: 1.08000, both orders will be executed with 300*2 points profit. But the actual result is both order are fulfilled and take profit not triggered.  It looks like the two orders cancelled out each other in EA test.

The final profit is 0, and loss is also 0. What is going on? What should I expect if send the above Order 1 and Order 2 at the same time?

AFAIK you cant open buy limit and sell limit on same price. You can only open buy limit and sell stop or vv.
312

belido:
AFAIK you cant open buy limit and sell limit on same price. You can only open buy limit and sell stop or vv.

I tried on simulated account. It looks the trigger of limit price on the 2nd order will immediately cancel the previous limit order that is in the opposite direction with the same amount.

This behavior is different from limit order for US equity trading.

6850

nicolasxu:

I tried on simulated account. It looks the trigger of limit price on the 2nd order will immediately cancel the previous limit order that is in the opposite direction with the same amount.

This behavior is different from limit order for US equity trading.

It is possible to open both orders, but given they have the same lot size, they would just cancel each other out as soon as the second order is hit since in MT5, hedging is not allowed.
And assuming that the spread is fixed and not zero, either they execute at the same time or execute at the same price - it can never be both.

312

Iceron:

It is possible to open both orders, but given they have the same lot size, they would just cancel each other out as soon as the second order is hit since in MT5, hedging is not allowed.
And assuming that the spread is fixed and not zero, either they execute at the same time or execute at the same price - it can never be both.

Thanks a lot for helping me make clear of this issue!

- Nick

123

Hello,

I am developing an EA which is expected, under certain conditions,  to place a pending  BUY STOP order and at the same time a pending SELL LIMIT order ,  aiming to generate a partial profit.

When I am in the demo account, the code  is working perfectly but in my real account the  SELL LIMIT order is not being placed.

Any suggestion?

if( condition ......)

{

table.SellLimit(ParcialLot, ParcialProfit, NULL,0,0,  ORDER_TIME_DAY,0);

}

37537

simionsv:

Hello,

I am developing an EA which is expected, under certain conditions,  to place a pending  BUY STOP order and at the same time a pending SELL LIMIT order ,  aiming to generate a partial profit.

When I am in the demo account, the code  is working perfectly but in my real account the  SELL LIMIT order is not being placed.

Any suggestion?

if( condition ......)

{

table.SellLimit(ParcialLot, ParcialProfit, NULL,0,0,  ORDER_TIME_DAY,0);

}

Check the logs to see what error is returned.
123

Alain Verleyen:
Check the logs to see what error is returned.

Alain,

The log shows:

"sell limit order placed at XXXX for execution in XXX ms ( Order recevied. Sending to OMS)"

As I am not seeing the line for SELL LIMIT in my pc screen, I am going to check if the execution occurs during the trade and if this is the problem,  is there a way to show this line?

tks

Moderator
16046

simionsv:

When I am in the demo account, the code  is working perfectly but in my real account the  SELL LIMIT order is not being placed.

Do you mean that the sell limit is not being placed or do you mean that both pending orders are being placed but only the buy is being triggered?

123

Keith Watford:

Do you mean that the sell limit is not being placed or do you mean that both pending orders are being placed but only the buy is being triggered?

Keith,

only the SELL LIMIT is not being placed, the BUY STOP order works perfectly.

tks

37537

simionsv:

Keith,

only the SELL LIMIT is not being placed, the BUY STOP order works perfectly.

tks

It seems your SELL LIMIT is correctly placed.

"sell limit order placed at XXXX for execution in XXX ms ( Order recevied. Sending to OMS)"