Navigation:Home > Content >

RSI-M15.mq4

Time: 2013-07-24 | Download file:RSI-M15.mq4

//+------------------------------------------------------------------+
//|                                                     MTF_RSI.mq4 |
//|                                      Copyright © 2006, Keris2112 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Keris2112"
#property link      "http://www.forex-tsd.com"

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Magenta
#property indicator_style1 2
#property indicator_color2 Red//Lime
#property indicator_width2 2
#property indicator_color3 Lime//Red
#property indicator_width3 2
#property indicator_color4 Yellow
#property indicator_width4 1
//#property indicator_color5 DeepSkyBlue
//#property indicator_color6 DeepSkyBlue
#property indicator_color7 DodgerBlue
#property indicator_width7 2
#property indicator_color8 DodgerBlue
#property indicator_width8 2


#property indicator_minimum 0
#property indicator_maximum 100

//=================================================================================================
#property indicator_level1 95
#property indicator_level3 50
#property indicator_level2 5
#property indicator_levelcolor Red  
#property indicator_levelstyle STYLE_DOT
#property indicator_levelwidth 0
//=================================================================================================

extern int RSI_Period_1 = 8;//14
extern int RSI_Period_2 = 4;
extern int RSI_Period_3 = 2;

extern int TF1          = 15;

extern int  LineSize1 = 1;
extern int  LineSize2 = 2;
extern int  LineSize3 = 2;
extern int  DotSize1  = 2;
extern int  DotSize2  = 1;
extern int NumberOfBars = 500; 

//-------------------------------------------------------------------------------------------------
double RSIBuffer1[];
double RSIBuffer2[];
double RSIBuffer3[];
double RSIBuffer4[];
double upX[];
double dnX[];
double upX2[];
double dnX2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    IndicatorDigits(+2);
    SetIndexStyle (0, DRAW_LINE, STYLE_DOT,1);
    SetIndexBuffer(0, RSIBuffer1);
    SetIndexStyle (1, DRAW_LINE, STYLE_SOLID,2);
    SetIndexBuffer(1, RSIBuffer2);
    SetIndexStyle (2, DRAW_LINE, STYLE_SOLID,2);
    SetIndexBuffer(2, RSIBuffer3);

    SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,1);
    SetIndexArrow(3,159);
    SetIndexBuffer(3,RSIBuffer4);
    
    SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID,1);
    SetIndexArrow(4,222);
    SetIndexBuffer(4,upX);
    SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID,1);
    SetIndexArrow(5,221);
    SetIndexBuffer(5,dnX);
    
     SetIndexStyle(6,DRAW_ARROW,STYLE_SOLID,1);
    SetIndexArrow(6,234);
    SetIndexBuffer(6,upX2);
    SetIndexStyle(7,DRAW_ARROW,STYLE_SOLID,1);
    SetIndexArrow(7,233);
    SetIndexBuffer(7,dnX2);
    
//================================================================================================= 

      string  ThisName = "RSI-M15";// "RSI-3PER-H4";
       string Text=ThisName;
        Text=Text+"  ("+TF1;
        Text=Text+")";
        Text=Text+"(";
        Text=Text+" "+DoubleToStr(RSI_Period_1,0);
        Text=Text+"/"+DoubleToStr(RSI_Period_2,0);
        Text=Text+"/"+DoubleToStr(RSI_Period_3,0);
        Text=Text+")  ";
      IndicatorShortName(Text); 
//=================================================================================================       
   switch(TF1)
   {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
   }


  }
//----
   return(0);
 
//+-----------------------------------------------------------------------------------------------+
//+-----------------------------------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
   int sh, nsb,nsb2,nsb3;

   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TF1); 
   
   limit=Bars-counted_bars;
   for(i=0,y=0;i RSIBuffer1[i] && RSIBuffer2[i+1] < RSIBuffer1[i+1] ) dnX[i] = RSIBuffer2[i]-30;   
 // if (RSIBuffer2[i] < RSIBuffer1[i] && RSIBuffer2[i+1] > RSIBuffer1[i+1] ) upX[i] = RSIBuffer2[i]+30;
    
 // if (RSIBuffer3[i] > RSIBuffer2[i] && RSIBuffer3[i+1] < RSIBuffer2[i+1] ) dnX2[i] = RSIBuffer3[i]-25;   
 // if (RSIBuffer3[i] < RSIBuffer2[i] && RSIBuffer3[i+1] > RSIBuffer2[i+1] ) upX2[i] = RSIBuffer3[i]+25;
//===========================================================================================================
   
   }    
   return(0);
  }
//+---------------------------------------------------------------------------------------------------------+

Recommend