hi;
in stock market we can recognize the chart with : " SymbolInfoString(_Symbol,SYMBOL_ISIN) "
if we have SYMBOL_ISIN for one of them and want to add it to market watch so, we must select it by : SymbolSelect(name,true);
but for stock market how can select from : SYMBOL_ISIN function ?
With a loop.
;-)
thanks to reply.
yes i know ; and i have this; https://www.mql5.com/en/forum/12185/page3
Forum on trading, automated trading systems and testing trading strategies
TIMisthebest, 2014.03.20 07:31
. . . int total_symbol=0; // Number of symbols name on the server string empty_symbol="EMPTY"; string SYMBOLS_NAMES[SYMBOLS_COUNT]; . . . //************************************************************************* void OnInit() { SYMBOLS_NAMES[0]="EMPTY"; InitSymbolNames(); . . . } //+------------------------------------------------------------------+ 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(); . . . //--- done return(rates_total); } //+------------------------------------------------------------------+ void InitSymbolNames() { AddSymbolToMarketWatch(SYMBOLS_NAMES[1],"EUR","eur","GBP","gbp"); } //+------------------------------------------------------------------+ string AddSymbolToMarketWatch(string &name,string PART_1,string part_1,string PART_2,string part_2) { name=empty_symbol; // Symbol name total_symbol=SymbolsTotal(false); //--- Total symbols on the server //--- Iterate over the entire list of symbols for(int i=0;i<total_symbol;i++) { if( (SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_BASE)==PART_1&&SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_PROFIT)==PART_2) || (SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_BASE)==part_1&&SymbolInfoString(SymbolName(i,false),SYMBOL_CURRENCY_PROFIT)==part_2) ) { name=SymbolName(i,false); //--- If this symbol is available, SymbolSelect(name,true); //--- add it to the Market Watch window and return(name); //--- return its name break; } } return(name); } //********************************************************************************************************************
& thanks for help
i wrote it before,
and if i want to use that as below for stock market :
. . string active_symbol="EMPTY"; string active_ISIN="MGP.GCM17"; . . void OnInit() { } . . . int OnCalculate( { . . . AddSymbolToMarketWatch(active_ISIN,active_symbol); if(SymbolInfoString(_Symbol,SYMBOL_ISIN)!=active_ISIN) ChartSetSymbolPeriod(0,active_symbol,0); . . . //--- done return(rates_total); } //+------------------------------------------------------------------+ //| Adding the specified symbol to the Market Watch window | //+------------------------------------------------------------------+ string AddSymbolToMarketWatch(string symbol, string back_chart) { 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(SymbolInfoString(name,SYMBOL_ISIN)==active_ISIN) { //--- add it to the Market Watch window and back_chart=name; 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); } //*******************************************************************************************
there is problem and i have not my favorite chart, where is the problem ?
my question refer to the " name " . ( and there is no name for chart and i have " SYMBOL_ISIN " )
and for function " SymbolSelect(name,true) " there is no way to use " SYMBOL_ISIN " .? ( if i am wrong , or i missed some thing about it ?)
could i make my problem clear ?
thanks in advance.
;-)
thanks to reply.
yes i know ; and i have this; https://www.mql5.com/en/forum/12185/page3
i wrote it before,
and if i want to use that as below for stock market :
there is problem and i have not my favorite chart, where is the problem ?
my question refer to the " name " . ( and there is no name for chart and i have " SYMBOL_ISIN " )
thanks in advance.
string AddSymbolToMarketWatch(string symbol, string &back_chart)
sorry but does not work with that correction also.
What doesn't work ?
code must change chart into my favorite i define by " string active_ISIN="MGP.GCM17" "
and it does not happend.
code must change chart into my favorite i define by " string active_ISIN="MGP.GCM17" "
and it does not happend.
I know that. My question is "what doesn't work ?"
ChartSetSymbolPeriod() is a function, it returns a value, and what's the error code if any.
I know that. My question is "what doesn't work ?"
ChartSetSymbolPeriod() is a function, it returns a value, and what's the error code if any.
I know that. My question is "what doesn't work ?"
ChartSetSymbolPeriod() is a function, it returns a value, and what's the error code if any.
i add the high lighted line and get this :
. . if(SymbolInfoString(_Symbol,SYMBOL_ISIN)!=active_ISIN) ChartSetSymbolPeriod(0,active_symbol,0); else Print("Error (",GetLastError(),")"); . . .
i found this : error 4301
i add the high lighted line and get this :
i found this : error 4301
Of course,"EMPTY" is not a valid symbol.
So, why the value of your symbol is still to "EMPTY" after running AddSymbolToMarketWatch() ?
- 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 stock market we can recognize the chart with : " SymbolInfoString(_Symbol,SYMBOL_ISIN) "
if we have SYMBOL_ISIN for one of them and want to add it to market watch so, we must select it by : SymbolSelect(name,true);
but for stock market how can select from : SYMBOL_ISIN function ?