//+------------------------------------------------------------------+
//|                                                JPY Indicator.mq4 |
//|                                   Copyright © 2009, Mark Johnson |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Mark Johnson"

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 100.0
#property indicator_buffers 1
#property indicator_color1 Tomato
#property indicator_level1 20.0
#property indicator_level2 40.0
#property indicator_level3 60.0
#property indicator_level4 80.0
#property indicator_levelcolor DarkSlateGray


double ExtMapBuffer1[];
string postfix = "";

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    SetIndexStyle(0,DRAW_LINE);
    SetIndexBuffer(0,ExtMapBuffer1);
    postfix = StringSubstr(Symbol(),6,3);
    return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
    return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {   
    int limit;
    int counted_bars = IndicatorCounted();
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    limit = Bars - counted_bars;
    
    for(int i = 0; i < limit; i++)
      {
    
        double aud = 100 - iRSI("AUDJPY",0,2,PRICE_WEIGHTED,i);
        double cad = 100 - iRSI("CADJPY",0,2,PRICE_WEIGHTED,i);
        double chf = 100 - iRSI("CHFJPY",0,2,PRICE_WEIGHTED,i);
        double eur = 100 - iRSI("EURJPY",0,2,PRICE_WEIGHTED,i);
        double gbp = 100 - iRSI("GBPJPY",0,2,PRICE_WEIGHTED,i);
        double nzd = 100 - iRSI("NZDJPY",0,2,PRICE_WEIGHTED,i);
        double usd = 100 - iRSI("USDJPY",0,2,PRICE_WEIGHTED,i);
    
        ExtMapBuffer1[i] = (aud + cad + chf + eur + gbp + nzd + usd) / 7;
    
      }
    
    return(0);
    
  }  

