how to check automatically for any suffixes added to symbols in market watch, so indicator work on all broker's account type's ?
hi;
in my multi currency indicator in default ;
for example symbol " EURUSD" i check/add in market watch ,so indicator calculate & draw.
my question is: if some broker/account type use another symbol like " EURUSD.m " or any other suffixes added to EURUSD or " eurusd " ....
or ( is there another ? )
( in calculation those are all equal together ) , how can do this automatically without any modify from user with change from indicator's Input.
thank's in advance.As far as I know there is no automatically way or ready function to do that.
Anyway, in trading signals copying there is something similar that the MQ team could use to create such public function.
thank you.
i used bellow in my code.( fore example for "EURUSD" )
string SYMBOLS_NAMES[1]="EURUSD" // must check for other type & any other suffixes added { eurusd EURUSD.m ...} . . . //----------------------- void OnInit() { InitSymbolNames(); //--- Initialize the array of symbols . . . } //----------------------- int OnCalculate(const int rates_total,const int prev_calculated, const datetime &Time[], const double &Open[], const double &High[], const double &Low[], const double &Close[], const long &TickVolume[], const long &Volume[], const int &Spread[]) { InitSymbolNames(); . . . return(rates_total); } //----------------------- void InitSymbolNames() { AddSymbolToMarketWatch(SYMBOLS_NAMES[1]); } //+++ //+------------------------------------------------------------------+ string AddSymbolToMarketWatch(string symbol) { int total=0; // Number of symbols string name=""; // Symbol name //--- If an empty string is passed, return the empty string if(symbol=="") return(empty_symbol); //--- Total symbols on the server total=SymbolsTotal(false); //--- Iterate over the entire list of symbols for(int i=0;i<total;i++) { //--- Symbol name on the server name=SymbolName(i,false); //--- If this symbol is available, if(name==symbol) { //--- add it to the Market Watch window and SymbolSelect(name,true); //--- return its name return(name); } } //--- If this symbol is not available, return the string representing the lack of the symbol return(empty_symbol); } //****
any help to continue.
thank's.
Problem if you have...
name = "EURUSD.m"
symbol = "EURUSD"
So you need to modify the "name==symbol" code as below:
if(StringCompare(StringSubstr(name, 0, 6), StringSubstr(symbol, 0, 6), false)==0)
So you need to modify the "name==symbol" code as below:
// MODE_MARGINCALCMODE: 0 - Forex; 1 - CFD; 2 - Futures; 3 - CFD for indices if (MarketInfo(name,MODE_MARGINCALCMODE) == 0 && StringCompare(StringSubstr(name, 0, 6), StringSubstr(symbol, 0, 6), false) == 0)length = 6 for Forex (mostly).
forex2start:
ROMAN5:
thank you.
in my code, if symbol is not exist in market watch , it will be add and use, ( automatically )
#define SYMBOLS_COUNT 29 // Number of SYMBOLS "1+28" string SYMBOLS_NAMES[SYMBOLS_COUNT]={"EMPTY","EURGBP","EURAUD","EURNZD","EURUSD","EURCAD","EURCHF","EURJPY" // 0 1 2 3 4 5 6 7 ,"GBPAUD","GBPNZD","GBPUSD","GBPCAD","GBPCHF","GBPJPY" // 8 9 10 11 12 13 ,"AUDNZD","AUDUSD","AUDCAD","AUDCHF","AUDJPY" // 14 15 16 17 18 ,"NZDUSD","NZDCAD","NZDCHF","NZDJPY" // 19 20 21 22 ,"USDCAD","USDCHF","USDJPY" // 23 24 25 ,"CADCHF","CADJPY" // 26 27 ,"CHFJPY" // 28 };
i think in your solution, at first ; must add all forex symbol and then use " SYMBOL_SELECT " and get equal's for symbol and compar them.
is i am right ?
if yes, so how can insert our symbol's automatically in market watch?
thank you all.
void InitSymbolNames() { for(int i=0;i<SYMBOLS_COUNT;i++) { AddSymbolToMarketWatch(SYMBOLS_NAMES[i]); } }
length = 6 for Forex (mostly).
thank you;
sorry, i will try.
// MODE_MARGINCALCMODE: 0 - Forex; 1 - CFD; 2 - Futures; 3 - CFD for indices
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi;
in my multi currency indicator in default ;
for example symbol " EURUSD" i check/add in market watch ,so indicator calculate & draw.
my question is: if some broker/account type use another symbol like " EURUSD.m " or any other suffixes added to EURUSD or " eurusd " ....
( in calculation those are all equal together ) , how can do this automatically without any modify from user with change from indicator's Input.
thank's in advance.