Six_Consecutive_SA

Author: Written by MagnumFreak
Six_Consecutive_SA
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screenIt sends emails
0 Views
0 Downloads
0 Favorites
Six_Consecutive_SA
//+------------------------------------------------------------------+
//|                                              Six_Consecutive.mq4 |
//|                      Copyright © 2008, MagnumFreak               |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Written by MagnumFreak"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_width1 3
#property indicator_width2 3

extern bool Email_Enabled = true;
extern bool Alert_Enabled = true;
//---- buffers
double GoingUp[];
double GoingDown[];
bool AlertSent,EmailSent;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,217);
   SetIndexBuffer(0,GoingUp);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,218);
   SetIndexBuffer(1,GoingDown);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   for(int i = Bars; i>=0; i--)
      {
      if(Open[i] > Open[i+1] &&
         Open[i+1] > Open[i+2] &&
         Open[i+2]> Open[i+3] &&
         Open[i+3] > Open[i+4] &&
         Open[i+4] > Open[i+5] &&
         Open[i+5] > Open[i+6]) GoingDown[i] = High[i]+(7*Point);
      if(Open[i] < Open[i+1] &&
         Open[i+1] < Open[i+2] &&
         Open[i+2]< Open[i+3] &&
         Open[i+3] < Open[i+4] &&
         Open[i+4] < Open[i+5] &&
         Open[i+5] < Open[i+6]) GoingUp[i] = Low[i]-(7*Point);
      }
//----

   if (Alert_Enabled && (GoingDown[0] != 0 || GoingUp[0] !=0) && !AlertSent)
      {
      Alert(Symbol() + " 6 Consecutive Candles");
      AlertSent=true;
      }
   if (Email_Enabled && (GoingDown[0] != 0 || GoingUp[0] !=0) && !EmailSent)
      {
      SendMail(Symbol() + " 6 Consecutive Candles","Six Consecutive Candles Opened In the Same Direction");
      EmailSent=true;
      }
      
   if(GoingDown[0] == 0 && GoingUp[0] == 0 )
      {
      EmailSent=false;
      AlertSent=false;
      }
   return(0);
  }
//+------------------------------------------------------------------+

Comments