modify order failed [Invalid S/L or T/P] - page 2

 
Ahmad Zuhairdi Noh:

My first guess after seeing your code is your SL or TP is below broker's allowed StopLevel. Try to make your EA check it first by using MarketInfo(Symbol(),MODE_STOPLEVEL)

and I'm wondering, why you didn't directly use Stoploss and TakeProfit in OrderSend() function? That will reduce your line of code, isn't it?

Goodluck.

Hi Ahmad,


Thanks for the reply.

1)

The STOPLEVEL by DAX is as follow:

2018.05.07 13:35:00.246 PrintMarketInfo DAX.,H1: Stop level in points=0.0

I don't understand what 0.0 means. But from my another MT4 broker the STOPLEVEL is 100 points.

According to the definition:

A zero value of MODE_STOPLEVEL means either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal.


2) 

>>why you didn't directly use Stoploss and TakeProfit in OrderSend() function?

I was told or read somewhere that by some brokers they will not support directly using the SL and TP in the SendOrder() and one has to modify them after an order is opened. I am sure if this is really true.

OrderSend - Trade Functions - MQL4 Reference
OrderSend - Trade Functions - MQL4 Reference
  • docs.mql4.com
Returns number of the ticket assigned to the order by the trade server or -1 if it fails. To get additional error information, one has to call the GetLastError() function. At opening of a market order (OP_SELL or OP_BUY), only the latest prices of Bid (for selling) or Ask (for buying) can be used as open price. If operation is performed with a...
 
thomas2004:
..

>>why you didn't directly use Stoploss and TakeProfit in OrderSend() function?

I was told or read somewhere that by some brokers they will not support directly using the SL and TP in the SendOrder() and one has to modify them after an order is opened. I am sure if this is really true.

It was true in the past, it's no more true for years now.

Reason: