Need help on GetLastError() / "slippage" in OrderSend() !

 

1> How to make GetLastError return a string instead of a number ?


I used to put the GetLastError() in Alert or Print command to see what is wrong. But I just saw the returned number !

Is there a way to let it present the string content of the error ?


2> Please further explain the role of "slippage" parameter in OrderSend ()

We all knew this syntax: OrderSend (symbol,cmd,vol,price,slippage,SL,TP,comment,magic num,expired,arrow color)

I didnot get clear of the 5th parameter, "slippage". Please help me by the following example:


OrderSend(XAUUSD,OP_SELLLIMIT,1,1650.00, 3, ...);

In case the above statement executed, what is the range of the executed price ?

* 1649.70 to 1650.30 ?

* 1649.97 to 1650.03 ?

* An other range, if so, please specify

Thanks for help !

 

1. Stick with the error numbers, they are unambiguous . . . if you need help and you say "I get an error 130" we will know what you mean . . . learn the error number and what they mean.

2. Slippage is a number of points that you are prepared to move your entry level in order for your order to get filled.

 
RaptorUK:

1. Stick with the error numbers, they are unambiguous . . . if you need help and you say "I get an error 130" we will know what you mean . . . learn the error number and what they mean.

2. Slippage is a number of points that you are prepared to move your entry level in order for your order to get filled.


Hi RaptorUK,

Maybe you are a typical Englishman, who tends to generalize everything ! :-)

Should you please insist that there is no way of reporting the error in the text formal ? (I know to lookup the error number anyway)

Should you kindly answer my above example please ?


By the way, if you don't mind, I didn't know the concept of "Point" in MQL4





 
sonthanhthuytu:

Hi RaptorUK,

Maybe you are a typical Englishman, who tends to generalize everything ! :-)

Should you please insist that there is no way of reporting the error in the text formal ? (I know to lookup the error number anyway)

Should you kindly answer my above example please ?


By the way, if you don't mind, I didn't know the concept of "Point" in MQL4

Point or use MarketInfo with MODE_POINT

There are ways or reporting the error information in a textual form . . . I didn't say there wasn't, just that in my opinion it's a bad idea, it makes people lazy and harder to help. ErrorDescription() take a look here: https://www.mql5.com/en/forum/125042/page2

 

Thank you very much for your help, RaptorUK.

---------------------------------------------------------

Dear other readers of this topic,

Please continue to add comments to help me on this topic,

I still want to have the result for my above example of slippage.

 
sonthanhthuytu:


1> How to make GetLastError return a string instead of a number ?

Use the ErrorDescription() function with GetLastError() as its parameter.

https://docs.mql4.com/constants/errors

 
dabbler:

Use the ErrorDescription() function with GetLastError() as its parameter.

https://docs.mql4.com/constants/errors


Thank you