Download MetaTrader 5

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

To add comments, please log in or register
nicolasxu
308
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? 

Irwan Adnan
933
Irwan Adnan  
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.
nicolasxu
308
nicolasxu  
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.  

Enrico Lambino
6429
Enrico Lambino  
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.

nicolasxu
308
nicolasxu  
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 

Sergio Vicente Simioni
120
Sergio Vicente Simioni  

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?

Follow my code:

       if( condition ......)

         {

          table.BuyStop(Lot, Entrance, NULL,Stop,0,  ORDER_TIME_DAY,0);

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

        }

Alain Verleyen
Moderator
35107
Alain Verleyen  
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?

Follow my code:

       if( condition ......)

         {

          table.BuyStop(Lot, Entrance, NULL,Stop,0,  ORDER_TIME_DAY,0);

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

        }

Check the logs to see what error is returned.
Sergio Vicente Simioni
120
Sergio Vicente Simioni  
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

Keith Watford
Moderator
10533
Keith Watford  
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. 


Please be absolutely clear.

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?

Sergio Vicente Simioni
120
Sergio Vicente Simioni  
Keith Watford:

Please be absolutely clear.

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

Alain Verleyen
Moderator
35107
Alain Verleyen  
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)"

Look your chart, look your Terminal window.

12
To add comments, please log in or register