PhilNelSignals





//+---------------------------------------------------------+
//| Phil_Nell_Signals.mq4                                   |
//| This is a 5 min. system                                 |
//+---------------------------------------------------------+

#property  copyright "Copyright © 2007, Dariuske"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_width1 2
#property indicator_color2 OrangeRed
#property indicator_width2 2

//---- input parameters

extern int SMAPeriod = 50;
extern double Angle = 0.25;
extern int CountBars=500;
extern bool UseAlert=True;

//---- buffers
double CrossUp[];
double CrossDown[];
double prevtime;

double val1[];
double val2[];
int Timer;
string UD="";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,108);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  {   
  int i,shift,counted_bars=IndicatorCounted();
   
   int limit, j, counter;
   double shortMA, medMA, longMA, fAngle;
   
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;

for ( shift = CountBars; shift>=0; shift--) 
{ 
      shortMA = iMA(NULL, 0, 10, 0, MODE_EMA, PRICE_CLOSE, shift);
      medMA = iMA(NULL, 0, 21, 0, MODE_EMA, PRICE_CLOSE, shift);
      longMA = iMA(NULL, 0, 50, 0, MODE_SMA, PRICE_CLOSE, shift);
      fAngle = iCustom(NULL, 0, "SMAAngle", SMAPeriod, 0.15, 2, 0, 0, shift);
      
 	   val1[shift]=0;
		val2[shift]=0;

if  ((fAngle <= -Angle) && (shortMA < medMA) && (medMA < longMA) && 
     (((Close[shift] > shortMA) && (Close[shift] < medMA) ) ||
      ((Open[shift] > shortMA) && (Open[shift] < medMA) )) 
     )
     
{
	val2[shift]=High[shift]+6*Point;
	if (shift < 2 )
	
	{
	   UD="DOWN.";
		DoAlert(UD);
	}

}
 if ((fAngle >= Angle) && (shortMA>medMA) && (medMA > longMA) && 
      (((Close[shift] < shortMA) && (Close[shift] > medMA) ) ||
      ((Open[shift] < shortMA) && (Open[shift] > medMA) ))
     )

{
		val1[shift]=Low[shift]-6*Point;
	
	 if (shift < 2 )
  { 
  UD=" UP.";	
  DoAlert(UD);
  }
}

}
   //return(0);
  }
 
void DoAlert(string UD)
{
   if (!NewBar() || !UseAlert)
      return;
     Alert (Symbol()," ",Period()," Phil Nel Signals",UD);

}


  bool NewBar()
{
   static datetime dt  = 0;
   if (dt != Time[0])
   {
      dt = Time[0];
      return(true);
   }
  
}

//+------------------------------------------------------------------+



Sample



image not available


Analysis



Market Information Used:

Series array that contains close prices for each bar
Series array that contains open prices of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains open time of each bar


Indicator Curves created:

Implements a curve of type DRAW_ARROW


Indicators Used:

Moving average indicator



Custom Indicators Used:
SMAAngle

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen