envelope alert

envelope alert
Indicators Used
Moving average indicatorEnvelopes indicator
Miscellaneous
It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
envelope alert

extern int range = 1;
extern int ma_period = 62;
extern int ma_shift = 0;
extern int ma_method = MODE_EMA;
extern int applied_price = PRICE_CLOSE;
extern double deviation = 0.05;
 
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    
//----bb
   double ma = iMA(Symbol(),0,ma_period,ma_shift,ma_method,applied_price,0);
   double envb = iEnvelopes( Symbol(), 0, ma_period, ma_method, ma_shift, applied_price, deviation, MODE_UPPER,0);
   double envs = iEnvelopes( Symbol(), 0, ma_period, ma_method, ma_shift, applied_price, deviation, MODE_LOWER,0);
   
   
   if( (Bid <= ma+(range*Point)) && (Bid >= ma-(range*Point)))
   {
   Alert(Symbol()+" "+ma_period+" Moving Average range reached at ",Bid);
   SendMail ("Alert on " + Symbol(), Symbol()+" "+ma_period+" Moving Average range reached at " + Bid);
   } 
   
   if( (Bid <= envb+(range*Point)) && (Bid >= envb-(range*Point)))
   {
   Alert(Symbol()+" "+ma_period+" High envelope range reached at ",Bid);
   SendMail ("Alert on " + Symbol(), Symbol()+" "+ma_period+" High envelope range reached at " + Bid);
   } 
   
   if( (Bid <= envs+(range*Point)) && (Bid >= envs-(range*Point)))
   {
   Alert(Symbol()+" "+ma_period+" Low envelope range reached at ",Bid);
   SendMail ("Alert on " + Symbol(), Symbol()+" "+ma_period+" Low envelope range reached at " + Bid);
   } 
   
//----
   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 ---