there are no trading operations - page 2

 
Yong Zhang:

I know the reason, but it's not yet solved

Before the order is sent, it needs to be checke the money , I used the codeBase instance function:CheckMoneyForTrade

Found that delete this function will not appear:“there are no trading operations”

But this function is necessary


Have you solved this yet? I have the exact problem. Thanks

 

Hei Dudes, that problem is because you have to :

 1- Check if volume for operation is correct: 


 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);

      return(false);

     }



//--- 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);

      return(false);

     }



//--- 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);

  }

 2- Check, if theres enough money to open a position. Example, if ur account balance goes down, it will be a time when "not enough money to open position" error will prompt, so thats why u get that error.


 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);

  }

In my EA i do not use pending orders, soif u use pending orders u may have other problems because of that.

Anyway, the answer is here:  https://www.mql5.com/en/articles/2555

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • 2016.08.01
  • MetaQuotes Software Corp.
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products. If any errors are identified by the Market...
 

Hello All.

Just to add a potential solutions...

I had the exact same problem. None of the above suggestions worked. I even went through the whole article "The checks a trading robot must pass before publication in the Market". All was according the instructions there.

In the end, after a lot of trial and error, what worked in my case was to cap the maximum length of the OrderComment in the OrderSend function to 20 letters, as my order comment was a concatenated text:

input string dealcomment = "EA-Trader";

... and in OnTick()-function (with DealCount being an integer variable that holds the current number of trades of Symbol/MagicNumber:

string n=(string)(DealCount+1);

string comm = n+" "+dealcomment; 

string commSend = StringSubstr(comm,0,MathMin(20,StringLen(comm)-1));

int Order = OrderSend(_Symbol,OP_SELL,StartLots,SymbolInfoDouble(_Symbol,SYMBOL_BID),UseSlippage,0,0,commSend,MagicNumber,0,clrRed);

Happiness to all
Cristof

 

Hi!

I've tried the same as you, @Cristof Ensslin , but it didn't work either... so I'm still getting the "there are no trading operations", although everything works (and very well) in Real account...

Any help from Metaquotes (for instance, a kind of "How to solve common problems") would be very much appreciated...

Regards from Spain!

Bruno

 
This problem simply solved with add an minimum account balance and equity control in start() function. for example control that balance and equity not be less than $10.

if(AccountBalance() < 10) {
   Comment("minimum balances is $10" );
   return 0;
 
Shahram Amiri:
This problem simply solved with add an minimum account balance and equity control in start() function. for example control that balance and equity not be less than $10.

if(AccountBalance() < 10) {
   Comment("minimum balances is $10" );
   return 0;

It doesn't work either (

Also I made my EA for M15 timeframe only. Validation tested it at H1. Ok, I check at my PC - all works. 


Admins do something.

 
You can run it on any timeframe if it was made for M15 it should work on H1 as well, making 4 cycles in one hour.
 
Stephen Reynolds:

I test me EA on my own broker it works okay. But when I send in for validation I get the following :

test on EURUSD,H1
there are no trading operations
test on NZDUSD,H1
there are no trading operations
test on GBPUSDcheck,M30
there are no trading operations
test on XAUUSDcheck,Daily
there are no trading operations

What does this mean?

I have the same problem. I never had this problem before. Even the older published versions are presenting the same problem where I submit it to the automatica validation.

 


In the sample of the CheckVolumeValue function,false is returned.

Therefore, it will be an error not to trade even once.

Instead, you should change the volume.

The correction example is as follows.

//+------------------------------------------------------------------+

//| Check the correctness of the order volume                        |
//+------------------------------------------------------------------+
//bool CheckVolumeValue(double volume,string &description)
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);
      //return(false);
      volume=min_volume;
     }

//--- 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);
      //return(false);
      volume=max_volume;
     }


 

You have to run the request through :

OrderCheck()
Among a ton of other checks you should perform/.
Reason: