Questions from Beginners MQL5 MT5 MetaTrader 5 - page 10

 

mi__x__an:

with the function being universal,


You can't have a universal function.
 
Rosh:
Try to seeCComboBox class andEnumToString function. See also this articleCreate your own graphical panels in MQL5.

I've got that sorted out. The question was a bit different.

If theenum type exists and its components are unknown, is it possible to find them?

For example, there is theENUM_TIMEFRAME type

and our task is to find all the components of this type:{PERIOD_M1,PERIOD_M2...PERIOD_MN1} or{1,2...49153}

If you know all components of the type, you can implement a function that will return an array of possible values of theenum type. But is it possible to know the components of this type programmatically? For when creating newenum types we will have to write new functions of this kind, and it's not convenient.

Isn't there any possibility?

 
mi__x__an:

uncleVic - Isn't there a single possibility???


No such possibility, software enumeration of all enumeration values is not implemented.
Документация по MQL5: Основы языка / Типы данных / Целые типы / Перечисления
Документация по MQL5: Основы языка / Типы данных / Целые типы / Перечисления
  • www.mql5.com
Основы языка / Типы данных / Целые типы / Перечисления - Документация по MQL5
 

How many files can be opened at the same time?

By using this script :

   int f[];
   for (int i=0;i<1000;i++)
    {
     ArrayResize(f,i+1,0);
     f[i]=FileOpen(string(i)+".txt",FILE_WRITE|FILE_TXT,"\r\n");
     FileWrite(f[i],string(i));
    }

it was possible to find out that there are 64.

If so, is this information in the documentation? I haven't found it.

P.S.: Just came across - had to determine by experience the cause of the error. In my opinion such information could be added to the documentation.

P.S.S: I may be mistaken - then correct me.

 
mi__x__an:

How many files can be opened at the same time?

By using this script :

it was possible to find out that there are 64.

If so, is this information in the documentation? I couldn't find any.

Runtime errors

ERR_TOO_MANY_FILES

5001

Cannot open more than 64 files at a time

Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки времени выполнения
Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки времени выполнения
  • www.mql5.com
Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки времени выполнения - Документация по MQL5
 
Thanks for the correction. I LastError, forgot to check.
 

Hello.

I have a little problem: I know MQL4, but I don't know MQL5. )))

Please help me to modify this code for MQL5.

double SpreadOnline;
string SMB; 

int init()
  {
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   SMB=Symbol();
   SpreadOnline = NormalizeDouble(MarketInfo(SMB, MODE_SPREAD),0);

   Comment("Spread - ",SpreadOnline);

   return(0);
  }
 

In the form of an expert:

double SpreadOnline=0.0;
string SMB=NULL; 

void OnInit()
  {
  
  }

void OnTick() // OnStart,OnCalculate
  {
   SMB=Symbol();
   
   SpreadOnline = NormalizeDouble(SymbolInfoInteger(SMB,SYMBOL_SPREAD),0);

   Comment("Spread - ",SpreadOnline);

  }
  
void OnDeinit(const int reason)
  {
   
  }
 
Thank you! ))
 
nemo811:
Thank you! ))
Gentlemen! Please answer me this question. I have installed the MT5 platform and opened a demo account on the metaquotes-demo server. My question is this. What is the time of the metaquotes-demo server? What is the situation with daylight saving time? If the change-over takes place as in England, then on the quotes history, the European time will start at the same time without any shifts. Am I thinking correctly? I am mainly interested in the history since January 2011.
Reason: