Navigation:Home > Content >

RM_CF_.mq4

Time: 2012-12-09 | Download file:RM_CF_.mq4

/*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/*  из коллекции  |                       CF                        */
/*    RoboMAKS    |                                                 */
/*________________|_________________________________________________*/
/*   автор: Maks Shukurov                                           */
/*   источник:                                                      */
/*__________________________________________________________________*/
/* maksshukurov@mail.ru  Baku,Azerbaijan,tel.+994503408530          */
/*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
#property copyright "Из коллекции  RoboMAKS"
#property link ""

#property indicator_chart_window

 input color colorBulls = clrLawnGreen;
 input color colorBears = clrRed;
 input int   TxSz       = 8;         // размер текста
 input color colLine    = clrYellow; // цвет линий
 input int   LineWidth  = 2;         // толщина линий (тени) 
 double DN,UP,P;
 int    s,b;
 color  Color;
 string name="CF";
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
void OnDeinit(const int reason){ObjectsDelete(0,-1,name);}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],
                const double &low[],const double &close[],const long &tick_volume[],const long &volume[],const int &spread[]){
   int limit=Bars-IndicatorCounted();string NameFigur="";int S,B;
   for(int i=0;iOpen[i+1]&&
   Open[i+1]Open[i+1]&&
   ((Close[i]-Open[i])>10*_Point)){ // подтверждение движения
   if(NewBarCur()){NameFigur="Бычье поглощение";b++;
   SetATL(name+b+(i+1)+NameFigur,2,0,0,0,colLine,Time[i+1],High[i+1],Time[i+1],Low[i+1],0);
   SetATL(name+b+(i+2)+NameFigur,2,0,0,0,colLine,Time[i+2],High[i+2],Time[i+2],Low[i+2],0);B=1;}}

   if(Close[i+2]>Open[i+2]&&Close[i+1]Close[i+2]&&Close[i+1]10*_Point)){ // подтверждение движения
   if(NewBarCur()){NameFigur="Медв. поглощение";s++;
   SetATL(name+s+(i+1)+NameFigur,2,0,0,0,colLine,Time[i+1],High[i+1],Time[i+1],Low[i+1],0);
   SetATL(name+s+(i+2)+NameFigur,2,0,0,0,colLine,Time[i+2],High[i+2],Time[i+2],Low[i+2],0);S=1;}}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   if(NameFigur!=""){string N;
   double DELTA=(MathMax(High[i],High[i+1])-MathMin(Low[i],Low[i+1]))/3;
   if(S==1){UP=MathMax(High[i],High[i+1]);P=UP+DELTA;
   N=StringConcatenate(" ",TimeToStr(Time[i],TIME_DATE|TIME_SECONDS));
   SetATL(name+N+"  "+NameFigur,21,NameFigur,TxSz,"Arial",colorBears,Time[i+1],P,0,0,0);return(0);}
   if(B==1){DN=MathMin(Low[i],Low[i+1]);P=DN-DELTA;
   N=StringConcatenate(" ",TimeToStr(Time[i],TIME_DATE|TIME_SECONDS));
   SetATL(name+N+"  "+NameFigur,21,NameFigur,TxSz,"Arial",colorBulls,Time[i+1],P,0,0,0);return(0);}}}
   return(rates_total);}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
bool NewBarCur(){static int tmCur=0;
   if(tmCur==iTime(_Symbol,PERIOD_CURRENT,0))return(false);tmCur=iTime(_Symbol,PERIOD_CURRENT,0);return(true);}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
void SetATL(string nm,int type,string text,int fontsize,string font,color clr,
   datetime t1,double p1,datetime t2,double p2,bool bck){
   ObjectCreate(nm,type,0,t1,p1,t2,p2);
   ObjectSet(nm,OBJPROP_COLOR,clr/*Line*/);
   ObjectSet(nm,OBJPROP_BACK,bck);
   ObjectSet(nm,OBJPROP_RAY,0);
   ObjectSet(nm,OBJPROP_STYLE,1);
   ObjectSet(nm,OBJPROP_WIDTH,LineWidth);
   ObjectSetText(nm,text,fontsize,font,clr);}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
void ObjectsDelete(int wnd=-1,int type=-1,string pref=""){
   string names[];int i,n=ObjectsTotal();ArrayResize(names,n);
   for(i=0;i=0)if(ObjectFind(names[i])!=wnd)continue;
   if(type>=0)if(ObjectType(names[i])!=type)continue;
   if(pref!="")if(StringSubstr(names[i],0,StringLen(pref))!=pref)continue;
   ObjectDelete(names[i]);}}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX THE END XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommend