Errors, bugs, questions - page 2648

 
Vladimir Karputov:

Click on the header of one of the columns: Symbol, Ticket, Time.

Click with your LEFT KEY.

It worked, thank you, I've closed the wrong pair several times before.
 
Сергей Проценко:
Depending on the profit, if the profit is higher, move down, the other order has a higher profit, swap places. If the profit of euro becomes higher than that of gold, the order for euro will be at the bottom and the order for gold will be above it.

You have sorted by profit. Select a different sorting criterion.

 
fxsaber :
Can you tell me how to get around a compilation error?

It's not as complicated as it looks:

 #define  PRINT(x) ; Print ( #x,  ":" , string (x))

struct STRUCT_BASE
{
   static const int Array[];
};
static const int STRUCT_BASE::Array[] = { 1 , 2 };

struct STRUCT : STRUCT_BASE
{
   int Array2[ sizeof (Array)];
};


void OnStart ()
{
   static const int Array[] = { 1 , 2 };
   int Array2[ sizeof (Array)];
  
  PRINT( ArraySize (Array));             //2 
  PRINT( ArraySize (Array2));           //8
  
  
  STRUCT s;
  PRINT( ArraySize (s.Array));           //2
  PRINT( ArraySize (s.Array2));         //8
}
 
Sergey Dzyublik:

It's not as complicated as it looks:

Thank you, I didn't get to the basic one.

 
Can't check the codebase,main file not found, but it's there. Please find out the reason (if moderators can). I'm thinking of going back to publishing on blogs - no such problems there.
 
Stanislav Korotky:
I can't check the codebase, it saysmain file not found, but it's there. Please find out the reason (if moderators can). I'm thinking of going back to publishing on blogs - no such hassles there.

place the mq5 in the "default" folder.

 

There are two questions about the MT5 compiler (build 2321):

#define  PRINT(x) ; Print(#x, ":", string(x))
#ifdef __cplusplus
    #include<iostream>
#endif


template<typename T>
class A{
};

template<typename T>
class B : public A<T>{
};


template<typename T>
void func(B<T> &it1){
   printf("C++:1");                      //MQL:2         
}

////ERRROR: 'func' - template functions overloading is not supported yet
//template<typename T>     
//void func(T &it1){ 
//  printf("C++:2");                               
//}
template<typename T>         
void func(T &it1, T* = NULL){
   printf("C++:2");                       //MQL:1        
}

template<typename T>
void func(A<T> &it1){
   printf("C++:3");                       //MQL:3
}


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

int main(){
   OnStart();
   return 0;
}

1. The priorities of executing template functions in MQL do not correspond to those of template functions in C++ (online: https://onlinegdb.com/Hkvz8Hu7L).
So in C++, when all three template functions are present, the template function with the result "C++:1" is executed, if it is removed then "C++:2" is executed, and if it is removed then "C++:3" is executed.
The priorities in MQL are quite different: "C++:2" followed by "C++:1" and "C++:3".


It's not clear why the first of the functions is prohibited in MQL, while the identical function with a dummy parameter is already allowed:

//ERRROR: 'func' - template functions overloading is not supported yet
template<typename T>     
void func(T &it1){ 
  printf("C++:2");                               
}

// OK
template<typename T>         
void func(T &it1, T* = NULL){
   printf("C++:2");                              
}
 

Hi all.

Has anyone encountered the problem of testing multi-currency robots?

Are all currency pairs that are required for the EA being downloaded?

I'm trying to test two pairs, eg EURUSD GBPUSD:

If I test on EURUSD (testing EURUSD GBPUSD)- the result is 1,

If we test on GBPUSD (testing EURUSD GBPUSD), the result is 2, i.e. different

If we test USDCHF (testing EURUSD GBPUSD) - the result is 3, i.e. different



The results are not much different, a few dozens of deals (during 2 months), but the result is different for each pair (although we test certain EURUSD GBPUSD pairs)

Immediately I will assume: The whole code works with the variable, Symb , which takes Symbol() from the loop. I.e. single code, but inside the code to Symb variable is assigned its own value.


May it be so, that because of different quotes, ticks, history quality for different pairs (at that EURUSD and GBPUSD are always tested), test results are different for different pairs?

I.e.

Can it be that the test was carried out for EURUSD, and less quotes are needed for GBPUSD?

и

Is it possible that the test was set for GBPUSD and less quotes are downloaded for EURUSD?

 
fxsaber:

Place the mq5 in the "default" folder.

I know very well that the main module should be without folders - it is, the default folder they themselves "finish" by dropping down the options to the right of the download buttons.

It doesn't work.

 
In C++ it compiles and works (online: https://onlinegdb.com/Syn90dd7I), but in MQL the error: "'func' - ambiguous call to overloaded function"

#define  PRINT(x) ; Print(#x, ":", string(x))
#ifdef __cplusplus
    #include<iostream>
#endif


template<typename T>
class A{
};

template<typename T>
class B : public A<T>{
};

template<typename T>
class C : public B<T>{
};


template<typename T>
void func(B<T> &it1){
   printf("C++:1");                      
}

template<typename T>
void func(A<T> &it1){
   printf("C++:2");                      
}


void OnStart(){
   C<int> c;
   func(c);            //ERROR: 'func' - ambiguous call to overloaded function
}

int main(){
   OnStart();
   return 0;
}
Reason: