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

 
Alexey Viktorov:

It's not because I recompiled it, it's because the testing started from a different date. And I noticed this bug, if you put in something that was already there, then testing doesn't happen, but immediately gives the previous test result. So, do not be fooled by such crutches. Try to make it normal. If something is missing or parameters are invalid, report it via Print and everything will be correct.

If it was only due to a different date, then my checks would reveal it (missing bars, etc.), but it's not the date that's the problem. If I can't reconstruct the error what automatic validation finds, then it's easier for me to slip the same and hope that revenge with buyers will find the problem place (if there is such). This implementation of validations doesn't give me complete understanding where to look for error. And Print is already shoved all over the place for me.

Alexey Viktorov:

And I noticed such a shag, if I paste that already was, then testing does not occur and immediately gives the previous test result.

And not to get a previous test result, I must change something, even add an empty string (I meant "recompile").

 
Roman Gergert:

I finally figured it out, maybe someone can help, in general, the Soviet has only checked the minimum lot when the MM was enabled, and so hardcore set lot = 0.01, well, in the validator deposit turns out to be $ 1 (found this information in one of the topics), respectively, it uses the lot 0.001 (or so) to trade, and since I always had in one place was a lot of 0.01, he was therefore not enough money and the robot does not trade)

Exactly, Roman, the validator is testing with a $1 deposit.

There is a lot normalization function in the EA. If it returns 0, the trade does not even try to open:

      if((Auto() && (b==0 || (b>0 && BuyPriceMin-Ask>(b==1?iPointOrderStep_1:iPointOrderStep_2)*Point()))) || buy) {
         BuyLot=buy && LotFromPanel()>0 ? LotFromPanel() : BuyLot;
         double norm_lot=NormalizeLots(_Symbol,BuyLot);
         if(norm_lot>0.0) {  
            int ticket=OrderSend(Symbol(),OP_BUY,norm_lot,NormalizeDouble(Ask,_Digits),30,0,0,
                        "NZT-48",iMagicNumber,0,clrGreen);
            if(ticket>0) {
                ObjectSetInteger(0,"V_5_buy",OBJPROP_STATE,false);
                buy=false;
            }
            else  
               Print("Order Send error #",GetLastError());
         } else Print("Not enough money for the minimum lot");   
      }

But it is not clear then how this EA's lot normalization function sends a 0.2 lot to open:

//+------------------------------------------------------------------+
//| Функция нормализации лота                                        |
//+------------------------------------------------------------------+
double NormalizeLots(string symbol, double lot, bool is_margin=true) {
   if(lot<=0) return(0.0);
   RefreshRates();
   double min=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN);
   double max=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX);
   double step=SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP); 
   double free = AccountFreeMargin()*0.95;
   double margin = MarketInfo(symbol,MODE_MARGINREQUIRED);
   double _lot=lot<min?min:(lot>max?max:lot);
          _lot=MathRound(_lot/step)*step;
   if(is_margin && _lot*margin>free)  _lot=0.0;
   return(_lot);
}

After all, if lot 0.2 comes in for checking and the margin judging by the logs is 645, then this part of the expression should give true

if(is_margin && _lot*margin>free)  _lot=0.0;     //0.2*645>0.95

And the function will send 0.0, but not 0.2. It can only send 0.2 if it

MarketInfo(symbol,MODE_MARGINREQUIRED);

returned 0 or a negligible value. I don't understand how this validator works at all.

Dear MQL developers, please send us test logs instead of dry validation error reports in three lines. It will be much easier for us, humble programmers, to understand the code errors and fix them. You may send it as an archive to e-mail, you will probably think of a way)))

P.S. Funny situation. For the 5th day I am trying to put on the market an Expert Advisor that works perfectly in the tester and on the real market.
 
Andrey Kaunov:

Exactly, Roman, the validator tests with a $1 deposit.

There is a lot normalisation function in the EA. If it returns 0, the trade does not even try to open:

But it is not clear then how this EA's lot normalization function sends a 0.2 lot to open:

After all, if lot 0.2 comes in for checking and the margin judging by the logs is 645, then this part of the expression should give true

And the function will send 0.0, but not 0.2. It can only send 0.2 if it

returned 0 or a negligible value. I don't understand how this validator works at all.

Dear MQL developers, please send us test logs instead of dry validation error reports in three lines. It will be much easier for us, humble programmers, to understand the code errors and fix them. You may send them as an archive to e-mail, you may think of a way :)))

P.S. Funny situation. For the 5th day I am trying to put on the market an Expert Advisor that works perfectly in the tester and in real life.

it looks like you have a different leverage than the one in the Market, perhaps 1:500

try to bring the lot calculation to 1k100 by changing only one line in the code:

margin = AccountLeverage()*MarketInfo(symbol,MODE_MARGINREQUIRED)/100.0;

and the minimum lot for the market is 0.1 I think....
 

You live in some kind of limited world of your own. In a normal world, the minimum lot can be very different from 0.01

RECIPEPTION: read and read again the article "What checks must pass ...".

Before sending a trade order, you have to check if it will pass, if there is enough margin ...


In general, the validator has so far fulfilled its main task: sifting out incomplete code from the Marketplace.

 
Renat Akhtyamov:

it looks like you have a different leverage than the one in the market, maybe 1:500

try to bring the lot calculation to 1k100 leverage by changing only one line in the code:

margin = AccountLeverage()*MarketInfo(symbol,MODE_MARGINREQUIRED)/100.0;

Renat, thanks for the advice, I'll give it a try.

Vladimir Karputov:

You live in some limited world of your own. In a normal world the minimum lot can be very different from 0.01

RECIPEPTION: read and read again the article "What checks must pass ...".

Before sending a trade order, you have to check if it will pass, if there is enough margin ...


In general, the validator has so far coped with its main task: sifting out incomplete code from the Market.

Vladimir, can you understand the question constructively?! Don't I check the lot for margin and other things?The article "What checks must be passed ..." is already like a bible to me. I've posted code snippets above. I've changed the code according to your recommendations from the article for full compliance:

//+------------------------------------------------------------------+
//| Функция нормализации лота                                        |
//+------------------------------------------------------------------+
double NormalizeLots(string symbol, double lot, int direction, bool is_margin=true) {
   if(lot<=0) return(0.0);
   RefreshRates();
   double min=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN);
   double max=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX);
   double step=SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP); 
   //double free = AccountFreeMargin()*0.95;
   //double margin = MarketInfo(symbol,MODE_MARGINREQUIRED);
   double _lot=lot<min?min:(lot>max?max:lot);
          _lot=MathRound(_lot/step)*step;
   //if(is_margin && _lot*margin>free)  _lot=0.0;
   ResetLastError();
   if(is_margin && (AccountFreeMarginCheck(Symbol(),direction,_lot)<=0 || GetLastError()==134)) _lot=0.0;
   return(_lot);
}

But I still get "no trades":

Well, if function always sends 0.0 lot and does not allow to open trades, I change it to send minimum lot:

//+------------------------------------------------------------------+
//| Функция нормализации лота                                        |
//+------------------------------------------------------------------+
double NormalizeLots(string symbol, double lot, int direction, bool is_margin=true) {
   if(lot<=0) return(0.0);
   RefreshRates();
   double min=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN);
   double max=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX);
   double step=SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP); 
   //double free = AccountFreeMargin()*0.95;
   //double margin = MarketInfo(symbol,MODE_MARGINREQUIRED);
   double _lot=lot<min?min:(lot>max?max:lot);
          _lot=MathRound(_lot/step)*step;
   //if(is_margin && _lot*margin>free)  _lot=0.0;
   ResetLastError();
   if(is_margin && (AccountFreeMarginCheck(Symbol(),direction,_lot)<=0 || GetLastError()==134)) _lot=min;
   return(_lot);
}

And I get the history that trades do occur (see screenshots below). But the minimum lot of course comes very strange, but let it comes. But the deals are there!

That is in this situation, very strange thing is validator, making a minimum lot 0.2 for a deposit of $ 1.


Naturally, there will be no deals at all! And this is with a perfectly adequate code. By the way, I have removed all conditions on indicators, etc. for testing. The trades start to be opened as soon as the EA is started.

Vladimir Karputov:

...

So far, the validator has coped with its main task: screening out incomplete code from the Market.

So what does the validator handle? I can't see it doing anything but blowing programmers' brains out!

Note that I'm not asking you to change anything in the validator. We can simply see the testing logs. We will understand then with what parameters the tests are running and on what deposits. At the end of the day, we may at least use prints to check where the error is in the code and fix it as fast as possible. We will not be pointing our fingers in the sky for a whole week, trying only to localize an error. We are not working against each other, are we? I understand, we are trying to earn something together.

 
Andrey Kaunov:

...It's not like we're working against each other! I understand, we're trying to earn something together.

Andrew, I ran into a server freeze once over the weekend.

which means it just wouldn't eat MarketInfo(...)

I could barely get it to work.

So, if you understand that you can not swallow Market, it remains to think how to make a validator does not swear

For example, I ask - what leverage?

It says 0.

I add in the code - if it is 0, then it says 100

If the logic is clear, it will work and good luck!

 

I see, Renat, thank you.

I've already made a lot of crutches, but in some places I'm at a dead end. And I want the adequate code to be adequately tested. Besides, it's not impossible to find a problem in the absence of test logs but it's very laborious.

Perhaps the validator as well would be nice to get an upgrade. I'm not the only one who encounters such problems.

 
Andrey Kaunov:

I see, Renat, thank you.

I've already made a lot of crutches, but in some places I'm at a dead end. And I want the adequate code to be adequately tested. Besides, it's not impossible to find a problem in the absence of test logs but it's very laborious.

Perhaps the validator as well would be nice to get an upgrade. I am not the only one who encounters such problems.

Yes, you are not the only one who has faced this problem, in the next thread there is another one who has faced this problem - you are already two.

Also, look at how many EAs are posted in the market every day without any problems, it's called "the level of professionalism".

 

Vitaly, if you and other "professionals" manage to pass validation the first time, I can only applaud. But there are far more than two threads on a similar problem. Plus not everyone writes, some people just read. By the way, the Expert Advisor is not mine. I prepare it in the Market for the client. But that doesn't negate the problems described above. If you read my post carefully, maybe as a "professional" you can suggest a solution to the problem. Putting out a post along the lines of "You're dumb and I'm smart" doesn't take much knowledge.

Here's another problem for you. Why having added in the beginning of OnTick() unconditional serial opening of 5 transactions in 5 minutes with minimal lot, the validator also gives me a"no trading operations" message.

void OnTick() { 
   static int test_ticket[2]={0,0};
   if(test_ticket[1]<5 && test_ticket[0]==0) {
      test_ticket[0]=OrderSend(_Symbol,OP_BUY,SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN),NormalizeDouble(Ask,_Digits),30,0.0,0.0,"NZT-48_test",33333,0,clrNONE);
      if(test_ticket[0]>0) test_ticket[1]++;
   }   
   if(OrderSelect(test_ticket[0],SELECT_BY_TICKET))
      if(OrderCloseTime()==0 && OrderOpenTime()+300<TimeCurrent())
         if(OrderClose(test_ticket[0],NormalizeDouble(OrderLots(),2),NormalizeDouble(Bid,_Digits),30,clrNONE)) {
            printf("Test order closed, ticket #%d",test_ticket[0]);
            test_ticket[0]=0;
         }   
...
}
 
Andrey Kaunov:

Vitaly, if you and other "professionals" manage to pass validation the first time, I can only applaud. But there are far more than two threads on a similar problem. Plus not everyone writes, some people just read. By the way, the Expert Advisor is not mine. I prepare it in the Market for the client. But that doesn't negate the problems described above. If you read my post carefully, maybe as a "professional" you can suggest a solution to the problem. Putting out a post along the lines of "You're dumb and I'm smart" doesn't take much knowledge.

Here's another problem for you. Why having added in the beginning of OnTick() unconditional sequential opening of 5 transactions in 5 minutes with minimal lot, the validator gives me"no trading operations" in the same way?

And you should first post the validator's full response here

And what makes you think the validator sets tickets by the principle you invented?

to open 5 trades, you need to count the number of trades opened, not the ticketing
Reason: