Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1494
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Could you please tell me why the program (on mql 4, on minutes, all ticks) reads the number explicitly and the same number calculated in the function differently.
Here is the code
The program does not read Pr as 1.60854 althoughPrint( ) shows the value of Pr as 1.60854 . As a result, the program opens the second order, but it shouldn't do that
.
And if we set the number 1.60854 instead of the Pr variable , the program reads it and does not open the second order.
QUESTION What changes should be made to the code so that the program reads Pr and doesn't open the second order.
Thanks for your help
It is not recommended to compare real numbers directly. It is more correct to compare their normalized difference with zero.
It is not recommended to compare real numbers directly. It is correct to compare their normalised difference to zero.
Thanks for the valuable information. I never would have guessed that myself.
Thank you for the valuable information. I never would have guessed that myself.
Not recommended does not mean forbidden. If, for example, we compare the current price with the price of the expected stop, then we can compare directly whether it is more or less... The difference will be quite significant. But it is quite another matter to compare it on equal terms...
Not recommended does not mean that it is forbidden. If, for example, we compare the current price with the price of the expected stop, then we can compare directly whether it is more or less... The difference will be quite significant. And it's quite another matter when you compare it to equality...
Got it. Thank you.
But it doesn't work that easily.
How can I outsmart the compiler?
Hello. Please help me to understand the Zigzag indicator. It turns out that the entire array ZigZagBuffer[] has taken the value 0.0. Why does the expression if(res != 0.0) sometimes become true? After all, the entire array has the value 0.0?????
Hi all. Dear programmers, I need your help.
I am trying to make a multicurrency indicator, it should show SMA of two symbols in the basement.
If it's not difficult, please advise what is the error.
Good day to all.
Can you please tell me how to code the following condition correctly using I don't remember which mathematical function.
if (Bid - Low[1]>=0.0030 && Bid - Low[1]<0.0035) {action;}
I know that there is a math function that can be used in the above condition without && sign . But I don't remember what this mathematical function is called and how to apply it.
Thank you for your help.
if(MathAbs(Bid - Low[1]) >= 0.0004) {action;}
if(MathAbs(Bid - Low[1]) >= 0.0004) {action;}
Oh Taras, Taras... Didn't you learn to think at school? Is 0.0004 ever less than 0.0035 ...............
Oh Taras, Taras... Didn't they teach you to think at school? Is 0.0004 less than 0.0035 ...............
Learn to read, you liar.
and the program will check for price consistency in the 4-point range.