//+------------------------------------------------------------------+ //| RagheeCandleVagueBars .mq4 | //| Copyright © 2009, Roman Robidet Burel | //| IF you find this Indicator/Code usefull and you want | //| donate something | //| YOU ARE WELCOME PayPal : roman.robidet@hotmail.com | //| | //+------------------------------------------------------------------+ #property copyright "RagheeCandleVagueBars Copyright © 2009, Roman Robidet Burel" #property link "none" #property indicator_chart_window //#property indicator_separate_window #property indicator_buffers 4 //#property indicator_color1 Red #property indicator_width1 2 //#property indicator_color2 Chartreuse #property indicator_width2 2 //#property indicator_color3 Tan #property indicator_width3 2 //#property indicator_color4 DarkOliveGreen #property indicator_width4 2 #import "stdlib.ex4" int RGB(int red_value,int green_value,int blue_value); extern double HighAngle=30; extern double LowAngle=-30; double DnTrend[]; double UpTrend[]; double buff3[]; double buff4[]; double XScale; int ExtCountedBars=0; datetime inicio; bool First=true; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //SetIndexStyle(0,DRAW_LINE,EMPTY,2,Red); int rouge =RGB(255,0,0); int chartr =RGB(187,255,0); int orange =RGB(227,147,27); //int ver =RGB(63,158,76); int ver =RGB(0,255,0); SetIndexStyle(0, DRAW_HISTOGRAM, 0, 2, rouge); SetIndexStyle(1, DRAW_HISTOGRAM, 0, 2, ver); SetIndexStyle(2, DRAW_HISTOGRAM, 0, 2, orange); SetIndexStyle(3, DRAW_HISTOGRAM, 0, 2, chartr); SetIndexBuffer(0, DnTrend); SetIndexBuffer(1, UpTrend); SetIndexBuffer(2, buff3); SetIndexBuffer(3, buff4); SetIndexLabel(0,"Dn Ragheebars"); SetIndexLabel(1,"UP Ragheebars"); SetIndexLabel(2,"neutre_Dn Ragheebars"); SetIndexLabel(3,"neutre_Up Ragheebars"); inicio=TimeLocal(); First=true; //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { XScale=MarketInfo(Symbol(),MODE_TICKVALUE)*MarketInfo(Symbol(),MODE_TICKSIZE)*10; if (XScale==0) return(0); //Comment("inicio= "+inicio+" inicio+ 20="+(inicio+20)+" timelocal="+TimeLocal()); int pos; RefreshRates(); double Angle; if(Bars <= 10) return(0); ExtCountedBars = IndicatorCounted(); //---- check for possible errors if(ExtCountedBars < 0) return(-1); //---- last counted bar will be recounted if(ExtCountedBars > 0) ExtCountedBars--; if (First==true) { pos = Bars;// + 25; First=false; } else if (First==false) { pos = Bars - ExtCountedBars;// + 25; } //int pos=Bars; // if (inicio==Bars+2) pos= Bars; // if (TimeLocal()>=(inicio+300) && TimeLocal()<=(inicio+600)) pos=Bars; //if ( (TimeLocal()> inicio + 40) && (TimeLocal()= 0) { double RV1=iMA(Symbol(),0,34,0,MODE_EMA,PRICE_CLOSE,pos+1); double RV2=iMA(Symbol(),0,34,0,MODE_EMA,PRICE_CLOSE,pos); //XScale=MarketInfo(Symbol(),MODE_TICKVALUE)*MarketInfo(Symbol(),MODE_TICKSIZE)*10; //if (XScale==0) XScale=1; // while(XScale==0){ // XScale=MarketInfo(Symbol(),MODE_TICKVALUE)*MarketInfo(Symbol(),MODE_TICKSIZE)*10; // } Angle=MathArctan( (RV2-RV1)/XScale )/3.1415965*180; if ( MathAbs(Angle)<=HighAngle ) { buff3[pos] =Open[pos]; buff4[pos] =Close[pos]; } else if (AngleClose[pos]) { DnTrend[pos] = Open[pos]; UpTrend[pos] =Close[pos]; } else { DnTrend[pos] =Close[pos]; UpTrend[pos] =Open[pos]; } } else if (Angle>HighAngle ){ if (Open[pos]