I think i understood the double variable and the floating-point and now i think i have the right value for SL and TP, in fact i can open some order successfully!
The problem is that for some order i still have the 130 error from the ordersend, but the thing more strange is that i get the same error if i set the SL and TP value direcly from code and with the same values :(
Instead, if i open the order from the smartphone app with the same parameters it works!
This could still be a problem with the correct SL value fit?
I think i understood the double variable and the floating-point and now i think i have the right value for SL and TP, in fact i can open some order successfully!
The problem is that for some order i still have the 130 error from the ordersend, but the thing more strange is that i get the same error if i set the SL and TP value direcly from code and with the same values :(
Instead, if i open the order from the smartphone app with the same parameters it works!
This could still be a problem with the correct SL value fit?
Please provide your current code, so we can see and eventually help.
By debugging the code, i see that during the conversion from String to Double the function add some decimal value (and i don't know why), so for example 1.07866 in string become 1.07866000000001 in double.
For buy: stoploss must be <= Bid - MarketInfo(Symbol(), MODE_STOPLEVEL) * Point()
For sell: stoploss must be >= Ask + MarketInfo(Symbol(), MODE_STOPLEVEL) * Point()
Sorry, i wrote the wrong values (a little confusion due to the multiple test), these are the parameters about a failed order retrieved by the MetaEditor debugger:
Sorry, i wrote the wrong values (a little confusion due to the multiple test), these are the parameters about a failed order retrieved by the MetaEditor debugger:
Could you please provide all relevant code, such that we can actually reproduce the issue.
Maybe we can find a solution to your problem this way.
Edit:
Hard-nose the response from Telegram, so that we actually have the string
string order_params[10];
// if the string with the parameters is empy, the BOT will show the help messageif (StringCompare(parameters,"") == 0)
return BotOrderSendHelp();
// i need to split the parameters to elaborate themint i = StringSplit(parameters, StringGetCharacter(";",0), order_params);
Christian
PS: the function RoundPriceToStep was suggested by the user @amrali above
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I think i understood the double variable and the floating-point and now i think i have the right value for SL and TP, in fact i can open some order successfully!
The problem is that for some order i still have the 130 error from the ordersend, but the thing more strange is that i get the same error if i set the SL and TP value direcly from code and with the same values :(
Instead, if i open the order from the smartphone app with the same parameters it works!
This could still be a problem with the correct SL value fit?
I think i understood the double variable and the floating-point and now i think i have the right value for SL and TP, in fact i can open some order successfully!
The problem is that for some order i still have the 130 error from the ordersend, but the thing more strange is that i get the same error if i set the SL and TP value direcly from code and with the same values :(
Instead, if i open the order from the smartphone app with the same parameters it works!
This could still be a problem with the correct SL value fit?
By debugging the code, i see that during the conversion from String to Double the function add some decimal value (and i don't know why), so for example 1.07866 in string become 1.07866000000001 in double.
You can try this solution:
And use it to round the SL
Finally, you need to check you SL for your broker's stop level.
see the graph here https://www.mql5.com/en/forum/461774#comment_52124875 ,
and also the MQL4 book here https://book.mql4.com/appendix/limits
You can try this solution:
And use it to round the SL
Finally, you need to check you SL for your broker's stop level.
see the graph here https://www.mql5.com/en/forum/461774#comment_52124875 ,
and also the MQL4 book here https://book.mql4.com/appendix/limits
Thank you for you suggestion, but unfortunalty i get the same error 130 with your code :(
These are my SL, TP and TICKSIZE parameters (calculated by your function):
And these are the Ask price, the MODE_STOPLEVEL, the Point and the Digits parameters (if they can help you):
Christian
Thank you for you suggestion, but unfortunalty i get the same error 130 with your code :(
These are my SL, TP and TICKSIZE parameters (calculated by your function):
And these are the Ask price, the MODE_STOPLEVEL, the Point and the Digits parameters (if they can help you):
Christian
Sorry, i wrote the wrong values (a little confusion due to the multiple test), these are the parameters about a failed order retrieved by the MetaEditor debugger:
These are the OrderSend parameters:
Sorry, i wrote the wrong values (a little confusion due to the multiple test), these are the parameters about a failed order retrieved by the MetaEditor debugger:
This is the code to open the order:
The parameters are in a string array (called order_params) where each row is a parameter.
In Telegram i send a command like this:
So the parameters are separeted by ';' and then they are splittend in the string array.
The sintax is:
and the function to split:
Christian
PS: the function RoundPriceToStep was suggested by the user @amrali above
This is the code to open the order:
The parameters are in a string array (called order_params) where each row is a parameter.
In Telegram i send a command like this:
So the parameters are separeted by ';' and then they are splittend in the string array.
The sintax is:
and the function to split:
Christian
PS: the function RoundPriceToStep was suggested by the user @amrali above
This is the code to open the order:
The parameters are in a string array (called order_params) where each row is a parameter.
In Telegram i send a command like this:
So the parameters are separeted by ';' and then they are splittend in the string array.
The sintax is:
and the function to split:
Christian
PS: the function RoundPriceToStep was suggested by the user @amrali above