RSI_Del_WA__mtf





//+------------------------------------------------------------------+
//| RSI_Def_WA_mtf                          Waddah_Attar_Def_RSI.mq4 |
//|                              Copyright © 2007, Eng. Waddah Attar |
//| mtf:www.forex-tsd.com Keris2112 ml ki    waddahattar@hotmail.com |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2007, Eng. Waddah Attar"
#property  link      "waddahattar@hotmail.com"
//----
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Green
#property  indicator_color2  Red
#property indicator_width1 2   
#property indicator_width2 1
#property indicator_level1 0
#property indicator_levelcolor  Teal

//----
extern int RSIPeriod1=14;
extern int RSIPeriod2=28;

double   ind_buffer[];
double   MABuffer[];

//extern int History = 1500;
extern int TimeFrame=0;
extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
string IndicatorFileName;


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
//----   
   SetIndexBuffer(0, ind_buffer);
   SetIndexBuffer(1, MABuffer);
//---- 
   TimeFrame = MathMax(TimeFrame,Period());
   switch(TimeFrame)
   {
      case 1 : string TimeFrameStr="M1"; break;
      case 5 : TimeFrameStr="M5"; break;
      case 15 : TimeFrameStr="M15"; break;
      case 30 : TimeFrameStr="M30"; break;
      case 60 : TimeFrameStr="H1"; break;
      case 240 : TimeFrameStr="H4"; break;
      case 1440 : TimeFrameStr="D1"; break;
      case 10080 : TimeFrameStr="W1"; break;
      case 43200 : TimeFrameStr="MN"; break;
      default : TimeFrameStr="TF0";
   }
   IndicatorShortName("RSI_Del ("+RSIPeriod1+","+RSIPeriod2+") ["+TimeFrameStr+"] ");
   IndicatorFileName = WindowExpertName();

  
  //  IndicatorShortName("Waddah Attar Def RSI");
  // Comment("copyright waddahwttar@hotmail.com");

   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
 //  Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double RSI1,RSI2,Explo;
   datetime TimeArray[];

   int  limit, i, y=0, counted_bars = IndicatorCounted();
//----
   if(counted_bars < 0)       return(-1);
//----
   if(counted_bars > 0)      counted_bars--;
   
    ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 

   limit = Bars - counted_bars;

   if (TimeFrame != Period())
      {
         limit = MathMax(limit,TimeFrame/Period());
         for(i=0, y=0; i<limit; i++)
           {
              if(Time[i]<TimeArray[y]) y++;
              
    MABuffer[i] = iCustom(NULL,TimeFrame,IndicatorFileName,RSIPeriod1,RSIPeriod2,0,y);
    ind_buffer[i] = iCustom(NULL,TimeFrame,IndicatorFileName,RSIPeriod1,RSIPeriod2,1,y);
        
            }
            
         return(0);         
      }



//----
 
   for(i = limit; i >= 0; i--)
   {

     RSI1 = iRSI(NULL, 0, RSIPeriod1, PRICE_CLOSE, i);
     RSI2 = iRSI(NULL, 0, RSIPeriod2, PRICE_CLOSE, i);

     MABuffer[i]  = (RSI1-RSI2);
       
 
   }


   for(i = limit; i >= 0; i--)

      ind_buffer[i] = iMAOnArray(MABuffer,0,RSIPeriod1,0,MODE_SMA,i);
 
   

   return(0);
}
//+------------------------------------------------------------------+






Sample





Analysis



Market Information Used:

Series array that contains open time of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:


Relative strength index
Moving average indicator


Custom Indicators Used:
IndicatorFileName

Order Management characteristics:

Other Features: