//+------------------------------------------------------------------+ //| Louw Coetzer aka FX Sniper | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, Fx Sniper." #property link "http://www.dunno.net/" //---- indicator settings #property indicator_separate_window #property indicator_buffers 6 #property indicator_color1 Blue #property indicator_color2 White #property indicator_color3 White #property indicator_color4 Yellow #property indicator_color5 Lime #property indicator_color6 Red extern int CCI_period=14; extern int Bollinger_period=50; extern int Bollinger_deviation = 2; extern int Bollinger_shift = 0; //---- indicator buffers double MainCCI[]; double BUpper[]; double BLower[]; double BMain[]; double cciHup[]; double cciHdn[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- 2 additional buffers are used for counting. IndicatorBuffers(8); //---- drawing settings SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1); SetIndexStyle(3,DRAW_LINE,STYLE_DOT,1); SetIndexStyle(4,DRAW_HISTOGRAM,0,1); SetIndexStyle(5,DRAW_HISTOGRAM,0,1); SetIndexBuffer(0,MainCCI); SetIndexLabel(0,"CCI Indicator"); SetIndexBuffer(1,BUpper); SetIndexBuffer(2,BLower); SetIndexBuffer(3,BMain); SetIndexLabel(3,"Bollinger Median Line"); SetIndexBuffer(4,cciHup); SetIndexBuffer(5,cciHdn); //---- name for DataWindow and indicator subwindow label IndicatorShortName("FX Sniper CCI with Bollinger Bands "); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Calculations | //+------------------------------------------------------------------+ int start() { int limit; int i; 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; //---- main loop for(i=0; i= 0 ) cciHup[i] = MainCCI[i]; else cciHup[i] = 0; } for(i=0; i