Get no money error even use standard code

 

Could anyone help me Pls!!!!

I get this error after try to sell EA on the market


test on EURUSD,H1 (netting) 2020.04.01 01:13:51 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:13:51 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.84, FreeMargin: -3.84 2020.04.01 01:13:51 not enough money [instant buy 0.6 EURUSD at 1.10306] 2020.04.01 01:13:51 failed instant buy 0.6 EURUSD at 1.10306 [No money] 2020.04.01 01:13:59 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:13:59 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.85, FreeMargin: -3.85 2020.04.01 01:13:59 not enough money [instant buy 0.6 EURUSD at 1.10308] 2020.04.01 01:13:59 failed instant buy 0.6 EURUSD at 1.10308 [No money] 2020.04.01 01:14:00 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:14:00 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.73, FreeMargin: -3.73 2020.04.01 01:14:00 not enough money [instant buy 0.6 EURUSD at 1.10289] 2020.04.01 01:14:00 failed instant buy 0.6 EURUSD at 1.10289 [No money] 2020.04.01 01:14:02 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:14:02 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.72, FreeMargin: -3.72 2020.04.01 01:14:02 not enough money [instant buy 0.6 EURUSD at 1.10287] 2020.04.01 01:14:02 failed instant buy 0.6 EURUSD at 1.10287 [No money] 2020.04.01 01:14:05 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:14:05 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.70, FreeMargin: -3.70 2020.04.01 01:14:05 not enough money [instant buy 0.6 EURUSD at 1.10284] 2020.04.01 01:14:05 failed instant buy 0.6 EURUSD at 1.10284 [No money] 2020.04.01 01:14:07 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 strategy tester report 711 total trade


i confused because i use below code to check before enter trade but still get an error pls help.

bool CheckMoneyForTrade(string symb,double lots,ENUM_ORDER_TYPE type)
  {
//--- Getting the opening price
   MqlTick mqltick;
   SymbolInfoTick(symb,mqltick);
   double price=mqltick.ask;
   if(type==ORDER_TYPE_SELL)
      price=mqltick.bid;
//--- values of the required and free margin
   double margin,free_margin=AccountInfoDouble(ACCOUNT_MARGIN_FREE);
   //--- call of the checking function
   if(!OrderCalcMargin(type,symb,lots,price,margin))
     {
      //--- something went wrong, report and return false
      Print("Error in ",__FUNCTION__," code=",GetLastError());
      return(false);
     }
   //--- if there are insufficient funds to perform the operation
   if(margin>free_margin)
     {
      //--- report the error and return false
      Print("Not enough money for ",EnumToString(type)," ",lots," ",symb," Error code=",GetLastError());
      return(false);
     }
//--- checking successful
   return(true);
  }
 
Chayakorn Rakwongthai:

Could anyone help me Pls!!!!

I get this error after try to sell EA on the market


test on EURUSD,H1 (netting) 2020.04.01 01:13:51 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:13:51 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.84, FreeMargin: -3.84 2020.04.01 01:13:51 not enough money [instant buy 0.6 EURUSD at 1.10306] 2020.04.01 01:13:51 failed instant buy 0.6 EURUSD at 1.10306 [No money] 2020.04.01 01:13:59 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:13:59 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.85, FreeMargin: -3.85 2020.04.01 01:13:59 not enough money [instant buy 0.6 EURUSD at 1.10308] 2020.04.01 01:13:59 failed instant buy 0.6 EURUSD at 1.10308 [No money] 2020.04.01 01:14:00 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:14:00 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.73, FreeMargin: -3.73 2020.04.01 01:14:00 not enough money [instant buy 0.6 EURUSD at 1.10289] 2020.04.01 01:14:00 failed instant buy 0.6 EURUSD at 1.10289 [No money] 2020.04.01 01:14:02 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:14:02 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.72, FreeMargin: -3.72 2020.04.01 01:14:02 not enough money [instant buy 0.6 EURUSD at 1.10287] 2020.04.01 01:14:02 failed instant buy 0.6 EURUSD at 1.10287 [No money] 2020.04.01 01:14:05 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 2020.04.01 01:14:05 calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 661.70, FreeMargin: -3.70 2020.04.01 01:14:05 not enough money [instant buy 0.6 EURUSD at 1.10284] 2020.04.01 01:14:05 failed instant buy 0.6 EURUSD at 1.10284 [No money] 2020.04.01 01:14:07 current account state: Balance: 658.00, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 658.00, Margin: 0.00, FreeMargin: 658.00 strategy tester report 711 total trade


i confused because i use below code to check before enter trade but still get an error pls help.

I already Fixed previous problem but get new one as below.Any one know how to fix this Thank you in advance.


test on EURUSD,H1 (netting) log files size exceeded 2097 MB, test terminated strategy tester report not found

 
Chayakorn Rakwongthai #: I already Fixed previous problem but get new one as below.Any one know how to fix this Thank you in advance. test on EURUSD,H1 (netting) log files size exceeded 2097 MB, test terminated strategy tester report not found

Forum on trading, automated trading systems and testing trading strategies

Validation error MT5

Fernando Carreiro, 2023.04.01 15:43

Reduce the number of log prints in your EA.You can have an input to control what data is printed to the log and set it to disabled by default. Then inform users to enable it if they wish to have more detailed information in the log.

Forum on trading, automated trading systems and testing trading strategies

Validation error MT5

Fernando Carreiro, 2023.04.01 17:36

Also, if the log overflow is due to trade order activity then refactor your strategy.

  • If you are constantly deleting and replacing pending orders, then don't. Improve the strategy, preferably by using market orders instead of pending orders if possible.
  • If you are updating stops continuously, the don't. Use a trailing step or a time step or any other method to reduce the update activity.
Reason: