How can the script programmatically go through all the instruments that are selected in the Market Watch window?
Search https://www.mql5.com/en/code/mt4 for such a script I remember.
//+------------------------------------------------------------------+ //---- 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); }
I recently solved this problem for myself. I can't remember from whom I borrowed the brute force idea.
'ZZ_All Quotings 0-0080'.
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... ;)))
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.
Just a simple enumeration of everything that is currently available. No name synthesis.
Currency pairs are synthesised.
Alas, there are no simple solutions...
The most interesting variant was here:
'SymbolList fromSet'.
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... ;)
Recently solved this problem for myself.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How can I programmatically go through all the instruments that are selected in the "Market Watch" window in the script?
Thanks in advance.