Great article! I was getting a lot of error code # 1's in my OrderModify calls for trailing stops. I kinda figured it was due to calling the function with no change in the parameters, but wasn't sure how to fix it. Using NormalizeDouble in my check for trailing stops took care of the problem.
Also was getting error code 4107 from my OrderSend function calls when using Strategy Tester. It seems Strategy Tester is using historical values at 5 decimal points, when I'm testing a currency pair with 4 decimal points. Using NormalizeDouble(Ask,Digits), or NormalizeDouble(Bid,Digits) in my OrderSend function took care of the error. Cool!
I am new to mql programming and the issue 1 discussed here( Verifying the numerical numbers) was a show stopper for me. Lucky I saw this within 6 months after starting mql programming. This I hope is sorted in mql5 and never heard of in any other high level languages that I am familiar with.
I am new to mql programming and the issue 1 discussed here( Verifying the numerical numbers) was a show stopper for me. Lucky I saw this within 6 months after starting mql programming. This I hope is sorted in mql5 and never heard of in any other high level languages that I am familiar with.
put the link of what I put in the forum, where I explain what I need, thank you very much aid they can offer me
https://www.mql5.com/en/forum/160483
I hope you can help me.
put the link of what I put in the forum, where I explain what I need, thank you very much aid they can offer me
https://www.mql5.com/en/forum/160483
I hope you can help me.
You can not do that that way (double has 15 significant digits)
If you need only the string you can declare it as a string right away and then you will not lose information - like this :
But any conversion to and from a double will leave you with only 15 accurate digits result
You can also check this : https://en.wikipedia.org/wiki/List_of_arbitrary-precision_arithmetic_software for arbitrary precision arithmetic libraries and software capable of doing it
The function double MathModCorrect(double a, double b) generates an error if the "a" and "b" parameters are below one (1). To be able to work with numbers below one (1) you can use the following function:
double MathModCorrect(double a, double b) { int i = 1; double El_Menor; if(a > b) El_Menor = b; else El_Menor = a; while(!El_Menor == int(El_Menor)) { a = a * i; b = b * i; El_Menor = El_Menor * i; i = i * 10; } int tmpres = a / b; return((a - tmpres * b) / i); }
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Working with Doubles in MQL4 has been published:
Author: MetaQuotes Software Corp.