Learning and writing together in MQL5 - page 41

 
Dimka-novitsek: Does this mean that the platform does not support this pair? 2012.09.21 16:23:17 Failed to create an iMA indicator handle for pair CADJPY/PERIOD_D1, error code 4302
You need to check why an error has occurred. The error code doesn't indicate the exact reason why the symbol is not selected - whether the programmer hasn't provided the connection of the required symbol, or the symbol is not supported by the specific quotes provider.
 
Yedelkin:
You have to check why the error occurred. After all, the error code does not say for what reason the symbol is not selected - whether the programmer has not provided a connection to the correct symbol, or the symbol is really not supported by a particular quotation provider.

Thank you!!! Right! I've been thinking something like that all along,

Oh, they're interrupting.

but how? Yeah, I'm acting as if from the help...

 
Dimka-novitsek but how? Yes, I'm acting as from the help...
There is no ready-made code, but here's an idea: SymbolsTotal() gives the total number of all symbols. It remains to search through these symbols and find out whether the sought symbol is present among them. If not, print it, and if so, check if the desired symbol is selected in Market Watch. If not, plug it in.
 
THANK YOU!!!
 
Is there any way to simulate tics for the weekend?
 
Great!!! Thank you!!! Wow, I didn't think of that myself, really... Tell me, I don't understand where the prints are written in the tester, or if they are written. I don't see them in the tester's logbook!
 
Dimka-novitsek: Tell me, I don't know where the prints are written in the tester, or if they are. I don't see them in the tester's logbook!
Right-click on the tab and there will be options
 
Thank you!!! Now...
 

Good evening! To an old topic

I use the SymbolsTotal() function to find out that there are 101 symbols (wow!!!) .

And most importantly - something like this symbol is stupid does not recognize. Here.

ERR_INDICATOR_UNKNOWN_SYMBOL
4801
Unknown symbol

But if you need, here, look plies if you can and need

/////////////////////////////////////////////////////////////////////

double CalculateStrengthPairsTF(string a_symbol, ENUM_TIMEFRAMES a_timeframe) {

SymbolSelect(
  a_symbol,       // имя символа
  true      // включить или выключить
   );

    int DIGITS_ = SymbolInfoInteger(a_symbol,SYMBOL_DIGITS);
   //---
    MqlTick last_tick;
   if(SymbolInfoTick(a_symbol,last_tick));
   double BID_ = last_tick.bid;
   BID_ = NormalizeDouble( BID_, DIGITS_);
  // Print("a_symbol");Print(a_symbol); Print("a_timeframe");Print(a_timeframe); Print( "Period_");Print( Period_); ResetLastError();
    MA_handle=iMA(a_symbol,periodd(a_timeframe),Period_,0,method_ma,price_applied);
    //--- заполнение массива MA[] текущими значениями индикатора iMA
   //--- в массив будет записано 100 элементов
   
 //--- если не удалось создать хэндл
   if(MA_handle==INVALID_HANDLE)
     {
      //--- сообщим о неудаче и выведем номер ошибки
      PrintFormat("Не удалось создать хэндл индикатора iMA для пары %s/%s, код ошибки %d",
                  a_symbol,
                  EnumToString(a_timeframe),
                  GetLastError()); ResetLastError();} 
                  
                  
  int Total= SymbolsTotal(true);Print("Total");Print(Total);                 
  int Dotal= SymbolsTotal(false);Print("Dotal");Print(Dotal);        
   
   
   CopyBuffer(MA_handle,0,0,100,MA);
   //--- задаём порядок индексации массива MA[] как в MQL4
   ArraySetAsSeries(MA,true);  
   double iMA_ = NormalizeDouble(MA[0], DIGITS_);
           
   ATR_handle=iATR(a_symbol,periodd(a_timeframe),Period_   );
   CopyBuffer(ATR_handle,0,0,100,ATR);
   ArraySetAsSeries(ATR,true);
   double iATR_ = NormalizeDouble(ATR[0], 4);
   double for_ret = 0;
   if (iATR_ > 0.0) {
      for_ret = 100.0 * (MathAbs(BID_ - iMA_) / iATR_);
      if (BID_ < iMA_) for_ret = -1.0 * for_ret;
   }
   return (for_ret);
}



///////////////////////////////////////////////////////////////////////////////

 
Dimka-novitsek: I use SymbolsTotal() to find out that there are 101 characters in total (wow!!!) .

More importantly, it doesn't recognise the symbol. Here.

ERR_INDICATOR_UNKNOWN_SYMBOL
4801
Unknown symbol

Also there is no CADJPY symbol in my terminal. See it this way: Cntrl+M, right click, option "Symbols...".
Reason: