WPR_RSI_cross_alert





//+------------------------------------------------------------------+
//|                                          WPR_RSI_cross_alert_sw  |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
//2008 fxtsd   ki

#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

#property indicator_width1 2
#property indicator_width2 1


#property indicator_level1  80
#property indicator_level2  50
#property indicator_level3  20
#property indicator_levelstyle 2
#property indicator_levelcolor DarkOliveGreen

extern int WPR_period= 14;

extern int RSI_period      = 9;
extern int RSI_price       = 0;

extern bool alert = true;

string short_name;


double WPR_Buffer[];
double RSI_Buffer[];


//---


int init()
  {


   IndicatorBuffers(2);
   
     
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
  

   SetIndexBuffer(0,WPR_Buffer);
   SetIndexBuffer(1,RSI_Buffer);


   short_name= "WPR ("+WPR_period+") x RSI ("+RSI_period+") ";

   IndicatorShortName(short_name);
   
   SetIndexLabel(0,"WPR");
   SetIndexLabel(1,"RSI");
  

   return(0);
  }

//+---


int start()
  {
  
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   
   for(int i=0; i<limit;i++)
     {       
 
      RSI_Buffer[i]     = iRSI(NULL,0,RSI_period,RSI_price,i);
      WPR_Buffer[i]     = iWPR(NULL,0,WPR_period,i)+100;
     
     }
       

   static datetime lastalertUp=0,lastalertDn=0;
   string   alertmessage = "WPRxRSI: " +Symbol()+" chart M"+Period()+"  Bid price "+DoubleToStr(Bid,4)+";  " ; 

   if (WPR_Buffer[1]<RSI_Buffer[1] && WPR_Buffer[0]>RSI_Buffer[0]  && alert && lastalertUp!=Time[0]) 
   {  Alert(alertmessage +short_name+": WPR crossed RSI Up");
      lastalertUp=Time[0];
   }
   
   if (WPR_Buffer[1]>RSI_Buffer[1] && WPR_Buffer[0]<RSI_Buffer[0]  && alert && lastalertDn!=Time[0]) 
   {  Alert(alertmessage +short_name+": WPR crossed RSI Down");
      lastalertDn=Time[0];
   }



   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
Larry William percent range indicator


Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen