WPR_RSI_cross_alert

Author: Copyright � 2005, MetaQuotes Software Corp.
WPR_RSI_cross_alert
Indicators Used
Relative strength indexLarry William percent range indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
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);
  }



Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---