WilliamsPR_alert

WilliamsPR_alert
Indicators Used
Larry William percent range indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
WilliamsPR_alert

#property indicator_separate_window
#property indicator_buffers 1 
#property indicator_color1 Magenta 
#property indicator_maximum 0
#property indicator_minimum -100
#property indicator_level1 -5
#property indicator_level2 -95
#property indicator_level3 -50
#property indicator_levelwidth 1
#property indicator_levelstyle STYLE_SOLID
#property indicator_levelcolor Aqua

extern int WPRPeriod = 90;
extern bool Alerts = true;
extern bool UseSendMail = false;

double ExtMapBuffer1[]; 
int shortA;
int longA;
datetime lasttime = 0;

int init() 
  { 
   SetIndexStyle(0,DRAW_LINE); 
   SetIndexBuffer(0,ExtMapBuffer1);
   IndicatorShortName("%R(WPRPeriod)");
   
   return(0); 
  } 

int deinit() 
  { 
//----  
    
//---- 
   return(0); 
  } 


int start() 
  { 
    int    counted_bars=IndicatorCounted(); 
   if (counted_bars<0) return(-1); 
   if (counted_bars>0) counted_bars--; 
    
   int pos=Bars-counted_bars; 
 //  Alert(TimeCurrent());
   while(pos>=0) 
     { 
         ExtMapBuffer1[pos] = iWPR(NULL, 0, WPRPeriod, pos);          
         pos--; 
     } 
     
    

      if ( iWPR(NULL, 0, WPRPeriod, 0) > -95) {
         longA = 0;
         IndicatorShortName("%R("+WPRPeriod+")");
      }
      if ( iWPR(NULL, 0, WPRPeriod, 0) < -5) {
         shortA = 0;
          IndicatorShortName("%R("+WPRPeriod+")");
      }
      
          
      if ( iWPR(NULL, 0, WPRPeriod, 0) < -95 && longA != 1) {
         if (lasttime != Time[0]) {
          if (Alerts == true)Alert(Symbol()+" %R("+WPRPeriod+") is below -95. Buy if in blue zone.");
          if (UseSendMail == true)  SendMail(Symbol()+" %R("+WPRPeriod+") is below -95. Buy if in blue zone"," ");
          lasttime = Time[0];
         }
           IndicatorShortName("%R("+WPRPeriod+") Current signal: LONG  ");
          longA=1;        
      }
      if ( iWPR(NULL, 0, WPRPeriod, 0) > -5 && shortA != 1) {
      if (lasttime != Time[0]) {
          if (Alerts == true)Alert(Symbol()+" %R("+WPRPeriod+") is above -5. Sell if in red zone.");    
          if (UseSendMail == true) SendMail(Symbol()+" %R("+WPRPeriod+") is above -5. Sell if in red zone"," ");
          lasttime = Time[0];
        }
          IndicatorShortName("%R("+WPRPeriod+") Current signal: SHORT  ");
          shortA = 1;   
      }      
   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 ---