Hello all,
I am just getting into programming for mq4, I apologize if this question has been asked already (as I am sure it has many times) however I cannot find a solution on the forums. I am trying to compare the ask price with another price and the condition never returns true even though it should. It looks something like this
again sorry for the complete newbie question, I have a bit of programming experience in .net and cannot for the life of me figure why something simple like this is not working.
Thanks for the help
Jacob
Isn't that obvious ?,
If you wonder of some logic in coding, then print the value, it will help you understand the logic, I did and below is the result :
BTW, also read this topic : https://www.mql5.com/en/forum/136997, and https://www.mql5.com/en/forum/140534
double OpenPrice = Ask; double NormalPrice = NormalizeDouble(OpenPrice, 2); double MidPrice = NormalPrice + 0.0050; Print (DoubleToStr(OpenPrice , 8)); //--- 1.27575000 Print (DoubleToStr(NormalPrice, 8)); //--- 1.28000000 Print (DoubleToStr(MidPrice, 8)); //--- 1.28500000 if (OpenPrice > MidPrice) //--- if (1.2757 > 1.285) // it read : if (small > big) { // this is never true, not sure why. }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all,
I am just getting into programming for mq4, I apologize if this question has been asked already (as I am sure it has many times) however I cannot find a solution on the forums. I am trying to compare the ask price with another price and the condition never returns true even though it should. It looks something like this
again sorry for the complete newbie question, I have a bit of programming experience in .net and cannot for the life of me figure why something simple like this is not working.
Thanks for the help
Jacob