SGMAcci_Alert





//ShadowWz 03-11-2006, http://www.forex-tsd.com/13195-post2.html
//http://www.forex-tsd.com/metatrader-4/1270-signal-generator-show-mas-crossing-when-overlayed-rsi.html#post13195
#property indicator_separate_window
#property indicator_buffers 5

#property indicator_color1 Green
#property indicator_color2 Blue
#property indicator_color3 Maroon
#property indicator_color4 DarkTurquoise
#property indicator_color5 DarkViolet
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2

#property indicator_level1 100
#property indicator_level2 -100
//#property indicator_level3 30
#property indicator_levelcolor DarkBlue
#property indicator_levelstyle STYLE_DOT


extern int    CCI   = 14;
extern int    Ma   = 8;
extern bool   alertOn = true;
double alertBar;

double RsiBuf[];
double MaP[];
double MaF[];
double Up[];
double Dn[];


void init() {
  SetIndexStyle (0, DRAW_LINE);
  SetIndexStyle (1, DRAW_LINE);
  SetIndexStyle (2, DRAW_LINE);
  SetIndexStyle (3, DRAW_ARROW);
  SetIndexStyle (4, DRAW_ARROW);
  SetIndexBuffer(0, RsiBuf);
  SetIndexBuffer(1, MaP);
  SetIndexBuffer(2, MaF);
  SetIndexBuffer(3, Up);
  SetIndexBuffer(4, Dn);
  SetIndexEmptyValue(3,EMPTY_VALUE);
  SetIndexEmptyValue(4,EMPTY_VALUE);
  SetIndexArrow(3,108);//233 234
  SetIndexArrow(4,108);
}

void deinit() {
}


int start() 
{
  int shift,limit,counted_bars=IndicatorCounted();
  if(counted_bars < 0) return(-1);
  if(counted_bars > 0) counted_bars--;
      limit = Bars-counted_bars;
   for(shift=limit;shift>=0;shift--)
   {
   RsiBuf[shift] = iCCI(NULL,0,CCI,PRICE_CLOSE,shift);
   
   } 

   for(shift=limit;shift>=0;shift--)
   {
      Dn[shift] = EMPTY_VALUE; Up[shift] = EMPTY_VALUE;
      // First Indicator Data
      MaF[shift] = iMAOnArray(RsiBuf,0,Ma,0,MODE_SMA,shift);
      // Previous Indicator Data//secondMA
      MaP[shift] = iMAOnArray(RsiBuf,0,Ma,0,MODE_EMA,shift);
      
      if((MaF[shift]-MaP[shift])*(MaF[shift+1]-MaP[shift+1])<0)
      {         
         
            if(MaF[shift]-MaP[shift]<0)   
            {
            Up[shift] = MaP[shift]-15; Dn[shift] = EMPTY_VALUE;
            if(alertOn && Up[0] != EMPTY_VALUE && Bars>alertBar){
               Alert("SGMAcci Up signal on ", Symbol()," M", Period()," at ",Close[0]); alertBar = Bars;}//Bid tester Close[0]
            }
            else  
            {
            Dn[shift] = MaF[shift]+10; Up[shift] = EMPTY_VALUE;
            if( alertOn && Dn[0] != EMPTY_VALUE && Bars>alertBar) {
               Alert("SGMAcci Down Signal on ",Symbol()," M", Period()," at ",Close[0]); alertBar = Bars;}//Bid
            }
      
      }
   }   
 return(0);
}






Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar


Indicator Curves created:



Indicators Used:

Commodity channel index
Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen