Ancrealv
12-12-2012, 09:48 AM
Hello,
I have searched a bit how to check if a Symbol is in the Market View window.
Most of the code follow something along this approach:
Inserted Code hFile = FileOpenHistory(symbols.sel, FILE_BIN|FILE_READ); if(hFile lt; 0) return(-1); SymbolsTotal = (FileSize(hFile) - 4) / 128; FileSeek(hFile, 4, SEEK_SET); for(int I = 0; I lt; SymbolsTotal; I ) if(FileReadString(hFile, 12) == SymbolName) FileClose(hFile); //corrected return(true); //OK FileSeek(hFile, 116, SEEK_CUR); FileClose(hFile); return(false); //Not found Anything wrong with this: easy check the error code: seems simpler and probably quicker
Inserted Code #include lt;stderror.mqhgt; GetLastError(); //clean last err int iL.Digits = MarketInfo(Symbol, MODE_DIGITS); if (GetLastError() == ERR_UNKNOWN_SYMBOL) //Not found return(false); else //OK return(true); } Thanks for any information
R
I have searched a bit how to check if a Symbol is in the Market View window.
Most of the code follow something along this approach:
Inserted Code hFile = FileOpenHistory(symbols.sel, FILE_BIN|FILE_READ); if(hFile lt; 0) return(-1); SymbolsTotal = (FileSize(hFile) - 4) / 128; FileSeek(hFile, 4, SEEK_SET); for(int I = 0; I lt; SymbolsTotal; I ) if(FileReadString(hFile, 12) == SymbolName) FileClose(hFile); //corrected return(true); //OK FileSeek(hFile, 116, SEEK_CUR); FileClose(hFile); return(false); //Not found Anything wrong with this: easy check the error code: seems simpler and probably quicker
Inserted Code #include lt;stderror.mqhgt; GetLastError(); //clean last err int iL.Digits = MarketInfo(Symbol, MODE_DIGITS); if (GetLastError() == ERR_UNKNOWN_SYMBOL) //Not found return(false); else //OK return(true); } Thanks for any information
R