Is OrderSend() function now able to send ECN trades (with SL and TP) by itself?

 

I have tested it on two brokers where I can manually open a new trade as "Market Execution" with "Stop Loss" and "Take Profit" options disabled. That's expected, but in fact, when I create an EA, OrderSend() function works when SL and TP parameters are used. It just opens trades as in non-ECN broker, there is no error 130 anymore.

My question is: Is MT4 now able to deal with ECN brokers officially when EA is used, without the need to first open the trade with no stops, and then add them with OrderModify()? If yes, since when is that fact? What about MT5?

Of course I searched for an answer, but I could not find exact one. Here https://book.mql4.com/trading/ordersend everything is written as this issue never existed.

 
JDeel:

I have tested it on two brokers where I can manually open a new trade as "Market Execution" with "Stop Loss" and "Take Profit" options disabled. That's expected, but in fact, when I create an EA, OrderSend() function works when SL and TP parameters are used. It just opens trades as in non-ECN broker, there is no error 130 anymore.

My question is: Is MT4 now able to deal with ECN brokers officially when EA is used, without the need to first open the trade with no stops, and then add them with OrderModify()?

Your OrderSend() is it an OP_BUY or OP_SELL or a pending order ?
 

OP_BUY, OP_SELL.

Here is a screenshot. It's visible that it is "Market Execution" with disabled stops, but there is a trade created from the EA successfully with stops, no OrderModify() is used.

MT4

The situation with MT5 is even more strange. It says "Market Execution", but stops fields are not disabled, and again - the EA creates a position with stops attached to it, no need of OrderModify().

MT5

 

Yep, confirmed it works with my ECN broker (MT4 in demo). Used this script

int start()
   {
   OrderSend(Symbol(),OP_BUY,1,Ask,0,Bid-0.0001,Ask+0.0001,NULL,0,0,CLR_NONE);
   return;
   }

Opened with SL and TP and the order closed when it hit the SL. Thanks for the headsup!

 
JDeel:

OP_BUY, OP_SELL.

Here is a screenshot. It's visible that it is "Market Execution" with disabled stops, but there is a trade created from the EA successfully with stops, no OrderModify() is used.

The situation with MT5 is even more strange. It says "Market Execution", but stops fields are not disabled, and again - the EA creates a position with stops attached to it, no need of OrderModify().

MetaTrader 5 Client Terminal build 821 :

Terminal: Added ability to set Stop Loss and Take Profit levels in market order placing dialog for symbols having Market and Exchange execution types...

 


I think you are mistaken . . .

https://www.mql5.com/en/docs/constants/structures/mqltraderequest the documentation disagrees

Market Execution

This is a trade order to open a position in the Market Execution mode. It requires to specify the following 5 fields:

action

symbol

volume

type

type_filling

Also it is possible to specify the "magic" and "comment" field values.

Exchange Execution

This is a trade order to open a position in the Exchange Execution mode. It requires to specify the following 5 fields:

action

symbol

volume

type

type_filling

Also it is possible to specify the "magic" and "comment" field values.

 
RaptorUK:


I think you are mistaken . . .

https://www.mql5.com/en/docs/constants/structures/mqltraderequest the documentation disagrees

No I am not mistaken, it's the documentation who is mistaken

I am currently reporting these errors to Service Desk, but I have to prove them they are wrong

 
angevoyageur:

No I am not mistaken, it's the documentation who is mistaken

I am currently reporting these errors to Service Desk, but I have to prove them they are wrong

This links to the discussion we had about change control in documentation and is a very good illustration of why it is needed.
 

From the same link:

32.MetaTester: Added permission for placing SL and TP from MQL5 applications in Exchange and Market Execution modes during testing and optimization.

For MT4 it's this one (https://www.mql5.com/en/forum/144834)

Terminal: Removed check for the absence of SL and TP when opening positions for trading symbols of Market Execution type when trading from MQL4 applications.

Confirmed. I'm so happy :)

 
JDeel:

From the same link:

32.MetaTester: Added permission for placing SL and TP from MQL5 applications in Exchange and Market Execution modes during testing and optimization.

For MT4 it's this one (https://www.mql5.com/en/forum/144834)

Terminal: Removed check for the absence of SL and TP when opening positions for trading symbols of Market Execution type when trading from MQL4 applications.

Confirmed. I'm so happy :)

I'm happy you are happy, I'm far from happy. How do we determine if a Symbol is "Market Execution type" programmatically ? why wasn't the Documentation updated ?
 

In MQL5:

SymbolInfoInteger(the_symbol_here, SYMBOL_TRADE_EXEMODE);

In MQL4 I don't know. There is nothing found when seaching the documentation for "market execution", "instant" or "exchange".

I also wonder why there is no single word about this topic in documentation, because there was big attention when OrderSend() started to return error 130 and there was so many questions about this everywhere. But MetaQuotes normally don't listen to what is going on, they prefer to try harder to prove their MQL5 as a better language, which is... not really possible :)

Reason: