
- MT5 EA validation giving "there are no trading operations"
- Validation of EA failed before publish to Market for selling
- my EA validation failed with the message
You've set a fixed lot size of 0.01, but if the trading account doesn't accept this micro-lot, the EA simply won't open a position. This needs improvement. I did a very basic implementation in your code just to confirm this theory, and the EA passed the automatic validation:
//+------------------------------------------------------------------+ //| MinimalEA.mq4 | //| Copyright 2026, Test26.com | //| https://www.Test26.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2026, Test26.com" #property link "https://www.Test26.com" #property version "2.03" #property strict #define EAName "EA_Test_V2" #property description EAName //--------------------------------------------------------- input int Mgc = 12345;//Magic Number input double Lots = 0.01; input double TP = 400; input double SL = 200; int Cb = _Digits==3?10:1;//Calibration for 3 Digits Price string myDes = "";//Volume Value Description double g_lot = Lots; //+------------------------------------------------------------------+ //| Expert initialization & deinitialization function | //+------------------------------------------------------------------+ int OnInit() { if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) return(INIT_FAILED); return(INIT_SUCCEEDED); } //------------------------------- void OnDeinit(const int reason) {} //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //----------------------------- check everything ----- if(Bars<100 || !TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) || OrdersTotal()>0 || !CheckMoneyForTrade(_Symbol,g_lot,OP_BUY) || !CheckMoneyForTrade(_Symbol,g_lot,OP_SELL) || !CheckVolumeValue(g_lot,myDes)) { Print(myDes); return; } //------------------------------------ BUY ----------------------- if(OrderSend(_Symbol,OP_BUY,g_lot,Ask,3,SL==0?0:Ask-SL*_Point*Cb,//Set SL Value TP==0?0:Ask+TP*_Point*Cb,//Set TP Value "",Mgc,0,Lime)!=-1) //Return Value Print("New Position Opened"); else Print("Error ",GetLastError()); //------------------------------------ SELL ---------------------- if(OrderSend(_Symbol,OP_SELL,g_lot,Bid,3,SL==0?0:Bid+SL*_Point*Cb,//Set SL Value TP==0?0:Bid-TP*_Point*Cb,//Set TP Value "",Mgc,0,Red)!=-1) //Return Value Print("New Position Opened"); else Print("Error ",GetLastError()); } //+------------------------------------------------------------------+ //| Check the correctness of the order volume | //+------------------------------------------------------------------+ bool CheckVolumeValue(double &volume,string &description) { //--- minimal allowed volume for trade operations double min_volume=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN); if(volume<min_volume) { description=StringFormat("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume); volume = min_volume; return(true); } //--- maximal allowed volume of trade operations double max_volume=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX); if(volume>max_volume) { description=StringFormat("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume); volume = max_volume; return(true); } //--- get minimal step of volume changing double volume_step=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP); int ratio=(int)MathRound(volume/volume_step); if(MathAbs(ratio*volume_step-volume)>0.0000001) { description=StringFormat("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f", volume_step,ratio*volume_step); return(false); } description="Correct volume value"; return(true); } //+------------------------------------------------------------------+ //| Check sufficient funds to perform trade operation | //+------------------------------------------------------------------+ bool CheckMoneyForTrade(string symb, double lots,int type) { double free_margin=AccountFreeMarginCheck(symb,type, lots); //-- if there is not enough money if(free_margin<0) { string oper=(type==OP_BUY)? "Buy":"Sell"; Print("Not enough money for ", oper," ",lots, " ", symb, " Error code=",GetLastError()); return(false); } //--- checking successful return(true); } //------------------------------------- Test26.com 19/06/2026 ----------------------------- //+------------------------------------------------------------------+
But please, this was just a test example, don't take it seriously. 😁 See the following code for how to properly validate the volume (and other important validations):
Vinicius Pereira De Oliveira, 2017.01.25 09:12
Asian Range Breakout day-trading EA. Multi-symbol, M15/M30/H1. Places pending stop orders during the London session outside the pre-London Asian range, using PSAR + MACD + Stochastic signals, with automatic London/NY DST handling, structural stops, trailing and break-even.You've set a fixed lot size of 0.01, but if the trading account doesn't accept this micro-lot, the EA simply won't open a position. This needs improvement. I did a very basic implementation in your code just to confirm this theory, and the EA passed the automatic validation:
But please, this was just a test example, don't take it seriously. 😁 See the following code for how to properly validate the volume (and other important validations):
3. Test result of the CodeBase code I recommended as an example, which failed for you:
1. Test result of your example code:
Okay, @Nino Guevara Ruwano, all right, we'll manage to solve this. Note that in the following test, what prevented the EA from uploading wasn't the "no trading operations" error (since it opened 312 trades in EURUSD/H1), it was "error 130" (if I read correctly):
So, with just the corrections I suggested earlier, the EA would already overcome the "no trading operations" error. What you will need to do now:
1. Based on this guideline I've given you, you will work to make your volume validation much more robust, so that the EA trades with any volume specifications from any broker/symbol;
2. You will work to include robust validation in your EA to overcome this "error 130", that is, before trying to include a new position, close or modify an existing position, perform the following check (example):
//+--------------------------------------------------------------------------------------------------------------------+ //| Validate stops level //+--------------------------------------------------------------------------------------------------------------------+ bool CheckStopsLevel(string symbol, ENUM_ORDER_TYPE type, double sl, double tp) { if(g_cache.stopsLevel == 0) return true; RefreshRates(); double price = (type == OP_BUY) ? MarketInfo(symbol, MODE_BID) : MarketInfo(symbol, MODE_ASK); double minDistance = g_cache.stopsLevel * g_cache.point; if(type == OP_BUY) { if(price - sl <= minDistance) return false; if(tp - price <= minDistance) return false; } else { if(sl - price <= minDistance) return false; if(price - tp <= minDistance) return false; } return true; }
Okay, @Nino Guevara Ruwano, all right, we'll manage to solve this. Note that in the following test, what prevented the EA from uploading wasn't the "no trading operations" error (since it opened 312 trades in EURUSD/H1), it was "error 130" (if I read correctly):
So, with just the corrections I suggested earlier, the EA would already overcome the "no trading operations" error. What you will need to do now:
1. Based on this guideline I've given you, you will work to make your volume validation much more robust, so that the EA trades with any volume specifications from any broker/symbol;
2. You will work to include robust validation in your EA to overcome this "error 130", that is, before trying to include a new position, close or modify an existing position, perform the following check (example):
Here are the results of the Minimalist EA that I used for testing, which finally passed the validation process:

//+------------------------------------------------------------------+ //| MinimalEA.mq4 | //| Copyright 2026, Test26.com | //| https://www.Test26.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2026, Test26.com" #property link "https://www.Test26.com" #property version "2.03" #property strict #define EAName "EA_Test_V2" #property description EAName //--------------------------------------------------------- input int Mgc = 12345;//Magic Number input double Lots = 0.01; input double TP = 50; input double SL = 0; int Cb = _Digits==3?10:1;//Calibration for 3 Digits Price string myDes = ""; //Volume Value Description double myLots = Lots; //Lots Variable //+------------------------------------------------------------------+ //| Expert initialization & deinitialization function | //+------------------------------------------------------------------+ int OnInit(){ if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) return(INIT_FAILED); return(INIT_SUCCEEDED); } //------------------------------- void OnDeinit(const int reason){} //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick(){ if(Volume[0]>1) return;//Go trading only for first tiks of new bar //----------------------------- check everything ----- if(Bars<100 || !TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) || OrdersTotal()>0 || !CheckMoneyForTrade(_Symbol,myLots,OP_BUY) || !CheckMoneyForTrade(_Symbol,myLots,OP_SELL) || !CheckVolumeValue(myLots,myDes)){Print(myDes); return; } long StopLevel=SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL); double nTP=TP<StopLevel?StopLevel:TP; double nSL=SL<StopLevel?StopLevel:SL; //------------------------------------ BUY ----------------------- if(OrderSend(_Symbol,OP_BUY,myLots,Ask,3,SL==0?0:Ask-nSL*_Point*Cb,//Set SL Value TP==0?0:Ask+nTP*_Point*Cb,//Set TP Value "",Mgc,0,Lime)!=-1) //Return Value Print("New Position Opened"); else Print("Error ",GetLastError()); //------------------------------------ SELL ---------------------- if(OrderSend(_Symbol,OP_SELL,myLots,Bid,3,SL==0?0:Bid+nSL*_Point*Cb,//Set SL Value TP==0?0:Bid-nTP*_Point*Cb,//Set TP Value "",Mgc,0,Red)!=-1) //Return Value Print("New Position Opened"); else Print("Error ",GetLastError()); } //+------------------------------------------------------------------+ //| Check the correctness of the order volume | //+------------------------------------------------------------------+ bool CheckVolumeValue(double &volume,string &description){ //--- minimal allowed volume for trade operations double min_volume=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN); if(volume<min_volume){ description=StringFormat("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume); volume = min_volume; return(true);} //--- maximal allowed volume of trade operations double max_volume=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX); if(volume>max_volume){ description=StringFormat("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume); volume = max_volume; return(true);} //--- get minimal step of volume changing double volume_step=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP); int ratio=(int)MathRound(volume/volume_step); if(MathAbs(ratio*volume_step-volume)>0.0000001){ description=StringFormat("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f", volume_step,ratio*volume_step); return(false);} description="Correct volume value"; return(true);} //+------------------------------------------------------------------+ //| Check sufficient funds to perform trade operation | //+------------------------------------------------------------------+ bool CheckMoneyForTrade(string symb, double lots,int type){ double free_margin=AccountFreeMarginCheck(symb,type, lots); //-- if there is not enough money if(free_margin<0) { string oper=(type==OP_BUY)? "Buy":"Sell"; Print("Not enough money for ",oper," ",lots," ",symb," Error code=",GetLastError()); return(false);} //--- checking successful return(true);} //------------------------------------- Test26.com 19/06/2026 -----------------------------
I hope this explanation is helpful to our friends on our beloved forum.
#include <Trade/Trade.mqh> CTrade trade; void OnTick() { static bool traded = false; if(traded) return; if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) { Print("Trading is not allowed in terminal."); return; } if(!MQLInfoInteger(MQL_TRADE_ALLOWED)) { Print("Trading is not allowed for this program."); return; } double volume = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); if(volume <= 0.0) { Print("Invalid minimum volume for symbol: ", _Symbol); return; } double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK); if(ask <= 0.0) { Print("Invalid Ask price for symbol: ", _Symbol); return; } if(trade.Buy(volume, _Symbol)) { Print("Test trade opened successfully."); traded = true; } else { Print("Buy failed. Retcode: ", trade.ResultRetcode(), " Description: ", trade.ResultRetcodeDescription()); } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use







