//+------------------------------------------------------------------+
//|                                              Two_Symbols_RSI.mq4 |
//|                        Copyright 2022, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_level1 50
#property indicator_levelcolor Silver
#property indicator_minimum 0
#property indicator_maximum 100

double rsi1[];
double rsi2[];

extern int    RSI_Period = 21;
extern string Symbol_1 = "USDJPY";
extern string Symbol_2 = "EURUSD";
input color   Symbol_1_Color = clrDodgerBlue;
input color   Symbol_2_Color = clrGold;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,0,Symbol_1_Color);
   SetIndexBuffer(0,rsi1);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,0,Symbol_2_Color);
   SetIndexBuffer(1,rsi2);
//----
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//----
   
//----
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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 &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
                int limit = rates_total - prev_calculated;
                if(prev_calculated > 0) 
                 {
                 limit++;
                 }
                 for(int i = limit - 1; i >= 0; i--) 
                  {
                   rsi1[i] =  iRSI(Symbol_1,_Period,RSI_Period,PRICE_CLOSE,i);
                   rsi2[i] =  iRSI(Symbol_2,_Period,RSI_Period,PRICE_CLOSE,i);
                  }
   
//----
   return(rates_total);
  }
//+------------------------------------------------------------------+

