CCI_Cross_Alert_v1M





//+------------------------------------------------------------------+
//|                                         2CCI_ZeroCross_Alert.mq4 |
//|                   Copyright © 2005, Jason Robinson (jnrtrading). |
//|                                      http://www.jnrtrading.co.uk |
//+-------------------------------------------------------------------------------------+
//mod2008fxtsd
#property copyright "Copyright © 2005, Jason Robinson (jnrtrading)."
#property link      "http://www.jnrtrading.co.uk"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_width1 0 
#property indicator_color2 Yellow
#property indicator_width2 0

extern int CCI_Trend = 5;
extern int SignalLevel = 0;

double bBuffer1[];
double sBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0,bBuffer1);
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexArrow(0,233);
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1,sBuffer1);
   SetIndexEmptyValue(1,EMPTY_VALUE);
   SetIndexArrow(1,234);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int  i, limit, counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;

   double cciTrendNow, cciTrendPrevious;
   
 //  static datetime prevtime = 0;
   
 //  if(prevtime == Time[0]) {
 //     return(0);
 //  }
 //    prevtime = Time[0];
 
  for(i=limit;i>=0;i--)
   {
   cciTrendNow      = iCCI(NULL, 0, CCI_Trend, PRICE_TYPICAL, i);
   cciTrendPrevious = iCCI(NULL, 0, CCI_Trend, PRICE_TYPICAL, i+1);
 
   
//---- 
   
  
      if((cciTrendNow < SignalLevel ) && (cciTrendPrevious > SignalLevel))
      
      sBuffer1[i] = High[i]+ 5*Point;    else  sBuffer1[i]=EMPTY_VALUE;
  
     
      
  
      if((cciTrendNow > -SignalLevel) && (cciTrendPrevious < -SignalLevel))
     
       bBuffer1[i] = Low[i]- 5*Point;  else  bBuffer1[i]=EMPTY_VALUE;
     
 
   }
//----
   return(0);
}
//+--------------------------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_ARROW


Indicators Used:

Commodity channel index


Custom Indicators Used:

Order Management characteristics:

Other Features: