
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
For those who jumped through all the hoops and tried all solutions here's what I wrote as a quite-reliable solution for myself.
If you still in search for solution this means you came across something like this:
coparing 107.123111111 and 107.123999 results in 107.123 being compared with 107124 as a result of double rounding variance.
Here's my solution for this problem that disregards range of +1 and -1 to remove double rounding variance from comparison.
Try this:
And here is another solution if simply comparing two doubles and requiring a bool result:
If they differ by a point, you return true. Which is wrong — they are not equal.
Simplify
Increase Order after stoploss - MQL4 programming forum #1.3 2017.05.29I like to use a function created by me that make easy for me to know what I did.
To test I use:
D_C( 5.564 , ">=" , 9.29)
D_C( 5.564 , "==" , 9.29)
Here is the function:
Simplify your code
Increase Order after stoploss - MQL4 programming forum #1.3 (2017)
return valor_teste_1>valor_teste_2;
You want the biggest value that can not be considered roundoff error or equivalently, the smallest value that can not be considered a price change. Since prices can only change by a multiple of point, point/2 is just that.
Hi. Isn't the 5 that would result from division of _Point/2 also rounded up hence also considered a price change. In that case, why not use the number just before (_Point/2)?
Could be rounded up 0.0000050000001, could be rounded down 0.0000049999999. A change in price is twice that.
Could be rounded up 0.0000050000001, could be rounded down 0.0000049999999.
But conventionally its rounded up right?
Would it be okay to modify your code which is equivalent to this
to this
No such thing. 0.1 can not be represented in floating point.
You are overthinking it. If a price changes by at least point - rounding, it has changed. Point/2 is less than that.
No such thing. 0.1 can not be represented in floating point.
Had overlooked that sir. And I guess the fact that in the 'real-world' computer 5 may round down factors in the >0.49 case.