Minimum Volume Info
-
Hi people!
In order to get a proper partial closing and avoid the "Invalid Volume" log, I would like to calculate this partial volume with a variable. Do you know how can I get the minimum volume value on the EA? Maybe on Market Properties? I could do it with a constant (introducing 0.01 for Forex and 0.1 for indexes, e.g.) but I some of you know it...
Thank you very much!
-
@afgmarkets this bunch of code returns the minimum volume:
SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN)
https://www.mql5.com/en/docs/marketinformation/symbolinfodouble
https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_double
However the partial closing bug is not just about minimum volume, but also lack of rounding (or flooring) the number.
You can do the % calculation manually and then just put the code in Custom input field instead of the percent field.This code calculates 33% of your position and then floors the value to nearest hundredth:
MathFloor(PositionGetDouble(POSITION_VOLUME)*0.33 *100)/100