//+------------------------------------------------------------------+ //| InOutIn.mq4 | //| | //+------------------------------------------------------------------+ //Modified from DoubleInsideBar.mq4 by sr100m@yahoo.co.uk //I've left the original comments in also /* comment from orignal indicator Price Bar number 1 is an Inside Bar Price Bar number 2 is an Inside Bar in relation to Price Bars 3 & 4 The high of Bar 2 is below the high of Bar 3 The low of Bar 2 is above the low of Bar 4 */ #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 LightBlue double CrossUp[]; int init() { SetIndexStyle(0, DRAW_ARROW, EMPTY); SetIndexArrow(0, 233); SetIndexBuffer(0, CrossUp); return(0); } int deinit() { return(0); } int start() { int limit, i, counter; double Range, AvgRange; 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(i = 0; i < limit; i++) { counter=i; Range=0; AvgRange=0; for (counter=i ;counter<=i+9;counter++) { AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]); } Range=AvgRange/10; //bar 1 is an inside bar if (High[i+1] < High[i+2] && Low[i+1] > Low[i+2]) { //comment from modified indy - bar 2 is an outside bar //comments below this is original indy comment //bar 2 is inside relative to bars 3 & 4 //high of bar 2 is below that of bar 3 && low of bar 2 is above low of bar 4 if (High[i+2] > High[i+3] && Low[i+2] < Low[i+3]) { CrossUp[i+1] = Low[i+1] - Range*0.5; } //comment from modified indy - just a repeat of bar 2 is outside Bars //comments below this is original indy comment // OR high of bar 2 is below that of bar 4 && low of bar 2 is above low of bar 3 if (High[i+2] > High[i+3] && Low[i+2] < Low[i+3]) { CrossUp[i+1] = Low[i+1] - Range*0.5; } } } return(0); }