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
Thanks all for help me,
I using code of Thirteen. It can round a number 1.23455 to 1.2345 ( 4 digits) and 1.23456 to 1.2346
Cool, just for good measure using everyone's favourite function NormalizeDouble...
OR
I know this is an old post, I'm just adding the function I wrote to perform bankers rounding the same way that Math.Round in C# does it in case someone stumbles across this post looking for the same info I was. The code above didn't produce the same results as Math.Round, so I wrote one of my own :-)
MQL code:
And if you want to validate it in CSharp
Notice that calling Math.Round(dNumber, nDigits, MidpointRounding.AwayFromZero); will round the same way as NormalizeDouble...if you were looking to have C# code act the same way as your EA.
Cheers
a bit late :)
but how about