Seems I got it working with the part of the following code
double step = 25; double pricerounded = DoubleToString(step * round(Bid / step),2);
source: https://www.mql5.com/en/forum/234245/page2#comment_6999138
NormalizeDouble(Bid, Digits)
- 2018.04.04
- www.mql5.com
I want to get exact BID,ASK value with normalization. But i can not able to do that following most popular way...
DoubleToString returns a string. You can't assign that to a double if you used strict. Always use strict. Fixing the warnings will save you hours of debugging.
Program Properties (#property) - Preprocessor - Language Basics - MQL4 Reference
See
MT4:NormalizeDouble - General - MQL5 programming forum
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum
Program Properties (#property) - Preprocessor - Language Basics - MQL4 Reference
See
MT4:NormalizeDouble - General - MQL5 programming forum
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum
I've changed it and will keep this in mind for the future. Thanks for pointing it out.
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
Hello,
I am trying to figure out how to get the current price (DAX/GER30 with 2 decimals i.e 12263.71) and convert it to the next closest round number up/or down that ends in 00,25,50 or 75 -> 12275.00
I am trying with:
But this only returns 12263. Scratching my head now on how to get this rounded up to -> 12275.00 or down to -> 12250.00
Any help is greatly appreciated, thank you.