Not enough Money error
MT4?
There is one article about it related to MT5 but it is same logic:
Before sending every trade order, it is necessary to check if there are enough funds on the account. Lack of funds to support the future open position or order is considered a blunder.
- www.mql5.com
MT4?
There is one article about it related to MT5 but it is same logic:
Before sending every trade order, it is necessary to check if there are enough funds on the account. Lack of funds to support the future open position or order is considered a blunder.
Yes, in MT4, I found a solution using the same function that is described in the related article. Thank you!"
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); }
Hi everyone, I hope this message finds you well.
I am encountering an issue for the first time, specifically related to "Not enough Money" MQL4 TESTER (see image below).
I attempted to address this problem by using the minimum lot size, but unfortunately, that did not resolve the issue. Additionally, I implemented a custom function to check the volume value using CheckVolumeValue, but this also proved ineffective.
It's worth noting that no problems were observed during backtesting or while using a demo account.
If anyone has a solution or suggestion for handling this error, I would greatly appreciate your assistance.
Thank you in advance.