Errors, bugs, questions - page 2414

 
Andrey Pogoreltsev:

If you use CSymbolInfo in multicurrency, which is called by Name method at the moment of initialization:

There will be errors for USDCAD symbol during testing:

What is the deposit currency during testing?

 
Slava:

What is the currency of the deposit when testing?

USD. EURUSD M1 testing pair. I will try to reproduce it in the naked EA. It has not succeeded so far. But it was these methods that led to errors in logs and exactly one pair.

 
Slava:

What is the currency of the deposit when testing?

Generally reproduced and found a feature. Attached the test settings.

Bare Expert Advisor code itself:

#include <Trade\SymbolInfo.mqh>

int OnInit()
  {
//---
   CSymbolInfo info;
   info.Name("EURCHF.m");
   info.Refresh();
   info.Name("EURJPY.m");
   info.Refresh();
   info.Name("EURUSD.m");
   info.Refresh();
   info.Name("EURGBP.m");
   info.Refresh();
   info.Name("USDCAD.m");
   info.Refresh();
//---
   return(INIT_SUCCEEDED);
  }


Now the "feature", as promised) If you use Name() like this:

   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE,m_tick_value))
      return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE_PROFIT,m_tick_value_profit))
      return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE_LOSS,m_tick_value_loss))
      return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_SIZE,m_tick_size))
      return(false);

then there will be an error. But this way the error disappears:

   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_SIZE,m_tick_size))
      return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE,m_tick_value))
      return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE_PROFIT,m_tick_value_profit))
      return(false);
   if(!SymbolInfoDouble(m_name,SYMBOL_TRADE_TICK_VALUE_LOSS,m_tick_value_loss))
      return(false);


PS. I have pairs named with prefix ".m" on my cent. The example works on regular pairs as well.

Files:
test.png  11 kb
 
Andrey Pogoreltsev:

Anyway, reproduced and found a feature. I have attached the test settings.


Thank you. Figuring it out

 

Bug MT5 build 2007. In optimization mode input string is truncated to 63 characters.

Code for test:

#property strict

sinput string symbols = "AUDUSD,EURGBP,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY,GBPNZD,GBPUSD,NZDUSD,USDCAD,USDCHF,USDJPY";
input  bool fortestopt = false;
int OnInit(){
   Print("!!! ",StringLen(symbols)," | ",symbols);

   return INIT_FAILED;
}

void OnTick(){}


Single run all ok: ! 90 | AUDUSD,EURGBP,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY,GBPNZD,GBPUSD,NZDUSD,USDCAD,USDCHF,USDJPY

Let's set optimization by fortestopt parameter, let's go to agent's log: ! 63 | AUDUSD,EURGBP,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY,GBPNZD,GBPUSD,

 

Anybody want to know...

I can't see the newsfeed on my page... Used to go in and see who posted what. Now it's a blank page... I didn't change anything in the settings...

 

Compiler bug. It generates ambiguity error, although everything is unambiguous here.The first method should be called as the most suitable one. Tested in C++.

class A { };

class B
{
  A _a[];
 public:
        A * operator[](uint i)       { return &_a[i]; }
  const A * operator[](uint i) const { return &_a[i]; }  
};

void OnStart()
{
  B b;
  b[0]; // 'operator[]' - ambiguous call to overloaded function
}
 
Evgenii Kuznetsov:

Bug MT5 build 2007. In optimization mode input string is truncated to 63 characters.

Code for test:


Single run all ok: ! 90 | AUDUSD,EURGBP,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY,GBPNZD,GBPUSD,NZDUSD,USDCAD,USDCHF,USDJPY

Let's set optimization by fortestopt parameter, let's go to agent's log: ! 63 | AUDUSD,EURGBP,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY,GBPNZD,GBPUSD,

The fact that it doesn't cut to 63 characters in a single test either is just a fluke.

The length of the input parameter type string must not exceed 63 characters (64 together with the null-terminator)

 
Slava:

The fact that it doesn't cut down to 63 characters in the single test either, is just a fluke.

The length of an input parameter of type string should not exceed 63 characters (64 along with the null-terminator).

It's some kind of draconian restriction. What's the rationale for this in today's times? And how is it convenient to specify clusters of a bunch of characters? Plotting a dozen different parameters? Is it convenient?

 
Slava:

The fact that the single test does not truncate to 63 characters is just an accident.

The length of an input parameter of the string type must not exceed 63 characters (64 together with the null-terminator)

This limitation is inappropriate, we are not writing the price of a kilogram of potatoes into the string.

Reason: