I think that you have made enough posts in this forum so that you should know to use the code button (Alt+S) when pasting code!
Please edit your post.
//+------------------------------------------------------------------+ //| Symbols (Forex ISO 4217) | //+------------------------------------------------------------------+ enum symbol { AED, // AED - United Arab Emirates dirham AFN, // AFN - Afghan afghani ALL, // ALL - Albanian lek AMD, // AMD - Armenian dram ANG, // ANG - Netherlands Antillean guilder AOA, // AOA - Angolan kwanza ARS, // ARS - Argentine peso AUD, // AUD - Australian dollar AWG, // AWG - Aruban florin AZN, // AZN - Azerbaijani manat BAM, // BAM - Bosnia and Herzegovina convertible mark BBD, // BBD - Barbados dollar BDT, // BDT - Bangladeshi taka BGN, // BGN - Bulgarian lev BHD, // BHD - Bahraini dinar BIF, // BIF - Burundian franc BMD, // BMD - Bermudian dollar BND, // BND - Brunei dollar BOB, // BOB - Boliviano BOV, // BOV - Bolivian Mvdol (funds code) BRL, // BRL - Brazilian real BSD, // BSD - Bahamian dollar BTN, // BTN - Bhutanese ngultrum BWP, // BWP - Botswana pula BYN, // BYN - Belarusian ruble BYR, // BYR - Belarusian ruble BZD, // BZD - Belize dollar CAD, // CAD - Canadian dollar CDF, // CDF - Congolese franc CHE, // CHE - WIR Euro (complementary currency) CHF, // CHF - Swiss franc CHW, // CHW - WIR Franc (complementary currency) CLF, // CLF - Unidad de Fomento (funds code) CLP, // CLP - Chilean peso CNY, // CNY - Chinese yuan COP, // COP - Colombian peso COU, // COU - Unidad de Valor Real (UVR) (funds code) CRC, // CRC - Costa Rican colon CUC, // CUC - Cuban convertible peso CUP, // CUP - Cuban peso CVE, // CVE - Cape Verde escudo CZK, // CZK - Czech koruna DJF, // DJF - Djiboutian franc DKK, // DKK - Danish krone DOP, // DOP - Dominican peso DZD, // DZD - Algerian dinar EGP, // EGP - Egyptian pound ERN, // ERN - Eritrean nakfa ETB, // ETB - Ethiopian birr EUR, // EUR - Euro FJD, // FJD - Fiji dollar FKP, // FKP - Falkland Islands pound GBP, // GBP - Pound sterling GEL, // GEL - Georgian lari GHS, // GHS - Ghanaian cedi GIP, // GIP - Gibraltar pound GMD, // GMD - Gambian dalasi GNF, // GNF - Guinean franc GTQ, // GTQ - Guatemalan quetzal GYD, // GYD - Guyanese dollar HKD, // HKD - Hong Kong dollar HNL, // HNL - Honduran lempira HRK, // HRK - Croatian kuna HTG, // HTG - Haitian gourde HUF, // HUF - Hungarian forint IDR, // IDR - Indonesian rupiah ILS, // ILS - Israeli new shekel INR, // INR - Indian rupee IQD, // IQD - Iraqi dinar IRR, // IRR - Iranian rial ISK, // ISK - Icelandic króna JMD, // JMD - Jamaican dollar JOD, // JOD - Jordanian dinar JPY, // JPY - Japanese yen KES, // KES - Kenyan shilling KGS, // KGS - Kyrgyzstani som KHR, // KHR - Cambodian riel KMF, // KMF - Comoro franc KPW, // KPW - North Korean won KRW, // KRW - South Korean won KWD, // KWD - Kuwaiti dinar KYD, // KYD - Cayman Islands dollar KZT, // KZT - Kazakhstani tenge LAK, // LAK - Lao kip LBP, // LBP - Lebanese pound LKR, // LKR - Sri Lankan rupee LRD, // LRD - Liberian dollar LSL, // LSL - Lesotho loti LYD, // LYD - Libyan dinar MAD, // MAD - Moroccan dirham MDL, // MDL - Moldovan leu MGA, // MGA - Malagasy ariary MKD, // MKD - Macedonian denar MMK, // MMK - Myanmar kyat MNT, // MNT - Mongolian tögrög MOP, // MOP - Macanese pataca MRO, // MRO - Mauritanian ouguiya MUR, // MUR - Mauritian rupee MVR, // MVR - Maldivian rufiyaa MWK, // MWK - Malawian kwacha MXN, // MXN - Mexican peso MXV, // MXV - Mexican Unidad de Inversion (UDI) (funds code) MYR, // MYR - Malaysian ringgit MZN, // MZN - Mozambican metical NAD, // NAD - Namibian dollar NGN, // NGN - Nigerian naira NIO, // NIO - Nicaraguan córdoba NOK, // NOK - Norwegian krone NPR, // NPR - Nepalese rupee NZD, // NZD - New Zealand dollar OMR, // OMR - Omani rial PAB, // PAB - Panamanian balboa PEN, // PEN - Peruvian Sol PGK, // PGK - Papua New Guinean kina PHP, // PHP - Philippine peso PKR, // PKR - Pakistani rupee PLN, // PLN - Polish złoty PYG, // PYG - Paraguayan guaraní QAR, // QAR - Qatari riyal RON, // RON - Romanian leu RSD, // RSD - Serbian dinar RUB, // RUB - Russian ruble RWF, // RWF - Rwandan franc SAR, // SAR - Saudi riyal SBD, // SBD - Solomon Islands dollar SCR, // SCR - Seychelles rupee SDG, // SDG - Sudanese pound SEK, // SEK - Swedish krona/kronor SGD, // SGD - Singapore dollar SHP, // SHP - Saint Helena pound SLL, // SLL - Sierra Leonean leone SOS, // SOS - Somali shilling SRD, // SRD - Surinamese dollar SSP, // SSP - South Sudanese pound STD, // STD - São Tomé and Príncipe dobra SYP, // SYP - Syrian pound SZL, // SZL - Swazi lilangeni THB, // THB - Thai baht TJS, // TJS - Tajikistani somoni TMT, // TMT - Turkmenistani manat TND, // TND - Tunisian dinar TOP, // TOP - Tongan paʻanga TRY, // TRY - Turkish lira TTD, // TTD - Trinidad and Tobago dollar TWD, // TWD - New Taiwan dollar TZS, // TZS - Tanzanian shilling UAH, // UAH - Ukrainian hryvnia UGX, // UGX - Ugandan shilling USD, // USD - United States dollar USN, // USN - United States dollar (next day) (funds code) UYI, // UYI - Uruguay Peso en Unidades Indexadas (URUIURUI) (funds code) UYU, // UYU - Uruguayan peso UZS, // UZS - Uzbekistan som VEF, // VEF - Venezuelan bolívar VND, // VND - Vietnamese dong VUV, // VUV - Vanuatu vatu WST, // WST - Samoan tala XAF, // XAF - CFA franc BEAC XAG, // XAG - Silver (one troy ounce) XAU, // XAU - Gold (one troy ounce) XBA, // XBA - European Composite Unit (EURCO) (bond market unit) XBB, // XBB - European Monetary Unit (E.M.U.-6) (bond market unit) XBC, // XBC - European Unit of Account 9 (E.U.A.-9) (bond market unit) XBD, // XBD - European Unit of Account 17 (E.U.A.-17) (bond market unit) XCD, // XCD - East Caribbean dollar XDR, // XDR - Special drawing rights XFU, // XFU - UIC franc (special settlement currency) XOF, // XOF - CFA franc BCEAO XPD, // XPD - Palladium (one troy ounce) XPF, // XPF - CFP franc (franc Pacifique) XPT, // XPT - Platinum (one troy ounce) XSU, // XSU - SUCRE XTS, // XTS - Code reserved for testing purposes XUA, // XUA - ADB Unit of Account XXX, // XXX - No currency YER, // YER - Yemeni rial ZAR, // ZAR - South African rand ZMW, // ZMW - Zambian kwacha };
the reply above has solved your problem already, if only the sequence in this enum be the same with the symbollist in your array[].
thus, you can use array index to get every symbol.
hello,
symbols in iso, very nice, but I need to get a drop down list from my string array, as the string array done it.
because it is a mixed list (forex, indice, ...)
and there are with + or . at the end of them. i just want to select one in that drop down list and use it wthi an indicator , but without open a chart.
so, may be the thing a need doesn't exit in mql4. i think to create a canvas to create a drop down list as I want.
okay thanks for that idea.
hve a nice day :))
the reply above has solved your problem already, if only the sequence in this enum be the same with the symbollist in your array[].
thus, you can use array index to get every symbol.
hello,
good idea, but I need the list from any brokers not a static list, because there is more than forex.
from
SymbolName(a,0)
I get the whole pairs -> EURJPY+ or EURJPY. or EURJPY and that what I get from my string array and use in my code
the most easy way will to get my drop down list will be
extern string testArray[];
but I get
I need more search to get what I need
thanks a lot
I think that you have made enough posts in this forum so that you should know to use the code button (Alt+S) when pasting code!
Please edit your post.
hello,
done, thanks a lot.
hello,
symbols in iso, very nice, but I need to get a drop down list from my string array, as the string array done it.
because it is a mixed list (forex, indice, ...)
and there are with + or . at the end of them. i just want to select one in that drop down list and use it wthi an indicator , but without open a chart.
so, may be the thing a need doesn't exit in mql4. i think to create a canvas to create a drop down list as I want.
okay thanks for that idea.
hve a nice day :))
Of course it was just an example.
You would have to use the actual names of the pairs you want to show in the input parameters drop down.
Additionally you can use
SYMBOL_CURRENCY_BASE
And
SYMBOL_CURRENCY_PROFIT
To solve incompatible pre and postfix issues among different brokers.
Of course it was just an example.
You would have to use the actual names of the pairs you want to show in the input parameters drop down.
Additionally you can use
And
To solve incompatible pre and postfix issues among different brokers.
hello,
nice answer, I tested it for all kind of pairs and give currency only, I didn' know about that. very interesting.
thank to you to give me some very good way to get what I need :)
for my code I need the full string as my string array store in memory. I will use it to apply an indicator like MACD, STOCHASTIC or others.
I will not open a chart to apply that indicator on my pairs. Often we can see RAW , standart or pro trading account.
In the list about my own broker I get 2 kinds about pairs, one for standart account like that EURJPY and onre for RAW account like EURJPY+, I use the last to open a chart because my own account is linked with a RAW acount.
for what I want to code, the user will have to choice his pair on his own list that his broker gives.
Because of that, if I link a pair without the postfix the result should be different. often the price is diferent between a RAW and STandart account.
i think to use an extern string variable and the user will fill it with ; between each pair and I will check if that pair match with one in my string array I did creat before and that will be enough to get what I want.
EURJPY+;EURUSD+;.......
the drop down list in the properties indicator is implemented in the core of MT4 and MT4 coders didn't want to give the possibility to fill an enum from a string because about the security of MT4.
So I will use a more simple code as I wrote before.
MT4 is very good software but with some limitations linked to security or complexity.
Thanks again for the time you spend about my ask :))
Laurent
hello,
nice answer, I tested it for all kind of pairs and give currency only, I didn' know about that. very interesting.
thank to you to give me some very good way to get what I need :)
for my code I need the full string as my string array store in memory. I will use it to apply an indicator like MACD, STOCHASTIC or others.
I will not open a chart to apply that indicator on my pairs. Often we can see RAW , standart or pro trading account.
In the list about my own broker I get 2 kinds about pairs, one for standart account like that EURJPY and onre for RAW account like EURJPY+, I use the last to open a chart because my own account is linked with a RAW acount.
for what I want to code, the user will have to choice his pair on his own list that his broker gives.
Because of that, if I link a pair without the postfix the result should be different. often the price is diferent between a RAW and STandart account.
i think to use an extern string variable and the user will fill it with ; between each pair and I will check if that pair match with one in my string array I did creat before and that will be enough to get what I want.
the drop down list in the properties indicator is implemented in the core of MT4 and MT4 coders didn't want to give the possibility to fill an enum from a string because about the security of MT4.
So I will use a more simple code as I wrote before.
MT4 is very good software but with some limitations linked to security or complexity.
Thanks again for the time you spend about my ask :))
Laurent
Once you get all the symbols list from broker. Add the strings in array: TradePairsArr
Then you can try this to check for postfixes:
// Place this snippet inside your init function: string TradePairsArr[] = {"AUDUSD","EURUSD","GBPUSD","NZDUSD","USDCAD","USDCHF","USDJPY"}; for(int i=0; i < ArraySize(TradePairsArr); i++) { // Check suffixes string PostfixArray[8] = {".","..","+","i","m",".stp",".G","pro"}; string postfix = ""; int size = ArraySize(PostfixArray); for(int a=0; a < size; a++) { postfix = PostfixArray[a]; if(!IsSymbol(TradePairsArr[i]) && IsSymbol(TradePairsArr[i]+postfix)) { TradePairsArr[i] = TradePairsArr[i]+postfix; break; } } if(!IsSymbol(TradePairsArr[i]) && !IsSymbol(TradePairsArr[i]+postfix)) { Print("Symbol does not exist: " + TradePairsArr[i]); RemoveIndexFromArray(TradePairsArr, i); i--; } } //+------------------------------------------------------------------+ bool IsSymbol(string symbol) //+------------------------------------------------------------------+ { SymbolInfoDouble(symbol, SYMBOL_BID); return GetLastError() != ERR_UNKNOWN_SYMBOL; } //+------------------------------------------------------------------+ template <typename T> void RemoveIndexFromArray(T& A[], int iPos) //+------------------------------------------------------------------+ { int iLast; for(iLast = ArraySize(A) - 1; iPos < iLast; ++iPos) A[iPos] = A[iPos + 1]; ArrayResize(A, iLast); }
For Symbols list I just hard-code everything and give users an option to specify their own pair list in case if they use BTC or stocks etc.
And if symbol is not found on broker, user will get a message that Symbol does not exist.
enum ENUM_PT { Manual=0, // Own Pair list Core7=1, // Forex Core 7 Core14=2, // Forex Core 14 Core28=3, // All 28 pairs AUDPairs=6, // AUD pairs CADPairs=8, // CAD pairs EURPairs=5, // EUR pairs GBPPairs=7, // GBP pairs JPYPairs=4, // JPY pairs NZDPairs=9 // NZD pairs }; extern string OwnPairs = "EURUSD,BTCUSD,Facebook"; // Main Pair List(Comma Seperated) extern ENUM_PT PairsTrading = 0; // Main Pairs Preset string Core7Pairs[] = {"AUDUSD","EURUSD","GBPUSD","NZDUSD","USDCAD","USDCHF","USDJPY"}; string Core14Pairs[] = {"AUDJPY","AUDUSD","CHFJPY","EURCHF","EURGBP","EURJPY","EURUSD","GBPCHF","GBPJPY","GBPUSD","NZDJPY","NZDUSD","USDCHF","USDJPY"}; string Core28Pairs[] = {"AUDCAD","AUDCHF","AUDJPY","AUDNZD","AUDUSD","CADCHF","CADJPY","CHFJPY","EURAUD","EURCAD","EURCHF","EURGBP","EURJPY","EURNZD","EURUSD","GBPAUD","GBPCAD","GBPCHF","GBPJPY","GBPNZD","GBPUSD","NZDCAD","NZDCHF","NZDJPY","NZDUSD","USDCAD","USDCHF","USDJPY"}; string JPYPairs[] = {"AUDJPY","CADJPY","CHFJPY","EURJPY","GBPJPY","NZDJPY","USDJPY"}; string EURPairs[] = {"EURAUD","EURCAD","EURCHF","EURGBP","EURJPY","EURNZD","EURUSD"}; string AUDPairs[] = {"AUDCAD","AUDCHF","AUDJPY","AUDNZD","AUDUSD","EURAUD","GBPAUD"}; string GBPPairs[] = {"GBPAUD","GBPCAD","GBPCHF","GBPJPY","GBPNZD","GBPUSD","EURGBP"}; string CADPairs[] = {"CADCHF","CADJPY","AUDCAD","EURCAD","GBPCAD","NZDCAD","USDCAD"}; string NZDPairs[] = {"NZDCAD","NZDCHF","NZDJPY","NZDUSD","AUDNZD","EURNZD","GBPNZD"}; // Snippet in init function: if (PairsTrading == 0) StringSplit(OwnPairs,',',TradePairsArr); if (PairsTrading == 1) ArrayCopy(TradePairsArr,Core7Pairs); if (PairsTrading == 2) ArrayCopy(TradePairsArr,Core14Pairs); if (PairsTrading == 3) ArrayCopy(TradePairsArr,Core28Pairs); if (PairsTrading == 4) ArrayCopy(TradePairsArr,JPYPairs); if (PairsTrading == 5) ArrayCopy(TradePairsArr,EURPairs); if (PairsTrading == 6) ArrayCopy(TradePairsArr,AUDPairs); if (PairsTrading == 7) ArrayCopy(TradePairsArr,GBPPairs); if (PairsTrading == 8) ArrayCopy(TradePairsArr,CADPairs); if (PairsTrading == 9) ArrayCopy(TradePairsArr,NZDPairs); if (ArraySize(TradePairsArr) <= 0) { Print("No pairs to trade"); return(INIT_FAILED); }
You don't need that you can use SymbolInfoString() to get the base and profit currency without pre- and postfixes.
string base = SymbolInfoString(SymbolName(pos,1),SYMBOL_CURRENCY_BASE); string profit = SymbolInfoString(SymbolName(pos,1),SYMBOL_CURRENCY_PROFIT); string symbolname = base+profit;

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Thanks to read my question:
I got an array[x]
x=196 // number of strings grabbed by: SymbolsTotal(0)
I grab all name instrument and put them in that string array, for that it works well :)
Now I need to get a drop down list to show all names to the guy who will set his instrument in the properties window (indicator)
like "enum" or drop down list
But the string array can't work with extern or input
So if you can give me a path to get what I am looking for, that should be very nice :))
Thanks a lot and please have a nice day.
here is a small piece of my code about that string array[]
---------------------
---------------------------