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; }
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.
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.
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
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.
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!!!!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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