Troubled by the error there are no trading operations - page 21

 
Arkadii Zagorulko:

Exactly MT5...

They say only MT4 is the problem.

Maybe it's a sabotage to switch to MT5...

 

If it helps anyone, here's how I passed the validation. EA without stops and order modifications but on all timeframes.

Validator gave error 131 (wrong lot) and no trades. This is my first EA, so there were probably all the mistakes I made.

First I've added all English comments to check trading functions, i.e. if EA does not trade, it should output error in Print().

I also added check for free margin and removed ExpertRemove() but it didn't help, errors still remained the same.

void buy()
  {
   if(AccountFreeMarginCheck(Symbol(),OP_BUY,Lots)>0)
     {
      if(OrderSend(_Symbol,OP_BUY,Lots,Ask,Slip,SLb,0,comment,Magic,0,Green)<1)
         Print(" Buy ​​order error !"+ IntegerToString(_Period,0) +" Error code = " + IntegerToString(GetLastError(),0));
     }
   else
      Print("Not enough money!" +" Error code = " + IntegerToString(GetLastError(),0));
      /// ExpertRemove();
   return;   
  }

I made several other changes at once, and I do not know which of them helped.

I reset errors at the beginning and at the end of the Expert Advisor, checked quotes for all TFs

int OnInit()
  {
    ResetLastError();   

      for(int cycle=1; cycle<=5; cycle++)
     {
      switch(cycle)
        {
         case 1:
            TF = PERIOD_D1;
            break;
         case 2:
            TF = PERIOD_H4;
            break;
         case 3:
            TF = PERIOD_H1;
            break;
         case 4:
            TF = PERIOD_M15;
            break;
         case 5:
            TF = PERIOD_M5;
            break;
        }
   if(iTime(_Symbol,TF,Limit)<1)
     Print("Missing quotes! " + IntegerToString(TF,0) + " Timeframe"+" Error = " + IntegerToString(GetLastError(),0));            
     }      
   return(INIT_SUCCEEDED);
  }
//****************************
void OnDeinit(const int reason)
  {  
   Alert("Error = "+ IntegerToString(GetLastError(),0));
   ResetLastError();
  }

and lot calculation is recalculated for all cases, if the step is (0,1), (0,01) and even (0,001)

double lotstep = MarketInfo(Symbol(),MODE_LOTSTEP);

   Lots = NormalizeDouble(AccountEquity()/10000*Lot_for_10K,3);
   if(lotstep>0.001)
   Lots = (MathRound(Lots/lotstep))*lotstep;    
   Lots = MathMax(Lots,MarketInfo(Symbol(),MODE_MINLOT));
   Lots = MathMin(Lots,MarketInfo(Symbol(),MODE_MAXLOT));

as a result i can say i managed to fix everything fast, only 2 days and about 10 tries

 
I'll describe my experiments with "there are no trading operations":

1. After recompiling old EA from Market and trying to upload to the site, the error "there are no trading operations" appeared:
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
2. Checking the availability of quotes for all TFs did not show any error (I used division by 0).
3. Then I started to check the volume of trading operations, but all the same time I got the error "there are no trading operations".
4. Then changed the number of lots in all OrderSend to SYMBOL_VOLUME_MIN - "there are no trading operations"
5. Clearly something is wrong with the validator tester. And tried to add position opening in OnInit():
double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
int ticket1=OpenPosition(NULL,OP_SELL,min_volume,0,0,magic);

and this is what I got (by the way, this is the first time I've seen it so detailed in the validator):

 2019.07.23 01:00:00  Tester: not enough money for sell 0.20 NZDUSD at 0.67567 sl: 0.00000 tp: 0.00000 [2019.07.23 01:00]
 2019.07.23 01:00:00  Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 135, FreeMargin: -134.14
 2019.07.23 01:00:00  Horizon_of_Infinity__1 NZDUSD,H1: OrderSend error 134
 2019.07.23 01:00:00  Tester: not enough money for sell 0.20 NZDUSD at 0.67567 sl: 0.00000 tp: 0.00000 [2019.07.23 01:00]
 2019.07.23 01:00:00  Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 135, FreeMargin: -134.14
 2019.07.23 01:00:00  Horizon_of_Infinity__1 NZDUSD,H1: OrderSend error 134
 2019.07.23 01:00:00  Tester: not enough money for sell 0.20 NZDUSD at 0.67567 sl: 0.00000 tp: 0.00000 [2019.07.23 01:00]
 2019.07.23 01:00:00  Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 135, FreeMargin: -134.14
 2019.07.23 01:00:00  Horizon_of_Infinity__1 NZDUSD,H1: OrderSend error 134
 2019.07.23 01:00:00  Tester: not enough money for sell 0.20 NZDUSD at 0.67567 sl: 0.00000 tp: 0.00000 [2019.07.23 01:00]
 2019.07.23 01:00:00  Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 135, FreeMargin: -134.14
 2019.07.23 01:00:00  Horizon_of_Infinity__1 NZDUSD,H1: OrderSend error 134
 2019.07.23 01:00:00  Tester: not enough money for sell 0.20 NZDUSD at 0.67567 sl: 0.00000 tp: 0.00000 [2019.07.23 01:00]
 2019.07.23 01:00:00  Tester: PrevBalance: 1.00, PrevPL: 0.00, PrevEquity 1.00, PrevMargin: 0.00, NewMargin: 135, FreeMargin: -134.14
 2019.07.23 01:00:00  Horizon_of_Infinity__1 NZDUSD,H1: OrderSend error 134


The error "there are no trading operations" is already clear here. If we have a balance of 1.00, we obviously cannot open an order with 0.20 (SYMBOL_VOLUME_MIN). Checking the balance in the code does its job and does not allow placing such an order and displays a print in the journal saying there is not enough balance (only the validator does not see it).

How do you think the validator is OK?


We will wait until the validator is fixed.

 
Free margine doesn't bother me, because I'm sick of Honduras.
 
Алексей Тарабанов #:
Free margine doesn't bother me, I'm sick of Honduras.

Difficult? I'm talking about expression.

 
Yes, I'm talking about the testing parameters
 
Clear your memory of all sorts.
 

I found the problem, by default I have a limit on the maximum lot of positions in the input parameters.

input double MaxLots=0.1;
...
lots = MathMin(lots, MaxLots);

That's why it didn't allow opening positions if SYMBOL_VOLUME_MIN in the validator is 0.20. You cannot set such a small limit on the maximum lot of positions by default for the validator.

Reason: