Navigation:Home > Content >

cciHookMTF_(1).mq4

Time: 2018-05-11 | Download file:cciHookMTF_(1).mq4

//+------------------------------------------------------------------
//|
//|
//| cciHook
//|
//|
//+------------------------------------------------------------------
#property copyright "alToronto"
#property link      "www.gmail.com"

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

//
//
//
//
//

extern int timeFrame = 0;
extern int cciper = 14;
extern int ExtremeCCIhigh = 100;
extern int ExtremeCCIlow = -100;
extern double signalDisplacement = 1.2;


double signUp[];
double signDown[];
double condition1[];
double condition2[];
double condition3[];

//+------------------------------------------------------------------
//|                                                                  
//+------------------------------------------------------------------
//
//
//
//
//

int init()
{
   IndicatorBuffers(5);
      SetIndexBuffer(0,signUp);   SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,159);
      SetIndexBuffer(1,signDown); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,159);
      SetIndexBuffer(2,condition1);
      SetIndexBuffer(3,condition2);
      SetIndexBuffer(4,condition3);
   return(0);
}
int deinit() { return(0); }

//+------------------------------------------------------------------
//|                                                                  
//+------------------------------------------------------------------
//
//
//
//
//

int start()
{
   int i,limit,shift,counted_bars=IndicatorCounted();

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

   //
   //
   //
   //
   //

   for(i=limit; i>=1; i--)
   {
      shift         = iBarShift(NULL,timeFrame,Time[i]);
      double gap    = iATR(NULL,timeFrame,20,shift)*signalDisplacement;
      condition1[i] = iCCI(NULL,timeFrame,cciper,PRICE_TYPICAL,shift);
      condition2[i] = iCCI(NULL,timeFrame,cciper,PRICE_TYPICAL,shift+1);
      condition3[i] = iCCI(NULL,timeFrame,cciper,PRICE_TYPICAL,shift+2);
      
         //
         //
         //
         //
         //
         
         signUp[i]   = EMPTY_VALUE;
         signDown[i] = EMPTY_VALUE;
      if (condition1[i] > ExtremeCCIhigh && condition1[i] < condition2[i] && condition3[i] < condition2[i]) signDown[i] = iHigh(NULL,timeFrame,shift) + gap;
      if (condition1[i] < ExtremeCCIlow && condition1[i] > condition2[i] && condition3[i] > condition2[i])  signUp[i]   =  iLow(NULL,timeFrame,shift) - gap;
   }
   return(0);
}

Recommend