- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor -
Your question/problem has nothing to do with FIFO.
-
Floating point has infinite number of decimals, it's your not understanding floating point and that some numbers can't be represented exactly. (like 1/100.)
Double-precision floating-point format - Wikipedia, the free encyclopedia
0.01 + 0.01 + 0.01… does not equal 0.0n. Drop your b=-1; Find the largest OrderLots. Then return your
next size (0.01 more.)
Hi, I'M not very skilled in MQL4, and havig problems with the lot size in my EA, where souldn't be to orders open with the same Lot Size at the same time. I made a For loop that finds if there's an open order with the same Lot Size as the intended one, and if its true, adds 0.01 to the lot size, but works ok for the first 3 orders opened, and then repeats the values. Could somebody tell me where the error is?
Thanks a lot!
Gustavo
Thanks William! Now I Know how to paste the code so it looks like MQL4....
So You can't compare two numbers to find if they are equal, even if you NormalizeDouble () both to same digits after 0?
I didn't want to add 0.01 to the largest, because I wouldn't need to if there's no need to. For example, if the largest lot size open is 0.37, and the intended lot size is 0.75, I would've end up with a Lot Size of 0.38 instead of 0.75....
Thanks again,
Gustavo
Thanks William! Now I Know how to paste the code so it looks like MQL4....
So You can't compare two numbers to find if they are equal, even if you NormalizeDouble () both to same digits after 0?
I didn't want to add 0.01 to the largest, because I wouldn't need to if there's no need to. For example, if the largest lot size open is 0.37, and the intended lot size is 0.75, I would've end up with a Lot Size of 0.38 instead of 0.75....
Thanks again,
Gustavo
Hi, I finally corrected it, as the problem was comparing two floating points, that they look equal but are different by several digits after the comma, instead of comparing them, I asked if the difference between them is less than 0.001, then they are equal, and is working perfect.
Every day I leran a little bit more!
Thanks
Gustavo
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I'M not very skilled in MQL4, and havig problems with the lot size in my EA, where souldn't be to orders open with the same Lot Size at the same time. I made a For loop that finds if there's an open order with the same Lot Size as the intended one, and if its true, adds 0.01 to the lot size, but works ok for the first 3 orders opened, and then repeats the values. Could somebody tell me where the error is?
Thanks a lot!
Gustavo