4xidea:
It's an issue to do with comparing double variables . . . read this thread: Can price != price ?
I meet a weird mathematics problem. Does any expert help me resolve this problem ?
The alert result unexpectedly is "TotalLots > 0.7". What's wrong in this code and result ?
I got the problem and solution. Thank you, RaptorUK.
My code is changed to as below, and it works fine.
double BasicLot=0.1; int MaxPosition=7; double TotalLots = (BasicLot * MaxPosition); if(NormalizeDouble(TotalLots, 2) == NormalizeDouble(0.7, 2)) Alert("TotalLots == 0.7"); else if(NormalizeDouble(TotalLots, 2) > NormalizeDouble(0.7, 2)) Alert("TotalLots > 0.7"); else Alert("TotalLots < 0.7");
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
I meet a weird mathematics problem. Does any expert help me resolve this problem ?
The alert result unexpectedly is "TotalLots > 0.7". What's wrong in this code and result ?
The attachment is the source code of this testing script.