ECN Brokers still need OrderModify for SL?

 

Hi,


Recently started looking at my EA's after a few years break and struggling a little with some of my code.

When I switched from using a Standard account to an ECN broker I remember having to add extra code into my Market Order process, where I needed to place the Market order and then Modify the order immediately with the correct Stoploss and Take Profit. I was using an include file <Deleted>.mqh which I found via this forum to achieve this.

Is the process the same, or have there been changes to the brokers or the MT4 codebase that negate having to modify the order after it has been placed?


thanks

 
simoncs:

Hi,


Recently started looking at my EA's after a few years break and struggling a little with some of my code.

When I switched from using a Standard account to an ECN broker I remember having to add extra code into my Market Order process, where I needed to place the Market order and then Modify the order immediately with the correct Stoploss and Take Profit. I was using an include file OrderReliable_2013.12.03.mqh which I found via this forum to achieve this.

Is the process the same, or have there been changes to the brokers or the MT4 codebase that negate having to modify the order after it has been placed?


thanks

bool rv=false;
//--
   Ticket=OrderSend(Symbol(),............
   if(OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES))
     {
      rv=OrderModify(OrderTicket(), OrderOpenPrice(), stoploss, takeprofit, 0);
     }
   if(!rv)
     {
      Print("ERROR", GetLastError());
      return;
     }
 
Kenneth Parling:

Hi Kenneth,

my code is similar to that. So if I am reading your reply correctly, we still need to perform this Order Modify after the trade has been placed?

(The reason I am asking is that in doing some Optimizamtion testing of my EA's, the standard versions are working correctly by setting a dynamic lotsize, but my ECN versions are just using a fixed lotsize. So before I bother to debug why this is, I just want to make sure I still need to use the ECN version of my code)

 

I also thought this to be the case, but it appears that it is not.

So the only way to know would be to try it.

 
there is a code in the Codebase that takes care of this your ptoblrm by making it similar to mql5 by using the CTrade class on mql4
 
simoncs:

Hi Kenneth,

my code is similar to that. So if I am reading your reply correctly, we still need to perform this Order Modify after the trade has been placed?

(The reason I am asking is that in doing some Optimizamtion testing of my EA's, the standard versions are working correctly by setting a dynamic lotsize, but my ECN versions are just using a fixed lotsize. So before I bother to debug why this is, I just want to make sure I still need to use the ECN version of my code)

If you are using a %risk (for the dynamic lot sizing) based on the stop loss (i.e. lose %balance within sl_points) check if the 0 sl and 0 tp on the order open (i assume you are calling an open trade function that calculates lot at some point) are affecting the lot calculation.

 
simoncs: to an ECN broker I remember having to add extra code into my Market Order process, where I needed to place the Market order and then Modify the order immediately with the correct Stoploss and Take Profit.
TP/SL on OrderSend has been fine for years.
          Build 500 № 9 2013.05.09
          Need help me mql4 guru add take profit to this EA - Take Profit - MQL4 programming forum 2017.09.27
 
Lorentzos Roussos:

If you are using a %risk (for the dynamic lot sizing) based on the stop loss (i.e. lose %balance within sl_points) check if the 0 sl and 0 tp on the order open (i assume you are calling an open trade function that calculates lot at some point) are affecting the lot calculation.

thanks will check that.

 
William Roeder:
TP/SL on OrderSend has been fine for years.
          Build 500 № 9 2013.05.09
          Need help me mql4 guru add take profit to this EA - Take Profit - MQL4 programming forum 2017.09.27

Thanks WHR - that is what I was hoping for, just couldn't find it. Great to see you still active in this forum!!!!