I am porting my code to MQL5
I have a requirement to access the brokers group name (System type or the category that a symbol belongs to). The code below works in MT4 - I found it on the web.
Anybody know how to get the same information in MQL5?
//+------------------------------------------------------------------+
//| Get SymbolType from SymbolsLib.mqh |
//+------------------------------------------------------------------+
string SymbolType(string SymbolName)
{
int GroupNumber=-1;
string SymbolGroup="";
int hFile=FileOpenHistory("symbols.raw",FILE_BIN|FILE_READ);
if(hFile < 0) return("");
int SymbolsNumber=int(FileSize(hFile)/1936);
for(int i=0; i<SymbolsNumber; i++)
{
if(FileReadString(hFile,12)==SymbolName)
{
FileSeek(hFile,1936*i+100,SEEK_SET);
GroupNumber=FileReadInteger(hFile);
break;
}
FileSeek(hFile,1924,SEEK_CUR);
}
FileClose(hFile);
if(GroupNumber < 0) return("");
hFile=FileOpenHistory("symgroups.raw",FILE_BIN|FILE_READ);
if(hFile < 0) return("");
FileSeek(hFile,80*GroupNumber,SEEK_SET);
SymbolGroup=FileReadString(hFile,16);
FileClose(hFile);
return(SymbolGroup);
}