How can the script programmatically go through all the instruments that are selected in the Market Watch window?

 
Colleagues, please advise me on one thing.

How can I programmatically go through all the instruments that are selected in the "Market Watch" window in the script?

Thanks in advance.
 

Search https://www.mql5.com/en/code/mt4 for such a script I remember.

 
Also know at least some keywords to search for.
 
I recently solved this problem for myself. I can't remember from whom I borrowed the brute force idea.
//+------------------------------------------------------------------+  
//----
string Currencies[] = {"AED", "AUD", "BHD", "BRL", "CAD", "CHF", "CNY", 
                       "CYP", "CZK", "DKK", "DZD", "EEK", "EGP", "EUR",
                       "GBP", "HKD", "HRK", "HUF", "IDR", "ILS", "INR",
                       "IQD", "IRR", "ISK", "JOD", "JPY", "KRW", "KWD",
                       "LBP", "LTL", "LVL", "LYD", "MAD", "MXN", "MYR",
                       "NOK", "NZD", "OMR", "PHP", "PLN", "QAR", "RON",
                       "RUB", "SAR", "SEK", "SGD", "SKK", "SYP", "THB",
                       "TND", "TRY", "TWD", "USD", "VEB", "XAG", "XAU",
                       "YER", "ZAR"}; 
string Symbols[];
int    SymbolCount = 0; 
//+------------------------------------------------------------------+
//| СОЗДАЁТ СПИСОК ДОСТУПНЫХ ВАЛЮТНЫХ СИМВОЛОВ                       |
//+------------------------------------------------------------------+
int CreateSymbolList()
  {
   int CurrencyCount = ArrayRange(Currencies, 0);
   int Loop, SubLoop;
   string TempSymbol;
   for(Loop = 0; Loop < CurrencyCount; Loop++)
       for(SubLoop = 0; SubLoop < CurrencyCount; SubLoop++)
         {
           TempSymbol = Currencies[Loop] + Currencies[SubLoop];
           if(MarketInfo(TempSymbol, MODE_BID) > 0)
             {
               ArrayResize(Symbols, SymbolCount + 1);
               Symbols[SymbolCount] = TempSymbol;
               SymbolCount++;
             }
         }
   return(0);
  }
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
//---------------------
int deinit()
  {
  Comment("");
  return(0);
  }
//---------------------
//---------------------
int init()
  {
  return(0);
  }
//---------------------
int start()
  {
  int handle,i,s;
 
  s=CreateSymbolList();
  string n= "currency.txt";
  handle=FileOpen(n, FILE_CSV|FILE_WRITE,'.');
  if(handle>0)
    {
      for(i=0;i<=SymbolCount-1;i++)
      {
      FileWrite(handle,i+1,Symbols[i]);
      }
     FileClose(handle);
    }   
//----
   return(0);
 
  }
 
VBAG:
I recently solved this problem for myself. I can't remember from whom I borrowed the brute force idea.
Probably from me.
'ZZ_All Quotings 0-0080'.
 
Thank you for your reply. But I didn't mean just currency pairs (instruments). I can enter these instruments manually as well. I meant a huge variety of different futures, indices, US stocks, etc.
 

Alas, there are no simple solutions...
The most interesting variant was here:
'SymbolList fromSet'.
I ask the developers to introduce a function that returns the list of tools in future.
For example:
- INSTR (1, D) all that is in the dealing
- INSTR (2, D) all what is in the market place window
D are groups, i.e. what is in the "Symbols" folder.

This is already a request, it's a cry from the heart!!!
For having instruments numbering in the hundreds is no longer a gimmick,
but having to go through them by hand... is a bit wild in our age of nanotechnologies... ;)))

 
mricos:
Thank you for your reply. But I didn't mean just currency pairs (instruments). I can enter these instruments manually as well. I meant a huge variety of different futures, indices, US stocks, etc.
It's all there at the link.
Just a simple enumeration of everything that is currently available. No name synthesis.
Currency pairs are synthesised.
 
kombat:

Alas, there are no simple solutions...
The most interesting variant was here:
'SymbolList fromSet'.

This method is not suitable for a universal indicator or script.
 

Yes, and that has cooled interest in it...
Also wrote to the developers in the requests for MKL5.

By the way already applied to the terminal.
To add also groups of instruments to the symbol set.
Now it seems that forex and forexall are there by default,
and we know that MT is not only forex... ;)

 
VBAG:
Recently solved this problem for myself.
Doesn't work where the DCs add something of their own to the name of the pair. For example, "m", "!", "." or "_".