hi all,
I have searched a bit how to check if a Symbol is in the Market Watch window.
Most of the code follow something along this approach:
Anything wrong with this: simple check the error code: seems simpler and probably faster
Thanks for any advice
R
I have searched a bit how to check if a Symbol is in the Market Watch window.
Most of the code follow something along this approach:
Inserted Code
hFile = FileOpenHistory("symbols.sel", FILE_BIN|FILE_READ); if(hFile < 0) return(-1); SymbolsTotal = (FileSize(hFile) - 4) / 128; FileSeek(hFile, 4, SEEK_SET); for(int i = 0; i < SymbolsTotal; i++) { if(FileReadString(hFile, 12) == SymbolName) { FileClose(hFile); //corrected return(true); //OK } FileSeek(hFile, 116, SEEK_CUR); } FileClose(hFile); return(false); //Not found
Inserted Code
#include <stderror.mqh> GetLastError(); //clean last err int iL.Digits = MarketInfo(Symbol, MODE_DIGITS); if (GetLastError() == ERR_UNKNOWN_SYMBOL) { //Not found return(false); } else { //OK return(true); } }
R