
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
float is the castration of numbers and offers no advantage. Better deal with all the losses in conversions and use the highest possible precision - double.
Thank you. I'll try to figure out where my error was. In the meantime, the float is working. I'm not used to quitting. But this error threw me for a loop.
Personally, I never use in calculations and comparisons of numbers the method comparing difference with some minimal accepted value, I always work with maximum possible accuracy up to 16th sign, and only in last operation I do normalization. If you handle double correctly there is no problem, which I advise you to do, otherwise you will encounter problems in distortion of the results associated with a loss of accuracy in one of the steps of the calculations / conversions.
It's up to you, but note that ALL standard math functions work with double numbers and give double results. Applying these functions to float numbers is still an internal conversion to double, so in any case, you will lose accuracy and validity in the results obtained.
Personally, I never use in calculations and comparisons of numbers the method comparing difference with some minimal accepted value, I always work with maximum possible accuracy up to 16th sign, and only in last operation I do normalization. If you work with double correctly no problems, which I advise you to do, otherwise you will encounter problems with distortion of the results associated with a loss of accuracy in one of the steps of the calculations / conversions.
the rating price in 2017 is unabashedly correct
the rating price in 2017 is unabashedly correct
that's how it should be
double AUTOPRICE=MathFloor( NormalizeDouble(Averab,2) )*_Point;
it should be like this.
double AUTOPRICE=MathFloor( NormalizeDouble(Averab,2) )*_Point;
You've changed your code several times.
I did the same thing. I experimented, I understood what double and int are, but when I explicitly calculated they were not what I needed.
The first line is what you suggested.
2017.02.26 18:24:59.133 2017.01.02 00:03:00 Exp - DOUBLE TEST MATHFLOOR EURUSD,M30: DOUBLE askP2=105146 bidP2=105141 Averab2=105143.5000000000 AUTOPRICE=1.0514300000
2017.02.26 18:24:59.133 2017.01.02 00:03:00 Exp - DOUBLE TEST MATHFLOOR EURUSD,M30: FLOAT askP=105146 bidP=105141 Averab=105143.5000000000 AUTOPRICE=1.0514299870
so that's right105143.5000000000 rounded down to 43...
(46-41)/2 = 2.5, rounded down = 2
so that's right105143.5000000000 rounded down to 43...
(46-41)/2 = 2.5, rounded down = 2
that's right,
but with different spreads (2,3,4,5,6,7) the downward rounding is different and sometimes not quite accurate.