Forum on trading, automated trading systems and testing trading strategies
Hello,
Please EDIT your post and use the SRC button when you post code.
Thank you.
Ok it's done do you have an idea why I keep getting error message 131 order send failure
backtesting is OK
Ok it's done do you have an idea why I keep getting error message 131 order send failure
backtesting is OK
I am not a coder sorry (I just hope the members will help).
Ok it's done do you have an idea why I keep getting error message 131 order send failure
backtesting is OK
Did you check the meaning of error 131 ?
See this article ...

- 2016.08.01
- MetaQuotes Software Corp.
- www.mql5.com
Did you check the meaning of error 131 ?
See this article ...
yes I already checked it it deals with invalid Volume , my issue is the following my EA works fine in back testing no errors in demo as well but when i tried to sell my EA it should pass through automatic validation and suddenly this error pops up i can't figure out the origin
I have tried to investigate on min, max lot size LOtsize ans step LOT i got the followings 100000 ( standard ) min 0.01, max 50 and step 0.01
i am trying hard to find out the issue to correct it but .....diffcult !!!
Hi Adel,
At your EA trade management, at least you should have a function to pass these checks :
Print("Minimum permitted amount of a lot=",MarketInfo(Symbol(),MODE_MINLOT)); Print("Step for changing lots=",MarketInfo(Symbol(),MODE_LOTSTEP)); Print("Maximum permitted amount of a lot=",MarketInfo(Symbol(),MODE_MAXLOT));
and when opening and closing position then your loop can manage at least for these error numbers :
//-- if your loop find error in this string then do something. you can also add another error number inside the var. string errcode="129;130;131;135;136;137;138";
Good luck.
Hi Adel,
At your EA trade management, at least you should have a function to pass these checks :
and when opening and closing position then your loop can manage at least for these error numbers :
Good luck.
Thank you but I am still struggling can't figure out how to pass these checks and what's the appropriate function
Thank you but I am still struggling can't figure out how to pass these checks and what's the appropriate function
Yes, I understand you.
Here is an example how to check your lot is enough for current margin or not enough (error will occurs).
You can use it before OrderSend(), because you should check lot size is enough for open trade.
if(CheckMoneyForTrade(Symbol(),your_current_lot,OP_BUY)==false) { //--if you want to use email alert if(alert_email==true) SendMail("Not enough margin.","Your account is not enough margin to make new position buy."); //--if you want to use smartphone alert if(alert_hp==true) SendNotification("Your account is not enough margin to make new position buy."); Print("Your account is not enough margin to make new position buy."); //-- do something, back to main loop } else { Print("* Opening position Buy..."); //--your code here for opening trade buy, and so on. }
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 position=(type==OP_BUY)? "Buy":"Sell"; Print("Not enough money for ", position," ",lots, " ", symb, " Error code=",GetLastError()); return(false); } //--- checking successful return(true); }
Good luck ͡ᵔ ͜ʖ ͡ᵔ
Yes, I understand you.
Here is an example how to check your lot is enough for current margin or not enough (error will occurs).
You can use it before OrderSend(), because you should check lot size is enough for open trade.
Good luck ͡ᵔ ͜ʖ ͡ᵔ
sorry for late reply
many thanks for the idea still diidn't manage to resolve it
i will keep trying

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use