#property indicator_separate_window#property indicator_buffers 3#property indicator_color1 Red#property indicator_width1 2#property indicator_color2 RoyalBlue#property indicator_width2 2#property indicator_level1 0.0#property indicator_levelcolor clrSilver#property indicator_levelstyle STYLE_DOT//---- input parametersextern int CCIperiod = 21;extern int CCIprice = 5;extern int HotLevel = 200;extern color LevelColor = clrSilver;ENUM_LINE_STYLE LevelStyle = STYLE_DOT;extern int LevelSize = 0;extern int num_bars=5000;// parametersbool initDone=true;int bar=0;int prevbars=0;int startpar=0;int cs=0;int prevcs=0;string commodt="nonono";int frame=0;int bars=0;int count = 0, thisbar = 0;double now, prev;bool flag;//---- buffersdouble HistoCCI[];double HistoRed[];double HistoBlue[];//+ www.expforex.com edit AlertArrow + extern string Alerts="Алерты и стрелки от www.expforex.com"; extern bool AlerT=true; // Выдавать алерт на экран extern bool Mail=false; // Посылать сообщение extern bool Push=false; // Посылать ПУШ на телефон extern bool Arrow=true; // Ставить стрелки на сигналах extern color clrBUY = clrBlue, clrSELL = clrRed; extern int CodBUY = 233, CodSELL = 234; extern int shift=1; // На каком баре считать сигнал 0 - на текущем 1 - на закрытом extern int intPoint = 50;// Отступ стрелки int timeee; // Внутренняя переменная string nameInd;voidSetArrow(int cd, color cl, string nm="", datetime t1=0, double p1=0, int sz=1) { if (nm=="") nm=DoubleToStr(Time[0], 0); if (t1<=0) t1=Time[0]; if (p1<=0) p1=Bid; nameInd=WindowExpertName( );int wind=WindowFind(nameInd);wind=0; if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_ARROW, wind, 0,0); ObjectSet(nm, OBJPROP_TIME1 , t1); ObjectSet(nm, OBJPROP_PRICE1 , p1); ObjectSet(nm, OBJPROP_ARROWCODE, cd); ObjectSet(nm, OBJPROP_COLOR , cl); ObjectSet(nm, OBJPROP_WIDTH , sz);}voidExpforex_AlertArrow(string text="",int arrowdir=0,bool history=false,int i=0) { nameInd=WindowExpertName(); int wind=WindowFind(nameInd); if(wind==-1)wind=0; if(!history) { if(AlerT) Alert(text); if(Arrow) if(arrowdir==1) SetArrow(CodBUY,clrBUY,nameInd+DoubleToStr(Time[shift],0),Time[shift],(Low[shift]-intPoint*Point)); if(Arrow) if(arrowdir==2) SetArrow(CodSELL,clrSELL,nameInd+DoubleToStr(Time[shift],0),Time[shift],(High[shift]+intPoint*Point)); if(!IsTesting())if(Mail) SendMail(text,text); if(!IsTesting())if(Push) SendNotification(text); } if(history) { if(Arrow) if(arrowdir==1) SetArrow(CodBUY,clrBUY,nameInd+DoubleToStr(Time[shift+i],0),Time[shift+i],(Low[shift+i]-intPoint*Point)); if(Arrow) if(arrowdir==2) SetArrow(CodSELL,clrSELL,nameInd+DoubleToStr(Time[shift+i],0),Time[shift+i],(High[shift+i]+intPoint*Point)); } }voidOnDeinit(constint reason) { for(int i=ObjectsTotal();i>=0;i--) { if(StringFind(ObjectName(i),nameInd)!=-1) ObjectDelete(ObjectName(i)); } }//+ www.expforex.com edit AlertArrow + //+------------------------------------------------------------------+//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intinit() {//---- indicators SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexBuffer(0,HistoCCI); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexBuffer(1,HistoRed); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexBuffer(2,HistoBlue); SetLevelValue(0,HotLevel); SetLevelValue(1,-HotLevel); SetLevelStyle(LevelStyle,LevelSize,LevelColor); IndicatorShortName("CCI Histogram ("+CCIperiod+")");//---- return(0); }//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intstart() { int i,counted_bars=IndicatorCounted(); cs = CCIperiod + num_bars; //checksum used to see if parameters have been changed if ((cs==prevcs) && (commodt == Symbol()) && (frame == (Time[4] - Time[5])) && ((Bars - prevbars) < 2)) startpar = Bars - prevbars; else startpar = -1; //params haven't changed only need to calculate new bar commodt = Symbol(); frame= Time[4] - Time[5]; prevbars = Bars; prevcs = cs; if (startpar == 1 || startpar == 0) bar = startpar; else initDone = true; if (initDone) { HistoCCI[num_bars-1]=0; HistoBlue[num_bars-1]=0; HistoRed[num_bars-1]=0; bar=num_bars-2; initDone=false; } for (i = bar; i >= 0; i--) { HistoCCI[i]=iCCI(NULL,0,CCIperiod,CCIprice,i); now = iCCI(NULL,0,CCIperiod,CCIprice,i); if ((prev >= 0 && now < 0) || (prev < 0 && now >= 0)) { // change of sign detected flag = true; count = 0; } // Colour it! if (now > 0) HistoBlue[i] = now; if (now < 0) HistoRed[i] = now; prev = now; } //+==+//+ www.expforex.com edit AlertArrow +//+==+ nameInd=WindowExpertName( ); if(timeee!=Time[0] && HistoCCI[shift+1]<= -HotLevel && HistoCCI[shift]> -HotLevel ) { Expforex_AlertArrow(Symbol()+" "+PeriodString()+" "+nameInd+" Up",1); timeee=Time[0]; } if(timeee!=Time[0] && HistoCCI[shift+1]>=HotLevel && HistoCCI[shift]<HotLevel ) { Expforex_AlertArrow(Symbol()+" "+PeriodString()+" "+nameInd+" Dn",2); timeee=Time[0]; }//+==+ if(counted_bars>0) counted_bars--; int limit2=Bars-counted_bars; for(int i2=0; i2<limit2; i2++) { nameInd=WindowExpertName( ); if( HistoCCI[shift+1+i2]<= -HotLevel && HistoCCI[shift+i2]> -HotLevel ) { Expforex_AlertArrow(Symbol()+" "+PeriodString()+" "+nameInd+" Up",1,true,i2); } if( HistoCCI[shift+1+i2]>=HotLevel && HistoCCI[shift+i2]<HotLevel ) { Expforex_AlertArrow(Symbol()+" "+PeriodString()+" "+nameInd+" Dn",2,true,i2); }}//+ www.expforex.com edit AlertArrow + return(0); }//+------------------------------------------------------------------+//| Period String |//+------------------------------------------------------------------+stringPeriodString() { switch (_Period) { case PERIOD_M1: return("M1"); case PERIOD_M5: return("M5"); case PERIOD_M15: return("M15"); case PERIOD_M30: return("M30"); case PERIOD_H1: return("H1"); case PERIOD_H4: return("H4"); case PERIOD_D1: return("D1"); case PERIOD_W1: return("W1"); case PERIOD_MN1: return("MN1"); default: return("M"+(string)_Period); } return("M"+(string)_Period); } 由于时间有限加上对源码的追溯做不到最终解释权,所以我们提供的源码EA仅仅只能用来做模拟测试使用,严格禁止商业使用和跑实盘!//+------------------------------------------------------------------+