Seddboy30MA





//+------------------------------------------------------------------+
//|                                                 Seddboy30SMA.mq4 |
//|                                  Copyright © 2007, GwadaTradeBoy |
//|                                           gwadatradeboy@yahoo.fr |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, GwadaTradeBoy"
#property link      "gwadatradeboy@yahoo.fr"

#property indicator_chart_window
//----Section #property
#property indicator_buffers 1
#property indicator_color1 LightCoral

//---- extern
extern bool Email = False;
//---- Variables
int         counted_bars,digits,limit,i;
double      SMA30Current;

//---- Buffers
double      ExtMapBuffer1[];    //SMA30
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
   {
//---- indicators
//---- Styles et couleur des Lignes
      SetIndexStyle(0,DRAW_LINE);
      SetIndexBuffer(0,ExtMapBuffer1);
//---- initialisation de digit/paire      
      digits = MarketInfo(Symbol(),MODE_DIGITS);
//----
      return(0);
   }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
   {
//----
   
//----
      return(0);
   }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
   {
      counted_bars=IndicatorCounted();
//----
/*      if(Period() > 1440)
         {
            Print("Error - Chart period is greater than 1 day.");
            return(-1); // then exit
         }*/
      if(counted_bars<0) 
         return(-1);
      if(counted_bars>0) 
         counted_bars--;
      limit=Bars-counted_bars;
      for(i=0; i<limit; i++)
         {
            SMA30Current=iMA(NULL,0,30,0,MODE_SMA,PRICE_CLOSE,i);
            ExtMapBuffer1[i]=SMA30Current;
         }
//---- Buy
      if (Close[0]>SMA30Current)
         {
            Alert("Price close above 30MA ",SMA30Current," Price ",Close[0]," for ", Symbol(),"-",Period());
            PlaySound("alert.wav");
            if (Email)
               SendMail("Seddboy30MA","Price close above 30MA "+DoubleToStr(SMA30Current,digits)+" Price "+DoubleToStr(Close[0],digits)+" for "+Symbol()+"-"+Period());
         }
//---- Sell
      if (Close[0]<SMA30Current)
         {
            Alert("Price close below 30MA ",SMA30Current," Price ",Close[0]," for ", Symbol(),"-",Period());
            PlaySound("alert.wav");
            if (Email)
               SendMail("Seddboy30MA", "Price close below 30MA "+DoubleToStr(SMA30Current,digits)+" Price "+DoubleToStr(Close[0],digits)+" for "+Symbol()+"-"+Period());
         }
      //}            
//----
      return(0);
   }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen
It plays sound alerts
It sends emails