Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 561
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Simple:
gives an error
error message
Where is the error? What kind of error?
Hello. I have a task to check the input trading volume parameter specified by the user for correctness, namely the specified lot should be a multiple of the lot change step. To do that, I find a real remainder of division and compare it to a zero or a value very close to zero (for example, 0.000000001)
Result:
/* Вещественный остаток 0,009999999999999998 Шаг изменения лота 0,01 Результат деления 3,0 */
Also attached a screenshot.
I think the remainder should be zero or a very small number, but the result is almost 0.01 for some reason? Then how can I check the input parameter if, for example, the user sets 0.001 by mistake?
Hello. I have a task to check the input trading volume parameter specified by the user for correctness, namely, the specified lot should be a multiple of the lot change step. To do that, find a real remainder of division and compare it to a zero or a value very close to zero (for example, 0.000000001)
Result:
Also attached a screenshot.
I think the remainder should be zero or a very small number, but the result is almost 0.01 for some reason? Then how can I check the input parameter if, for example, the user sets 0.001 by mistake?
It's a bit wrong. The first thing to do is to calculate the closest correct value (based on the set value), and then check the difference between the values obtained. If it is equal to zero (or not more than DBL_EPSILON), then everything is OK:
The VolumeCast function can be taken from here.
Where does it go wrong? What kind of error does it give out?
1 error(s), 0 warning(s) 2 1
'if' - expressions are not allowed on a global
Afternoon!!!
Guys, can you tell me the code on how to link an EA to one account (for the latest MT4 update).
Thank you very much.
Good afternoon!
Guys, can you tell me the code to bind an EA to one account (for the latest MT4 update).
Thank you very much.
You have already been given the code.
You have made the error yourself - it is written in the error description that you have entered the code in the area of global variables and not inside OnTick() or OnInit():
'if' - expressions are not allowed on a global scope
You have already been told the code.
You made the error yourself - it is written to you in the error description that you have entered code in the area of global variables, not inside OnTick() or OnInit():
'if' - expressions are not allowed on a global scope
I'm just learning!
Do not judge! ;)
1 error(s), 0 warning(s) 2 1
'if' - expressions are not allowed on a global
Show me how you applied the code. Did you just copy what I wrote?
Show me how you applied the code. Did you just copy what I wrote?
I did :)))