#property copyright "Copyright © 2008, Yannis" #property link "Yannis.21@gmail.com" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Lime #property indicator_color2 Lime #property indicator_color3 OrangeRed #property indicator_color4 OrangeRed #property indicator_color5 DeepSkyBlue #property indicator_color6 DeepSkyBlue #property indicator_color7 DeepPink #property indicator_color8 DeepPink extern bool Show_Alert = false; extern bool Display_Out = true ; extern bool Display_In = true ; extern bool Candle_Body_Only = true; //---- buffers double val1[]; double val2[]; double val3[]; double val4[]; double val5[]; double val6[]; double val7[]; double val8[]; string pattern; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator line IndicatorBuffers(8); SetIndexStyle(0,DRAW_HISTOGRAM,0,2); SetIndexBuffer(0,val1); SetIndexStyle(1,DRAW_HISTOGRAM,0,2); SetIndexBuffer(1,val2); SetIndexStyle(2,DRAW_HISTOGRAM,0,2); SetIndexBuffer(2,val3); SetIndexStyle(3,DRAW_HISTOGRAM,0,2); SetIndexBuffer(3,val4); SetIndexStyle(4,DRAW_HISTOGRAM,0,2); SetIndexBuffer(4,val5); SetIndexStyle(5,DRAW_HISTOGRAM,0,2); SetIndexBuffer(5,val6); SetIndexStyle(6,DRAW_HISTOGRAM,0,2); SetIndexBuffer(6,val7); SetIndexStyle(7,DRAW_HISTOGRAM,0,2); SetIndexBuffer(7,val8); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- for(int j = 0; j <= 500; j++){ ObjectDelete("DIBS_Trigger_B" + j); ObjectDelete("DIBS_Trigger_S" + j); ObjectDelete("DIBS_DayOpen" + j); ObjectDelete("DIBS_Stoploss_B" + j); ObjectDelete("DIBS_Stoploss_S" + j); } //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); double Range, AvgRange; int counter, setalert; static datetime prevtime = 0; int alert = 0,i; if (prevtime==Time[0]) return(0); prevtime=Time[0]; for (i = Bars; i>0;i--) { setalert = 0; val1[i]=EMPTY_VALUE; val2[i]=EMPTY_VALUE; val3[i]=EMPTY_VALUE; val4[i]=EMPTY_VALUE; val5[i]=EMPTY_VALUE; val6[i]=EMPTY_VALUE; val7[i]=EMPTY_VALUE; val8[i]=EMPTY_VALUE; bool bBarIsBullish = (Open[i]Close[i]); if (Candle_Body_Only) { if (Display_In) { if ( ((Close[i+1]>Open[i+1]) && (Close[i]>Open[i]) && (Close[i]<=Close[i+1]) && (Open [i]>=Open[i+1])) || // Bull/Bull ((Close[i+1]>Open[i+1]) && (Close[i]=Open[i+1])) || // Bull/Bear ((Close[i+1]Open[i]) && (Close[i]<=Open[i+1]) && (Open [i]>=Close[i+1])) || // Bear/Bull ((Close[i+1]=Close[i+1])) // Bear/Bear ) { if (bBarIsBullish) { val1[i]=Close[i]; val2[i]=Open [i]; } else if (bBarIsBearish) { val3[i]=Close[i]; val4[i]=Open [i]; } if (setalert == 0 && Show_Alert == true) { pattern = "Inside Bar Body Only"; setalert = 1; } } } if (Display_Out) { if ( ((Close[i+1]>Open[i+1]) && (Close[i]>Open[i]) && (Close[i]>=Close[i+1]) && (Open [i]<=Open[i+1])) || // Bull/Bull ((Close[i+1]>Open[i+1]) && (Close[i]=Close[i+1]) && (Close[i]<=Open[i+1])) || // Bull/Bear ((Close[i+1]Open[i]) && (Close[i]>=Open[i+1]) && (Open [i]<=Close[i+1])) || // Bear/Bull ((Close[i+1]=Open[i+1]) && (Close[i]<=Close[i+1])) // Bear/Bear ) { if (bBarIsBullish) { val5[i]=Close[i]; val6[i]=Open [i]; } else if (bBarIsBearish) { val7[i]=Close[i]; val8[i]=Open [i]; } if (setalert == 0 && Show_Alert == true) { pattern = "Outside Bar Body Only"; setalert = 1; } } } } else { if (Display_In) { if ((High[i]<=High[i+1]) && (Low[i]>=Low[i+1])) { if (bBarIsBullish) { val1[i]=High[i]; val2[i]=Low [i]; } else if (bBarIsBearish) { val3[i]=High[i]; val4[i]=Low [i]; } if (setalert == 0 && Show_Alert == true) { pattern="Inside Bar Full Candle"; setalert = 1; } } } if (Display_Out) { if ((High[i]>=High[i+1]) && (Low[i]<=Low[i+1])) { if (bBarIsBullish) { val5[i]=High[i]; val6[i]=Low [i]; } else if (bBarIsBearish) { val7[i]=High[i]; val8[i]=Low [i]; } if (setalert == 0 && Show_Alert == true) { pattern = "Outside Bar Full Candle"; setalert = 1; } } } } } return(0); }