Hello,
Try to change the start lot in the setting of the uploaded EA
Please check this article: https://www.mql5.com/en/articles/2555
There is even source code already implemented so you just need to integrate the checks before making a trade.
- www.mql5.com
Please check this article: https://www.mql5.com/en/articles/2555
There is even source code already implemented so you just need to integrate the checks before making a trade.
done it, but so wierd aye, like now ive run checks on checkvolumevalue and checkmoneyfortrade before any trade set and made some changes and get this error! where it says invalid volume 0, still I have no 0 volume trades on my system, also I run the tester and same all working fine and no 0 volume trades or errores, going mad with this issues XD
Forum on trading, automated trading systems and testing trading strategies
failed instant - Invalid volume
Vinicius Pereira De Oliveira, 2024.05.12 00:14
No, that's not quite it... We are talking about two checks (among many others) that must be carried out by your EA to pass automatic validation: normalization and volume verification (to correct the current error) and sufficiency check of funds to trade... Let's go from the beginning:
1. The article suggested by Yashar presents, with examples, the tests that the EA must pass during automatic validation for publication on the Market, among which I highlight:
- Insufficient funds to perform trade operation
- Invalid volumes in trade operations
- Limiting Number of Pending Orders
- Limiting Number of Lots by a Specific Symbol
- Setting the TakeProfit and StopLoss levels within the SYMBOL_TRADE_STOPS_LEVEL minimum level
- Attempt to modify order or position within the SYMBOL_TRADE_FREEZE_LEVEL freeze level
2. You can see that the first test highlighted above is checking the sufficiency of funds to trade, which is what Marzena commented on.
3. The second test highlighted is the validity of the volume of operations (which is precisely where your EA is currently showing an error). In the article, the CheckVolumeValue() function is presented, however, this function only returns whether the volume is valid or not, but does not correct for the proper volume. Therefore, I suggested above using the NormalizeVolume() function to make this correction (before checking), if necessary, understand? For example, if your EA uses a fixed lot of 0.05 in the input parameters by default, but during automatic validation the minimum lot of the tested symbol is 0.10, if normalization was not performed, an invalid volume error will occur when opening a position, but if the NormalizeVolume() function is used, the minimum symbol lot (0.10) will be used when sending the order.
4. See too:
Forum on trading, automated trading systems and testing trading strategies
Desperate "No trading operations" error
Vinicius Pereira De Oliveira, 2024.04.21 14:42
It must be corrected, Juan. For example: if the EA uses a fixed volume parameter and by default this volume is set at 0.01, but during validation testing the tested symbols do not allow volume 0.01, then the EA does not open a position and will not be able to be published. So, to avoid this problem, you can use a function like the following, in addition to the volume checks recommended in the article:
//+--------------------------------------------------------------------------------------------------------------------+ //| This function normalizes the volume according to the minimum volume change step | //+--------------------------------------------------------------------------------------------------------------------+ double NormalizeVolume(double Lot) { ResetLastError(); //--- Minimal and maximal allowed volume for trade operations double LotMin = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); double LotMax = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX); //--- Get minimal step of volume changing double LotStep = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP); //--- Check if an execution error occurred if(GetLastError() != ERR_SUCCESS) { return(WRONG_VALUE); } //--- Normalizes the volume Lot = LotMin + MathFloor((Lot - LotMin) / LotStep) * LotStep; Lot = NormalizeDouble(MathMin(LotMax, MathMax(LotMin, Lot)), 2); //--- Normalized volume return(Lot); }
done it, but so wierd aye, like now ive run checks on checkvolumevalue and checkmoneyfortrade before any trade set and made some changes and get this error! where it says invalid volume 0, still I have no 0 volume trades on my system, also I run the tester and same all working fine and no 0 volume trades or errores, going mad with this issues XD
mm well I had normalized everything already, anyways I did it again with your code, still same error, pretty weird as EURUSD can be traded with 0.01 and 0.02 lots which is what the EA is sending orders. Tests are doing good as well is rare I get this errors of volume = 0 errors
then DONE!, simply added a filter to lots>0 before every order.saw this case before in someone's EA, but he fixed it
Do you have somewhere in the code where it tries to calculate a minimum lot size from the broker? for example by means of the LotsMin() function from SymbolInfo.mqh
This can easily return 0.00 for the lotsize unless you call the name function before using it
CSymbolInfo m_symbol;
m_symbol.Name(Symbol());
double minvol = m_symbol.LotsMin();
- 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've coded an mql5 EA, it works all good in my PC, still when uploading it a test is run and says no trades taken, invalid volume(=0) so wierd,
any advice???
thanks!