Hi,Some time ago I tried to do a simple arithmetic function as follows
The calculation above should produce 0.02, right?
But when I run the script in MT4 on one of my VPS the resulting number is 0.
When I try to log in to the same MT4 on my laptop and I run the script above the result is 0.02.
Does anyone know the reason why my VPS is different?
Because because of this, all my EA lot calculations were messed up
The issue you're encountering with the calculation returning 0 on your VPS but 0.02 on your laptop could be due to differences in how the environments are configured, specifically with regard to how they handle floating-point precision and rounding. Maybe do a test quick.....
Check MT4 versions on both your VPS and laptop to make sure they’re the same. You can also print intermediate values to see where the discrepancy arises. For example, print lots * 1.5 * 100 before rounding to see if it differs across environments. Then test a simple rounding script on both environments without EA involvement, isolating the issue to see if it’s specific to your VPS. Make sure locale settings on your VPS is right(especially language and number formatting). Hope it helps
Hi,Some time ago I tried to do a simple arithmetic function as follows
The calculation above should produce 0.02, right?
But when I run the script in MT4 on one of my VPS the resulting number is 0.
When I try to log in to the same MT4 on my laptop and I run the script above the result is 0.02.
Does anyone know the reason why my VPS is different?
Because because of this, all my EA lot calculations were messed up
https://www.mql5.com/en/forum/470651
As mentioned in the discussion at the link above, the bug may be in the physical CPU that your VPS uses.
It looks like the problem is unlikely to be resolved in the near future. I guess that the problem will not be solved at all.
Do not use VPS on which MathRound does not work correctly.
I think that replacing MathRound with a custom implementation is a bad idea, since you cannot be sure that there are no other bugs on the system configurations on which MathRound does not work correctly
https://www.mql5.com/en/forum/470651
As mentioned in the discussion at the link above, the bug may be in the physical CPU that your VPS uses.
It looks like the problem is unlikely to be resolved in the near future. I guess that the problem will not be solved at all.
Do not use VPS on which MathRound does not work correctly.
I think that replacing MathRound with a custom implementation is a bad idea, since you cannot be sure that there are no other bugs on the system configurations on which MathRound does not work correctly
Thanks for your reply.
From vps provider cannot solved this either. The only thing i do is asking for new vps. And its work.
That problem happend recently, for few month ago, that vps is working fine.
The issue you're encountering with the calculation returning 0 on your VPS but 0.02 on your laptop could be due to differences in how the environments are configured, specifically with regard to how they handle floating-point precision and rounding. Maybe do a test quick.....
Check MT4 versions on both your VPS and laptop to make sure they’re the same. You can also print intermediate values to see where the discrepancy arises. For example, print lots * 1.5 * 100 before rounding to see if it differs across environments. Then test a simple rounding script on both environments without EA involvement, isolating the issue to see if it’s specific to your VPS. Make sure locale settings on your VPS is right(especially language and number formatting). Hope it helps
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
The calculation above should produce 0.02, right?
But when I run the script in MT4 on one of my VPS the resulting number is 0.
When I try to log in to the same MT4 on my laptop and I run the script above the result is 0.02.
Does anyone know the reason why my VPS is different?
Because because of this, all my EA lot calculations were messed up