Download MetaTrader 5
To add comments, please log in or register
Do you wonder how to use widgets? Read the article!
xilisam
23
xilisam 2016.04.09 19:34 

hi friends 

 Im working on my custom indicator but Im having probleme getting the RSI for JPY/USD

i can get only get the USD/JPY's RSI

so, how to calc it ?? 

 best regards 

Fernando Carreiro
1449
Fernando Carreiro 2016.04.09 21:03  

According to the documentation here on the site <https://www.mql5.com/go?link=https://ta.mql4.com/indicators/oscillators/relative_strength_index>, the RSI is calculated as follows:

RSI = 100-(100/(1+U/D))
So, just reverse it!
xilisam
23
xilisam 2016.04.09 22:11  
FMIC:

According to the documentation here on the site <https://www.mql5.com/go?link=https://ta.mql4.com/indicators/oscillators/relative_strength_index>, the RSI is calculated as follows:

So, just reverse it!

Im good good enough to that calc but look at this code

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

   int counted_bars=IndicatorCounted();
   for(int i=0;i<Bars;i++)
   {  
      double usdi = (iRSI("USDGBP",0,RSIperiod,PRICE_CLOSE,i)+iRSI("USDEUR",0,RSIperiod,PRICE_CLOSE,i)+iRSI("USDCNY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("USDJPY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("USDAUD",0,RSIperiod,PRICE_CLOSE,i))/5;
      double gbpi = (iRSI("GBPUSD",0,RSIperiod,PRICE_CLOSE,i)+iRSI("GBPEUR",0,RSIperiod,PRICE_CLOSE,i)+iRSI("GBPCNY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("GBPJPY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("GBPAUD",0,RSIperiod,PRICE_CLOSE,i))/5;
      double euri = (iRSI("EURGBP",0,RSIperiod,PRICE_CLOSE,i)+iRSI("EURUSD",0,RSIperiod,PRICE_CLOSE,i)+iRSI("EURCNY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("EURJPY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("EURAUD",0,RSIperiod,PRICE_CLOSE,i))/5;
      double cnyi = (iRSI("CNYGBP",0,RSIperiod,PRICE_CLOSE,i)+iRSI("CNYEUR",0,RSIperiod,PRICE_CLOSE,i)+iRSI("CNYUSD",0,RSIperiod,PRICE_CLOSE,i)+iRSI("CNYJPY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("CNYAUD",0,RSIperiod,PRICE_CLOSE,i))/5;
      double jpyi = (iRSI("JPYGBP",0,RSIperiod,PRICE_CLOSE,i)+iRSI("JPYEUR",0,RSIperiod,PRICE_CLOSE,i)+iRSI("JPYCNY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("JPYUSD",0,RSIperiod,PRICE_CLOSE,i)+iRSI("JPYAUD",0,RSIperiod,PRICE_CLOSE,i))/5;
      double audi = (iRSI("AUDGBP",0,RSIperiod,PRICE_CLOSE,i)+iRSI("AUDEUR",0,RSIperiod,PRICE_CLOSE,i)+iRSI("AUDCNY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("AUDJPY",0,RSIperiod,PRICE_CLOSE,i)+iRSI("AUDUSD",0,RSIperiod,PRICE_CLOSE,i))/5;
   
      if(usd==true){
         usdBuffer[i]=usdi;
      }
      if(gbp==true){
         gbpBuffer[i]=gbpi;
      }
      if(eur==true){
         eurBuffer[i]=euri;
      }
      if(cny==true){
         cnyBuffer[i]=cnyi;
      }
      if(jpy==true){
         jpyBuffer[i]=jpyi;
      }
      if(aud==true){
         audBuffer[i]=audi;
      }
   }  

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

 the prob Im having is that the jpyBuffer and cnyBuffer are 0.

Fernando Carreiro
1449
Fernando Carreiro 2016.04.09 22:58  

There is no "JPYUSD" symbol nor several of the others you are using such as "JPYGBP", "JPYEUR",

So use the iRSI for "USDJPY" instead and reverse the value (100 - iRSI) i.e. RSI("JPYUSD") = 100 - iRSI("USDJPY").

I gave you the calculation of the RSI for a reason, so that you could see how to reverse it. You need to apply your high school maths (such as algebra).

As for the many non-existent currency pairs. First lookup what is available from your broker. Don't just invent symbols or currency pairs that don't exist.

xilisam
23
xilisam 2016.04.09 23:28  
FMIC:

There is no "JPYUSD" symbol nor several of the others you are using such as "JPYGBP", "JPYEUR",

So use the iRSI for "USDJPY" instead and reverse the value (100 - iRSI) i.e. RSI("JPYUSD") = 100 - iRSI("USDJPY").

I gave you the calculation of the RSI for a reason, so that you could see how to reverse it. You need to apply your high school maths (such as algebra).

As for the many non-existent currency pairs. First lookup what is available from your broker. Don't just invent symbols or currency pairs that don't exist.


I got it , thnx thnx thnx a lot Fernando
/
To add comments, please log in or register