Errors, bugs, questions - page 2660

 
Igor Makanu:

need an ID - local agent in the tester, not sure why there is no such functionality

TerminalInfoString(TERMINAL_DATA_PATH);
 

I would like to repeat this, so as not to get lost in randomness)

1. Please advise if I open chart ChartOpen(), then how can I return focus (activity, visibility) on my chart, from which my EA works, without closing it.

2. Who knows why Bid, Ask does not coincide with chart price Close[0]https://www.mql5.com/ru/forum/160683/page1082#comment_15152111

 
fxsaber:

Yeah, I was looking for that, I didn't think it was the place to look

That's how you get an agent's number.

string path = TerminalInfoString(TERMINAL_DATA_PATH);
string agent = StringSubstr(path,StringLen(path)-4);
 

MT5 bug (build 2342) compilation error when calling a template function with explicit argument types, when called from an overloaded non-template function.

template<typename T>
class B{
public:
   void func(const T value){
      printf("1\r\n");
      func<T>(value);             //'func<int>' - ambiguous call to overloaded function with the same parameters        
   };
   
   template<typename TT>
   void func(const TT){
      printf("2\r\n");
   };
   
};


void OnStart(){
   B<int> b;
   b.func(1);
   b.func(1.1);
}
 

Bug MT5 (build 2342) generates a compilation error when generating code for a template function even though there is an overloaded template function with a suitable signature for the parameters passed.
C++ online:https://onlinegdb.com/HyxjmV-DVI

#ifdef __cplusplus
    #include <iostream>
#endif


class C{
public:
   struct A{
      char aaa;
   };
   
   template<typename T>
   void test(A&, T&, T&, void* = NULL){
      printf("1");
   }
   
   template<typename T>
   void test(T&, T&, T&){
      printf("2");
   }
};

struct B : public C::A{
   char data;
};

struct D{
   char data;
};


void OnStart(){
   C c;

   B b;
   D d;
   
   c.test(b, b, b);    // should be: 2       
   c.test(b, d, d);    // should be: 1       //Compile Error: template parameter ambiguous, could be 'B' or 'D'
}

int main(){
   OnStart();
   return 0;
}
 
Sergey Dzyublik :

Bug MT5 (build 2342) generates a compilation error when generating code for a template function even though there is an overloaded template function with a suitable signature for the parameters passed.
C++ online: https://onlinegdb.com/HyxjmV-DVI

Have you ever heard back from Metaquotes about all the hard test work you do?
 

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

Sergey Dzyublik, 2020.02.28 22:21

class C{
public:
   struct A{
      char aaa;
   };
};

struct B : public C::A{
   char data;
};
I have never implemented this feature, thank you.
 
Alain Verleyen:
Have you ever heard back from Metaquotes about all the hard test work you do?

Yes and no.
No complaints on my part, but a good word never hurts.

 
There is no way to solve the following problem:
How to get "partial specialisation" for test function to distinguish transferred parameters and execute different algorithm in each case?
I will be glad to help, thank you.

C++ online with expected behaviour(https://onlinegdb.com/rycNVNDN8).
class C{
public:
   struct A{
   public:
      char aaa;
      
      A (char value = 0) : aaa(value){}
      void set(char value){
         aaa = value; 
      };
      char get(){return aaa;}
   };
   
   void test(A&, A& a1, A& a2){
      printf("1");
      a1.aaa = a2.aaa;
   }
   
   template<typename T>
   void test(A&, T& d1, T& d2){
      printf("2");
      d1.set(d2.get());
   }
};

struct B : public C::A{};


struct D{
private:
   char data;
public:  
   D(char value = 0) : data(value){}
   void set(char value){
      data = value; 
   };
   char get(){return data;}
};


void OnStart(){
   C c;

   B b;
   D d;
   
   c.test(b, b, b);    // 2      should be: 1
   c.test(b, d, d);    // 2      should be: 2   
}
 
Sergey Dzyublik:
There is no way to solve the following problem:
How to get "partial specialisation" for test function to distinguish transferred parameters and execute different algorithm in each case?
I will be glad to help, thank you.
class C{
public:
   struct A{
      char aaa;
   };
   
   /*void test(A&, A&, A&){
      printf("1");
   }*/
   
   template<typename T>
   void test(A&, T&, T&){
      if (sizeof(T)==sizeof(A)) printf("1");
      else                      printf("2");
   }
};

struct B : public C::A{
   char data;
};

struct D{
   char data;
};


void OnStart(){
   C c;

   B b;
   D d;
   
   c.test(b, b, b);    // 2      should be: 2 
   c.test(b, d, d);    // 1      should be: 1    
}