It may happened if you are sending a smaller volume than SYMBOL_VOLUMEN_MIN or greater than SYMBOL_VOLUME_MAX.
You can obtain that information in this way:
double minSymbolLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUMEN_MIN);
double maxSymbolLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUMEN_MAX);
The lot must be between SYMBOL_VOLUMEN_MIN and SYMBOL_VOLUME_MAX.
And a multiple of lot step.
double LotAdjuster(double lots)
{
double minlot = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN),
maxlot = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX),
lotstep = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
lots = MathRound(lots/lotstep)*lotstep;
lots = MathMax(lots,minlot);
lots = MathMin(lots,maxlot);
return(lots);
}
{
double minlot = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN),
maxlot = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX),
lotstep = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
lots = MathRound(lots/lotstep)*lotstep;
lots = MathMax(lots,minlot);
lots = MathMin(lots,maxlot);
return(lots);
}
Thanks to both of you .. that was very helpful and I got it working!

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
I've copied the script exactly from the docs:
https://www.mql5.com/en/docs/trading/ordersend
...but the script returns 10014 Invalid Volume.
Can anyone help me?
Thanks in advance.