Navigation:Home > Content >

CCIFilter_Signals_v0.1.mq4

Time: 2015-01-03 | Download file:CCIFilter_Signals_v0.1.mq4

//+------------------------------------------------------------------+
//|                                       CCIFilter Signals v0.1.mq4 |
//|                                  Copyright © 2006, Forex-TSD.com |
//|                                                Written by nnjeim |   
//|                                                                  |                                      
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Forex-TSD.com "
#property link      "http://www.forex-tsd.com/"


#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 MediumBlue
#property indicator_color2 LightBlue
#property indicator_color3 Orange
#property indicator_color4 Crimson
//---- input parameters

extern int TrendCCI=50;
extern int EntryCCI=14;
extern int ArrowShift=5;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,233);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,233);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
   
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,234);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexEmptyValue(2,0.0);
   
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,234);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexEmptyValue(3,0.0);
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int limit,i;
   double curcci0=0.0,prevcci0=0.0,curcci1=0.0,prevcci1=0.0,alertTag;
   limit=Bars-counted_bars;
   for (i=limit;i>=0;i--)
      {
      curcci0=iCCI(NULL,0,TrendCCI,PRICE_TYPICAL,i);
      curcci1=iCCI(NULL,0,EntryCCI,PRICE_TYPICAL,i);
      prevcci0=iCCI(NULL,0,TrendCCI,PRICE_TYPICAL,i+1);
      prevcci1=iCCI(NULL,0,EntryCCI,PRICE_TYPICAL,i+1);
      
      if ((curcci0>0)&&(prevcci0<0) && curcci1>0) ExtMapBuffer1[i]=Open[i]-ArrowShift*Point;
      if ((curcci0<0)&&(prevcci0>0) && curcci1<0) ExtMapBuffer4[i]=Open[i]+ArrowShift*Point;
      
      if ((curcci0>0)&&(prevcci1<0) && curcci1>0) ExtMapBuffer2[i]=Open[i]-ArrowShift*Point;
      if ((curcci0<0)&&(prevcci1>0) && curcci1<0) ExtMapBuffer3[i]=Open[i]+ArrowShift*Point;
      
      
      }

   return(0);
  }
//+------------------------------------------------------------------+

Recommend