//+------------------------------------------------------------------+ //| CCI_Woodies.mq4 | //| | //| | //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 RoyalBlue #property indicator_color2 Red //---- input parameters extern int CCIPeriod1=14; extern int CCIPeriod2=6; extern int CountBars=300; //---- buffers double CCIBuffer1[]; double CCIBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line IndicatorBuffers(2); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,RoyalBlue); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(0,CCIBuffer1); SetIndexBuffer(1,CCIBuffer2); //---- //---- return(0); } //+------------------------------------------------------------------+ //| CCI_Woodies | //+------------------------------------------------------------------+ int start() { SetIndexDrawBegin(0,Bars-CountBars+CCIPeriod1); SetIndexDrawBegin(1,Bars-CountBars+CCIPeriod1); int i,counted_bars=IndicatorCounted(); //---- if(CountBars<=CCIPeriod1) return(0); //---- initial zero if(counted_bars<1) for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[CountBars-i]=0.0; //---- i=CountBars-CCIPeriod1-1; // if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1; while(i>=0) { CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i); CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i); i--; } return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Commodity channel index
Custom Indicators Used:
Order Management characteristics:
Other Features: