Floating-point has an infinite number of decimals, it's you, not understanding floating-point and that some numbers can't be represented exactly. (like 1/10.)
Double-precision floating-point format - Wikipedia
See also The == operand. - MQL4 programming forum (2013)
If you want to see the correct number of digits, convert it to a string with the correct/wanted accuracy.
question about decima of marketinfo() - MQL4 programming forum (2016)
Hi William thanks for the reply. I just need to instantiate the my double variable to 0.0 instead of just 0 because then there's a conversion from int to double which may produce inaccuracies.
No, that has nothing to do with the issue. You need to take some time to understand how binary floating point numbers work and that they as "binary" cannot completely represent normal "decimal" number very easily. There will always be slight misrepresentations and rounding errors.
To better work with these numbers, in the case of volume, you should align them to the SYMBOL_VOLUME_STEP value.
Forum on trading, automated trading systems and testing trading strategies
Volume Limit Reached - Validation for new Expert Advisor error
Fernando Carreiro, 2022.07.22 18:22
Your EA must be coded to read the broker's contract specifications, such volume limitations, and prevent that from happening.
SYMBOL_VOLUME_MIN
double
SYMBOL_VOLUME_MAX
Maximal volume for a deal
double
SYMBOL_VOLUME_STEP
Minimal volume change step for deal execution
double
SYMBOL_VOLUME_LIMIT
Maximum allowed aggregate volume of an open position and pending orders in one direction (buy or sell) for the symbol. For example, with the limitation of 5 lots, you can have an open buy position with the volume of 5 lots and place a pending order Sell Limit with the volume of 5 lots. But in this case you cannot place a Buy Limit pending order (since the total volume in one direction will exceed the limitation) or place Sell Limit with the volume more than 5 lots.
double
Forum on trading, automated trading systems and testing trading strategies
How to calculate lots using multiplier according to number of opened orders?
Fernando Carreiro, 2017.09.01 21:57
Don't use NormalizeDouble(). Here is some guidance (code is untested, just serves as example):
// Variables for Symbol Volume Conditions double dblLotsMinimum = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_MIN ), dblLotsMaximum = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_MAX ), dblLotsStep = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_STEP ); // Variables for Geometric Progression double dblGeoRatio = 2.8, dblGeoInit = dblLotsMinimum; // Calculate Next Geometric Element double dblGeoNext = dblGeoInit * pow( dblGeoRatio, intOrderCount + 1 ); // Adjust Volume for allowable conditions double dblLotsNext = fmin( dblLotsMaximum, // Prevent too greater volume fmax( dblLotsMinimum, // Prevent too smaller volume round( dblGeoNext / dblLotsStep ) * dblLotsStep ) ); // Align to Step value
Forum on trading, automated trading systems and testing trading strategies
Looking for indicator that gives the info tp of the globality of open trades please
Fernando Carreiro, 2022.10.12 16:05
No such indicator exists as far as I known. It will have to be coded (use the Freelance section), but it will be easier to just have your existing EA be modified to show that target on the chart using the following maths:
![]()
- vi = volume of individual position
- oi = open price of individual position
- ci = close price of individual position
- Vn = total volume for a basket of positions
- On = net mean open price for a basket of positions
- Cn = net mean close price for a basket of positions
- PLn = profit/loss for a basket of positions

- 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 all,
I am writing a function to get the netting for a particular magic and symbol.
But somehow I get a very minute amout (0.00000000000000004) at the end of the amount even though the answer should just be 0.3.
Can anyone explain why's that happening?
Here's the Position Data :
Here's the print result :
2022.11.03 21:44:20.910 Test (EURUSD,D1) Cycle Data is 0.1
2022.11.03 21:44:20.910 Test (EURUSD,D1) Cycle Data is 0.1
2022.11.03 21:44:20.910 Test (EURUSD,D1) Cycle Data is 0.1
2022.11.03 21:44:20.910 Test (EURUSD,D1) volLong vShort 0.30000000000000004 0.4
2022.11.03 21:44:20.910 Test (EURUSD,D1) Data is -0.09999999999999998
Here's the code :