//+------------------------------------------------------------------+ //| ProjectName | //| Copyright 2012, CompanyName | //| http://www.companyname.net | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Red extern int T=1; double P,ZZ[]; bool Z; double Max,Min,Top,Bot; int MaxBar,MinBar,r; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,ZZ); SetIndexStyle(0,DRAW_SECTION); SetIndexEmptyValue(0,0.0); return(0); } int deinit() {return(0);} //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { P=GlobalVariableGet(Symbol()+Period())*Point*10; if(P==0) return(0); Z=1; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; if(counted_bars==0) limit--; for(r=limit;r>=0;r--) { if(Z) { if(High[r]>Max) { Max=High[r]; MaxBar=r; Bot=Max-P; } else { if(Low[r]=T) { Min=Low[r]; MinBar=r; Top=Min+P; ZZ[MaxBar]=Max; Z=0; } } } else { if(Low[r]Top && MinBar-r>=T) { Max=High[r]; MaxBar=r; Bot=Max-P; ZZ[MinBar]=Min; Z=1; } } } } if(Z>0) {ZZ[MaxBar]=Max;} else {ZZ[MinBar]=Min;} return(0);} //+------------------------------------------------------------------+