Stop entry orders with OCO (One cancels the other)?

 

Hello

Please could somebody tell me if it is possible to program an EA with Stop entry orders with OCO (One cancels the other)? 

For example, when trading Donchian channels, the EA would place Stop entry orders slightly beyond the upper and lower part of the channel and when one order is placed, the other is cancelled. 

Thanks 

 
Ant469:

Hello

Please could somebody tell me if it is possible to program an EA with Stop entry orders with OCO (One cancels the other)? 

For example, when trading Donchian channels, the EA would place Stop entry orders slightly beyond the upper and lower part of the channel and when one order is placed, the other is cancelled. 

Thanks 

There is not OCO orders with MT4/MT5. You can mimic them with an EA on Terminal side, but you won't have the same security level.
 
Ant469:

Please could somebody tell me if it is possible to program an EA with Stop entry orders with OCO (One cancels the other)? 

For example, when trading Donchian channels, the EA would place Stop entry orders slightly beyond the upper and lower part of the channel and when one order is placed, the other is cancelled. 

Hello Ant469,

OCO orders are not natively present in MT5. However, you can easily do that programmatically.

Basically you have to send 2 stop entry orders. After identifying the execution of one order, you need to delete the other pending order.

As said, all that programmatically. But it's perfectly possible to be done.

Regards,
Malacarne 

 

Ah I see. Great, thanks for your help. 

 
Rodrigo Malacarne #:

Hello Ant469,

OCO orders are not natively present in MT5. However, you can easily do that programmatically.

Basically you have to send 2 stop entry orders. After identifying the execution of one order, you need to delete the other pending order.

As said, all that programmatically. But it's perfectly possible to be done.

Regards,
Malacarne 

OK kindly help with a code for doing OCO programmatically or point us to an article or script. 
Reason: