Download MetaTrader 5
To add comments, please log in or register
Have you developed an application? Publish it in Code Base!
Ideal Trade
133
Ideal Trade 2010.10.09 17:17 

When using code block with SymbolName() and SymbolSelect() functions, and subsequently calling for market data with the SymbolInfoDouble command, I get the error "No prices for symbol EURUSD."

When I don't call the for() loop, I'm able to retrieve market info via SymbolInfoDouble() and SymbolInfoInt() functions and the rest of the code works properly.  

I have been careful to use "false" in SymbolName(i,false), and "true" in SymbolSelect(symname,true), to make sure I'm not calling from only selected symbols and that I'm not "removing" any symbols from market watch during my operations.  I don't want to add or remove symbols from market watch— I just want to get a listing of ALL available symbols and put their names into a string array.  Can someone show me what I'm doing wrong, if anything?

 I believe a similar thread here (https://www.mql5.com/en/forum/1887) describes the same issue, but I don't think there has been a resolution yet.  Is someone at MetaQuotes looking into this, or am I doing something wrong here?

 

   static string symbolNames[999];

   int symtot = SymbolsTotal(false);

   for(int i=0;i<symtot;i++)

         {

            string symname = SymbolName(i,false);

            SymbolSelect(symname,true);

            symbolNames[i] = symname;

            Print("symbolNames[",i,"] = ", symbolNames[i]);

         }

double ConversionBid = SymbolInfoDouble(EURUSD,SYMBOL_BID);

double ConversionAsk = SymbolInfoDouble(EURUSD,SYMBOL_ASK);

double ConversionPoint = SymbolInfoDouble(EURUSD,SYMBOL_POINT);

int ConversionDigits = SymbolInfoInteger(EURUSD,SYMBOL_DIGITS);

int ConversionSpread = SymbolInfoInteger(EURUSD,SYMBOL_SPREAD);

 
&lt;&gt; error for dummies. Get your copy here!
  • www.mql5.com
Make sure you have all symbols activated: right click in Market Watch, then point to "Show all".
hasayama
609
hasayama 2010.10.12 12:15  
TheIdealTrade:

When using code block with SymbolName() and SymbolSelect() functions, and subsequently calling for market data with the SymbolInfoDouble command, I get the error "No prices for symbol EURUSD."

When I don't call the for() loop, I'm able to retrieve market info via SymbolInfoDouble() and SymbolInfoInt() functions and the rest of the code works properly.  

I have been careful to use "false" in SymbolName(i,false), and "true" in SymbolSelect(symname,true), to make sure I'm not calling from only selected symbols and that I'm not "removing" any symbols from market watch during my operations.  I don't want to add or remove symbols from market watch— I just want to get a listing of ALL available symbols and put their names into a string array.  Can someone show me what I'm doing wrong, if anything?

 I believe a similar thread here (https://www.mql5.com/en/forum/1887) describes the same issue, but I don't think there has been a resolution yet.  Is someone at MetaQuotes looking into this, or am I doing something wrong here?

 

Maybe you also need to use SymbolIsSynchronized (https://www.mql5.com/en/docs/marketinformation/symbolissynchronized) and in case when data is missing refresh it? (https://www.mql5.com/en/docs/series/timeseries_access)
Documentation on MQL5: Market Info / SymbolIsSynchronized
  • www.mql5.com
Market Info / SymbolIsSynchronized - Documentation on MQL5
/
To add comments, please log in or register