Closed chenxiangyi10 closed 4 years ago
Problem fixed.
In the script of DWX_ZeroMQ_Server_v2.0.1_RC8.mq4:
In the DWX_SetSLTP function:
Change the line: if(OrderModify(ticket, OrderOpenPrice(), NormalizeDouble(OrderOpenPrice()-_SLdir_flagvpoint,vdigits), NormalizeDouble(OrderOpenPrice()+_TPdir_flagvpoint,vdigits), 0, 0)) {
to: float stoploss; float takeprofit; if (_SL == 0){ stoploss = 0; } else {stoploss = NormalizeDouble(OrderOpenPrice()-_SLdir_flagvpoint,vdigits); } if (_TP ==0){ takeprofit =0; } else {takeprofit = NormalizeDouble(OrderOpenPrice()+_TPdir_flagvpoint,vdigits); } if(OrderModify(ticket, OrderOpenPrice(), stoploss, takeprofit, 0, 0)) { .
The reason is when the DMA_MODE is True, the order is placed first then modify the sl and tp. If fails in modifying the sl and tp, the order will be closed. During set the sl and tp price in DWX_SetSLTP function, it uses addition/ subtraction of the open price and the sl or and tp value you entered. Here, I just set the take profit without giving sl value. So my sl is 0 by which the DWX_SetSLTP function set my stoploss price at the open price. This stoploss price caused the modification order being rejected and consequently fails in modifying the sl and tp.
Hi @chenxiangyi10 ,
Thank you for submitting this report.
Yes, the EA has indeed been developed in a DMA environment using only Darwinex Terminals, so its possible that this particular behaviour wasn't addressed.
Thank you very much for submitting your proposed solution! We will review it by next week and get back to you with feedback / way forward.
Hi,
I came across an issue making me very confused. When using the DWX_MTX_NEW_TRADE() to place an order: {'_action': 'OPEN', '_type': 1, '_symbol': 'USDJPY', '_price': 0.0, '_SL': 0.0, '_TP': 10, '_comment': 'good luck', '_lots': 1, '_magic': 123456, '_ticket': 0}, the _msg, TRADE;OPEN;1;USDJPY;0.0;0.0;10;good luck;1;123456;0, is sent to MT4 server. Yes, the server received the messege, and placed the order, however, immediately it closed the order.
2019.07.04 00:05:00.544 DWX_ZeroMQ_Server_v2.0.1_RC8 USDJPY,M1: open #179916973 sell 1.00 USDJPY at 107.785 ok 2019.07.04 00:05:00.746 DWX_ZeroMQ_Server_v2.0.1_RC8 USDJPY,M1: close #179916973 sell 1.00 USDJPY at 107.785 at price 107.798
Then I tried when the _TP is 0, the order can be placed and kept there.
Could you please give me some help?
Thanks.
Xiangyi