//+------------------------------------------------------------------+
//|                               Shinigami RSI spread indi v1.0.mq4 |
//|                                                     by Shinigami |
//|                                              Shini1984@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Shinigami"
#property link      "Shini1984@gmail.com"

#property indicator_separate_window
#property indicator_minimum -100
#property indicator_maximum 100
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 LimeGreen
#property indicator_color3 Red
#property indicator_width1 1
#property indicator_width2 3
#property indicator_width3 3

extern int RSIshort = 3;
extern int RSIlong = 8;
extern bool line = false;

double RSIspread[];
double RSIup[];
double RSIdn[];

//================================================================================================+
int init()
{
string short_name;
IndicatorBuffers(3);
SetIndexBuffer(0,RSIspread);
SetIndexBuffer(1,RSIup);
SetIndexBuffer(2,RSIdn);
if(line) { SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_NONE); SetIndexStyle(2,DRAW_NONE); }
if(!line) { SetIndexStyle(0,DRAW_NONE); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexStyle(2,DRAW_HISTOGRAM); }
short_name="RSI spread "+RSIshort+"-"+RSIlong;
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
return(0);
}
//================================================================================================+
int deinit()
{
return(0);
}
//================================================================================================+
int start()
{
RefreshRates();
int i=0,limit=1000;
for(i=0;i<limit;i++) {
RSIspread[i]=iRSI(Symbol(),0,RSIshort,0,i)-iRSI(Symbol(),0,RSIlong,0,i);
}
if(!line) {
for(i=0;i<limit;i++) {
if(RSIspread[i]>=0) RSIup[i]=RSIspread[i];
if(RSIspread[i]<0) RSIdn[i]=RSIspread[i];
} }
return(0);
}
//================================================================================================+

