Market: no trading operations

 

Can anyone explain why the market returns this error? All the checks in the EA are in place...

I understand the gist of course - there are no trades, but what is the reason?

Ограничения и проверки в экспертах
Ограничения и проверки в экспертах
  • www.mql5.com
При создании алгоритма для автоматической торговли необходимо не только уметь обрабатывать цены с целью выработки торговых сигналов, но и зачастую требуется получать множество вспомогательной информации об ограничениях, накладываемых на работу эксперта.  В этой статье будет рассказано о том как: получить информацию о торговых сессиях...
 
  • e.g. - trading lot in settings = 0, EA cannot open a trade because lot = 0 .
  • Limitation on the spread in the Expert Advisor, does not open positions.
  • There really are no signals to open positions in the testing period.

And the checks only you see, your code is not attached.

Examples by the thousands....

 
Vladislav Andruschenko:
  • e.g. - trading lot in settings = 0, EA cannot open a trade because lot = 0 .
  • Limitation on the spread in the Expert Advisor, does not open positions.
  • There really are no signals to open positions in the testing period.

And the checks only you see, your code is not attached.

Examples by the thousands....

Checks for Lot correctness are there, signals are definitely there - it's a netminder, no spread limits...
 
Vladislav Andruschenko:
  • e.g. - trading lot in settings = 0, EA cannot open a trade because lot = 0 .
  • Limitation on the spread in the Expert Advisor, does not open positions.
  • There really are no signals to open positions in the testing period.

And the checks only you see, your code is not attached.

Examples by the thousands....

Checks for Lot correctness are there, signals are definitely there - it's a netminder, no spread limits... I don't understand anything...
 
Maksim Neimerik:
Lot validation is there, signals are definitely there - it's a netminder, no spread limitations...

well then there are 100500 more options.

the nettler is quietly passing the market test.

 
Vladislav Andruschenko:

well then there are 100500 more options.

the nettler is quietly passing the market test.

Agreed, but somehow not this one:)
 
Maksim Neimerik:
I agree, but for some reason not this one:)


It is forbidden to discuss bots from the marketplace here. And you won't be posting it in the public domain. And there are already 100500 topics with that name, as well as the reasons for such a topic.

 
Maksim Neimerik:

Can anyone explain why the market returns this error? All the checks in the EA are in place...

I understand the gist of course - no trades, but for what reason?

Is it so hard to use site search and create 100500 branch copy!

https://www.mql5.com/ru/search#!keyword=no%20trading%20operations&method=2&module=mql5_module_forum

Поиск - MQL5.community
Поиск - MQL5.community
  • www.mql5.com
Поиск выполняется с учетом морфологии и без учета регистра. Все буквы, независимо от того, как они введены, будут рассматриваться как строчные. По умолчанию наш поиск показывает страницы...
 

Just want to discuss the code:

double CheckVolumeValue(double volume)
{
   double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
   if(volume<min_volume)
   {
      Print("Volume is less than the minimum");
      return(min_volume);
   }

   double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
   if(volume>max_volume)
   {
      Print("Volume is greater than the maximum");
      return(max_volume);
   }

   double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);

   int ratio=(int)MathRound(volume/volume_step);
   if(MathAbs(ratio*volume_step-volume)>0.0000001)
   {
      Print("Wrong lot size");
      return(min_volume);
   }
     
   if(volume<MarketInfo(Symbol(),MODE_MINLOT))
   {
      Print("Trade stop invalid lot size");
      Comment("Trade stop invalid lot size"); 
      return(MarketInfo(Symbol(),MODE_MINLOT));
   }
   return(volume);
}

I've tweaked the standard check to return the correct lot instead of an error...

Here we call this function:

   if(!OrderSend(Symbol(),cmd,CheckVolumeValue(Lot),NormalizeDouble(priceStep,Digits()),Slippage,0,0,"",magic,0))

In my tester and on my real account this robot works fine! Even when an incorrect lot is entered, it still returns the correct one and works further...

And you know where the 4051 error comes back! This is in general...!

 
Maksim Neimerik:

Just want to discuss the code:

I've tweaked the standard check to return the correct lot instead of an error...

Here we call this function:

In my tester and on my real account this robot works fine! Even when an incorrect lot is entered, it still returns the correct one and works further...

And you know where the 4051 error comes back! This is in general...!

Is Lot not normalised?
 
Maksim Neimerik:

Just want to discuss the code:

I've tweaked the standard check to return the correct lot instead of an error...

Here we call this function:

In my tester and on my real account this robot works fine! Even when an incorrect lot is entered, it still returns the correct one and works further...

And you know where the 4051 error comes back! This is in general...!

double CheckVolumeValue(double volume)
{
   double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
   if(volume<min_volume)
   {
      Print("Volume is less than the minimum");
      return(min_volume);
   }

   double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
   if(volume>max_volume)
   {
      Print("Volume is greater than the maximum");
      return(max_volume);
   }

   double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);

   int ratio=(int)MathRound(volume/volume_step);
   if(MathAbs(ratio*volume_step-volume)>0.0000001)
   {
      Print("Wrong lot size");
      return(min_volume);
   }
     
   if(volume<MarketInfo(Symbol(),MODE_MINLOT))
   {
      Print("Trade stop invalid lot size");
      Comment("Trade stop invalid lot size"); 
      return(MarketInfo(Symbol(),MODE_MINLOT));
   }
   return(volume);
}
And it will never get to this point
Reason: