Navigation:Home > Content >

SmCCI_2.mq4

Time: 2011-01-01 | Download file:SmCCI_2.mq4

//+------------------------------------------------------------------+
//|                                                        SmCCI.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Gold
#property indicator_color2 Blue
//---- input parameters
extern int       x_prd=0;
extern int       t3_period=8;
extern double    b=0.7;
extern int       per=14;
extern int       ppor=100;
extern int       mpor=-100;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double e1, e2, e3, e4, e5, e6, c1, c2, c3, c4, n, w1, w2, b2, b3;
double dpo, t3, shift, cci, trig;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   b2=b*b;
   b3=b2*b;
   c1=-b3;
   c2=(3*(b2+b3));
   c3=-3*(2*b2+b+b3);
   c4=(1+3*b+b3+3*b2);
   n=t3_period;

   if (n<1) n=1;
   n = 1 + 0.5*(n-1);
   w1 = 2 / (n + 1);
   w2 = 1 - w1;


   int limit;
   int counted_bars=IndicatorCounted();
      //---- 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;
      //---- macd counted in the 1-st buffer
   for(int i=0; i0) trig=ppor;
      if (t3<0) trig=mpor;
      
      ExtMapBuffer1[i]=t3;
      ExtMapBuffer2[i]=trig;
   }
   
   return(0);
  }
//+------------------------------------------------------------------+

Recommend