//+----------------------------------------+
//|                              RSI_3.mq4 |
//|                               Makimoto |
//|                                        |
//+----------------------------------------+
#property copyright "Makimoto"
#property link      ""

//■■■■■■■■■■

#property indicator_separate_window
#property indicator_buffers 3

//線の色
#property indicator_color1 Red     //min
#property indicator_color2 Yellow
#property indicator_color3 Turquoise   //max


//線種の設定
#property indicator_style11 STYLE_SOLID
#property indicator_style12 STYLE_SOLID
#property indicator_style13 STYLE_SOLID


//線の幅、太さ
#property indicator_width1 2
#property indicator_width2 1
#property indicator_width3 1


//セパレートウインドウにレベルのラインを表示
#property indicator_level1 85
#property indicator_level2 50
#property indicator_level3 15

#property indicator_minimum 0
#property indicator_maximum 100

//■■■■■■■■■■■■■■■■■■■
//指標バッファ
double RSI_1[] ;  //min
double RSI_2[] ; 
double RSI_3[] ;   //max

//パラメーターの設定
extern int RSI_Per1 = 8 ;
extern int RSI_Per2 = 14 ;
extern int RSI_Per3 = 25 ;

extern int RSI2or3 = 3 ;
//■■■■■■■■■■■■■■■■■■■
//+---------------+
//| 初期化関数    |
//+---------------+
int init()
{
   //指標バッファの割り当て
   SetIndexBuffer(0,RSI_1) ;
   SetIndexBuffer(1,RSI_2) ;
   SetIndexBuffer(2,RSI_3) ;


   //指標バッファのスタイルの指定
   SetIndexStyle(0,DRAW_LINE, STYLE_SOLID, 2, Red) ;
   SetIndexStyle(1,DRAW_LINE, STYLE_SOLID, 1, Yellow) ;
   SetIndexStyle(2,DRAW_LINE, STYLE_SOLID, 1, Turquoise) ;


//---- インディケータの表示開始位置の設定
   SetIndexDrawBegin(0, 100) ;
   SetIndexDrawBegin(1, 100) ;
   SetIndexDrawBegin(2, 100) ;

   return(0);

}  //int init() END


//■■■■■■■■■■■■■■■■■■■
//+------------------+
//| 指標処理関数     |
//+------------------+
int start()
{
   //指標の計算範囲
      int counted_bar = IndicatorCounted(); 
      int limit = Bars-counted_bar;

   //指標の計算
   for(int i=limit-1; i>=0; i--)
	{
if( RSI2or3 == 3 )
		{
		RSI_1[i] = iRSI(NULL,0,RSI_Per1,PRICE_CLOSE,i ) ;
		RSI_2[i] = iRSI(NULL,0,RSI_Per2,PRICE_CLOSE,i ) ;
		RSI_3[i] = iRSI(NULL,0,RSI_Per3,PRICE_CLOSE,i ) ;
		}

if( RSI2or3 == 2 )
		{
		RSI_1[i] = iRSI(NULL,0,RSI_Per1,PRICE_CLOSE,i ) ;
		RSI_2[i] = iRSI(NULL,0,RSI_Per2,PRICE_CLOSE,i ) ;
		}

	}


   return(0);

}  //int start()  END

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+











