Indicator long Response Time ( seems to be due to symbol disability or closeness)

 

With the code below, sometimes on some special values for 'mySymbol ' which the operator inserts, it took a long time for indicator to respond and then it returned a very huge (more than 20 digits) value for RSI which is expected to be in 0~100 range.
Therefore, as you can see, I added     if(myRSIDefinition !=-1)    and   if(CopyBufferResult!=-1) checks to prevent showing a wrong result.


               double myRSIArray[];
               int myRSIDefinition = iRSI(mySymbol,PERIOD_D1,14,PRICE_CLOSE);
               if(myRSIDefinition !=-1)
                 {
                  ArraySetAsSeries(myRSIArray,true);
                  int CopyBufferResult=CopyBuffer(myRSIDefinition,0,0,3,myRSIArray);
                  if(CopyBufferResult!=-1)
                    {
                     double myRSIValue=NormalizeDouble(myRSIArray[0],2);
                     bot.SendMessage(chat.m_id,"\n"+mySymbol+"\nRSI="+DoubleToString(myRSIValue,2));
                    }
                  else
                    {
                     bot.SendMessage(chat.m_id,"\nMaybe Symbol is NOT okay.");
                    }
                 }
               else
                 {
                  bot.SendMessage(chat.m_id,"\nIndicator is NOT okay.");
                 }

              }

However, it still takes a long time for the evaluation of myRSIDefinition  and  CopyBufferResult themselves. I want to know what is the cause in the first place and how I can prevent it. Would you please count me some common causes?

Note: These are common errors for me:

ERR_MARKET_UNKNOWN_SYMBOL

4301

Unknown symbol

ERR_MARKET_NOT_SELECTED

4302

Symbol is not selected in MarketWatch

However, sometimes the symbol seems OK ( just after a while, my code works well).

 
Aboozar:

With the code below, sometimes on some special values for 'mySymbol ' which the operator inserts, it took a long time for indicator to respond and then it returned a very huge (more than 20 digits) value for RSI which is expected to be in 0~100 range.
Therefore, as you can see, I added     if(myRSIDefinition !=-1)    and   if(CopyBufferResult!=-1) checks to prevent showing a wrong result.


However, it still takes a long time for the evaluation of myRSIDefinition  and  CopyBufferResult themselves. I want to know what is the cause in the first place and how I can prevent it. Would you please count me some common causes?

Note: These are common errors for me:

ERR_MARKET_UNKNOWN_SYMBOL

4301

Unknown symbol

ERR_MARKET_NOT_SELECTED

4302

Symbol is not selected in MarketWatch

However, sometimes the symbol seems OK ( just after a while, my code works well).

check the input for the mySymbol - show what is inputted.

its likely that the handle you get from RSI is an Invalid one, because of wrong Symbol input, and from that everything else falls

 
Stanislav Ivanov:

check the input for the mySymbol - show what is inputted.

its likely that the handle you get from RSI is an Invalid one, because of wrong Symbol input, and from that everything else falls

It works well with every symbol. But sometimes in a trading day, it does not provide any desired output. I am now sure that the problem is not the symbol itself but some market issues like openness and ability to trade etc.

  How can I check these market parameters?
Reason: