//+------------------------------------------------------------------+ //| #CCIs&RSI8___v5.mq4 | //| Copyright © 2008, MetaQuotes Software Corp. | //| http://kinonen.over-blog.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, MetaQuotes Software Corp." #property link "http://kinonen.over-blog.com" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color6 Blue #property indicator_color7 PaleGreen #property indicator_color3 DarkGreen #property indicator_color4 Red #property indicator_color5 Yellow #property indicator_color1 OrangeRed #property indicator_color2 Lime #property indicator_level1 100 #property indicator_level2 200 #property indicator_level3 300 #property indicator_level4 0 #property indicator_level5 -300 #property indicator_level6 -200 #property indicator_level7 -100 #property indicator_levelcolor Aqua extern int CCI1=34; extern int CCI2=170; extern int RsiMultiplicator=1; extern int NbOfCandles=1000; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; double ExtMapBuffer7[]; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW, EMPTY,2); SetIndexArrow(0, 234); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1, DRAW_ARROW, EMPTY,2); SetIndexArrow(1, 233); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle (2,DRAW_HISTOGRAM, 0, 4); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle (3,DRAW_HISTOGRAM, 0, 4); SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle (4,DRAW_HISTOGRAM, 0, 4); SetIndexBuffer(4,ExtMapBuffer5); SetIndexStyle(5,DRAW_LINE, STYLE_SOLID, 2, Blue); SetIndexBuffer(5,ExtMapBuffer6); SetIndexStyle(6,DRAW_LINE, STYLE_SOLID, 2, PaleGreen); SetIndexBuffer(6,ExtMapBuffer7); SetIndexLabel(0,"CCI 34"); SetIndexLabel(1,"CCI 170"); SetIndexLabel(2,"RSI>55"); SetIndexLabel(3,"RSI<45"); SetIndexLabel(4,"45<RSI<55"); //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() {int limit; double val1,val2,val3,val22,val11,val33; 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; //========================================== for(int i = NbOfCandles; i >= 0; i--) { val1=iCCI(NULL,0,CCI1,PRICE_TYPICAL,i); val11=iCCI(NULL,0,CCI1,PRICE_TYPICAL,i+1); val2=iCCI(NULL,0,CCI2,PRICE_TYPICAL,i); val22=iCCI(NULL,0,CCI2,PRICE_TYPICAL,i+1); val3=iRSI(NULL,0,8,PRICE_CLOSE,i); val33=iRSI(NULL,0,8,PRICE_CLOSE,i+1); if((val2>0 && val1>0 && val11<0)||(val1>0 && val2>0 && val22<0)&& (val3>55) ) //&& val3>55) ExtMapBuffer2[i]=-100; else if((val2<0 && val1<0 && val11>0)||(val1<0 && val2<0 && val22>0) && (val3<45)) // && val33>45 ) ExtMapBuffer1[i]=100; if (val3>=55) ExtMapBuffer3[i]=-val3*RsiMultiplicator; else if (val3<=45) ExtMapBuffer4[i]=-val3*RsiMultiplicator; else ExtMapBuffer5[i]=-val3*RsiMultiplicator; ExtMapBuffer6[i]=val1; //CCI34 ExtMapBuffer7[i]=val2; //CCI170 } //---- //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_ARROW
Implements a curve of type DRAW_LINE
Indicators Used:
Commodity channel index
Relative strength index
Custom Indicators Used:
Order Management characteristics:
Other Features: