Errors, bugs, questions - page 2952

 
Alexey Rassvetnyy:

Please fix this bug. MQL5 does not allow using some built-in enum as generic parameters, for example: ENUM_CHART_PROPERTY_DOUBLE, ENUM_CHART_PROPERTY_STRING.

There is no problem with custom enum's and other embedded ones.

The problem arises because the enum doesn't have an element with a zero value. I managed to create my own enum which generates this compilation error.

#include <Generic\HashMap.mqh>
enum TEST_ENUM {
   ENUM1, ENUM2
};
enum TEST_ENUM2 { //отсутствует элемент с номером 0
   ENUM1=-10, ENUM2
};
void OnStart()
  {
   CHashMap<ENUM_CHART_PROPERTY_INTEGER,int> mapI;    // эта срока комилируется без ошибок
   CHashMap<ENUM_CHART_PROPERTY_DOUBLE,double> mapD;  // здесь ошибки компиляции: 'NULL' - cannot convert enum  HashMap.mqh     21      39. 'NULL' - cannot convert enum        HashMap.mqh     462     30
   CHashMap<ENUM_CHART_PROPERTY_STRING,string> mapS;  // здесь ошибки компиляции: 'NULL' - cannot convert enum  HashMap.mqh     21      39. 'NULL' - cannot convert enum        HashMap.mqh     462     30
   CHashMap<TEST_ENUM,double> mapE;    // эта срока комилируется без ошибок
   CHashMap<TEST_ENUM2,double> mapE2;    // здесь ошибки компиляции: 'NULL' - cannot convert enum       HashMap.mqh     21      39. 'NULL' - cannot convert enum        HashMap.mqh     462     30
  }
 
Alexey Rassvetnyy:

The problem occurs because the enum does not contain an element with a null value. We have managed to create our own enum, which generates this compilation error.

In your case, fixing the library file will help

//+------------------------------------------------------------------+
//| fix HashMap.mqh                                                  |
//|  line 21  | was | Entry(void): key(NULL) {}                      |
//|           | now | Entry(void): key((TKey)NULL) {}                |
//|  line 462 | was | m_entries[i].key=NULL;                         |
//|           | now | m_entries[i].key=(TKey)NULL;                   |
//+------------------------------------------------------------------+
 
DMITRII PECHERITSA:

In your case, fixing the library file will help

Thank you, it works.

However, if I hand-correct a file that supports MQ, the next update will roll back my changes. We need the developers who support standard library to make castoff NULL to parametric types throughout the code of standard library or tighten compiler to make NULL can automatically cast to any type without explicit instructions.

 
Alexey Rassvetnyy:

Developers who support standard library should cast NULL to parametric types throughout standard library code or tighten compiler to make NULL automatically cast to any type without explicit instructions.

Developers have a principle: the simpler, the better. Well, it's not assembler, so you may use it. Maybe that's how it should be.

 
DMITRII PECHERITSA:

In your case, fixing the library file will help

Thank you for your message.

Made these corrections in the SB

 
Ilyas:

Thank you for your message.

Made these corrections in the SB

Corrected not only for keys but also for values?

 
Stanislav Korotky:

Corrected not only for keys but also for values?

Yes, for values too

 
Ilyas:

Is it possible for the debugger, when showing the contents of a structure, to be able to remove some of its fields from the observed ones?


There are several large structures. You need to compare them by five fields with your eyes. It doesn't work.

 

Good day! Please help me to solve this problem.

Before sending and checking a trade request in MT5-advisor I use the following variant oftype_filling definition:

// тип FILLING
int SYMBOL_FILLING = (int)SymbolInfoInteger(iNameSymbol, SYMBOL_FILLING_MODE);
switch(SYMBOL_FILLING)
{
   case SYMBOL_FILLING_FOK:   iЗапрос.type_filling = ORDER_FILLING_FOK;    break;
   case SYMBOL_FILLING_IOC:   iЗапрос.type_filling = ORDER_FILLING_IOC;    break;
   default:                   iЗапрос.type_filling = ORDER_FILLING_RETURN; break;
}

But I ran into a problem, as this construction turns out to be not working on all accounts and not at all brokers. After checking the ready request through OrderCheck, the error 10030 (An unsupported order execution type by balance is specified) appears. In this case SYMBOL_FILLING = 3, and the ORDER_FILLING_RETURN type is selected.

I don't use any external libraries (like CTrade). Please help me or direct me to where I can get the answer to my question.

Thanks in advance!

 
fxsaber:

Is it possible for the debugger, when showing the contents of a structure, to be able to remove some of its fields from the observed ones?


There are several large structures. You need to compare them by five fields with your eyes. It doesn't work.

The best way is to display value of any variable on mouseover in source - so you don't need to add anything to watch-list and fieldof any nesting is available without a chain of dereferencing (and neighboring fields).