#property copyright "2012, ovo.cz" #property link "ovo.cz/#" /** * Displays upper and lower marks, where current range or renko bar is supposed to close. * Displays info about the chart range. */ #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Red //--- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; extern int ARROW_CODE=215; // try 203, 204, 214, 215, 219, 220, 223, 224, 231,232, 239, 240, 243, 249, 250, 251 extern string _="(33 through 255)"; extern bool SHOW_RANGE_INFO=true; double nothing; double hlRange = EMPTY; double ocRange = EMPTY; double stepRange=EMPTY; int startIdx=1; int endIdx=10; int type=EMPTY; #define RANGEBAR 1 #define RENKO 2 #define MEAN_RENKO 3 //---- #define TF_LABEL "tf label" int CORNER=1; int FONT_SIZE=7; color COLOR=DarkGray; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { nothing=Point/100.0; IndicatorBuffers(2); SetIndexArrow(0,ARROW_CODE); SetIndexArrow(1,ARROW_CODE); SetIndexStyle(0,DRAW_ARROW); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,EMPTY_VALUE); SetIndexStyle(1,DRAW_ARROW); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,EMPTY_VALUE); SetIndexShift(0,1); SetIndexShift(1,1); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ /** returns true if processed with enough bars */ bool resolveRanges() { int i,j; if(Bars(endIdx-startIdx)*0.6) { hlRange=hlRange1; } } // check ocurrence of equal OC (renko) for(j=0; j<3; j++) { int ocRangeMatch= 0; double ocRange1 = MathAbs(Close[startIdx+j]-Open[startIdx+j]); for(i=startIdx; i<=endIdx; i++) { double ocRange2=MathAbs(Close[i]-Open[i]); if(MathAbs(ocRange2-ocRange1)(endIdx-startIdx)*0.6) { ocRange=ocRange1; } } // check ocurrence of equal O-O distance (renko) for(j=0; j<3; j++) { int stepRangeMatch= 0; double stepRange1 = MathAbs(Close[startIdx+j]+Open[startIdx+j]-Close[startIdx+j+1]-Open[startIdx+j+1]); for(i=startIdx; i<=endIdx; i++) { double stepRange2=MathAbs(Close[i]+Open[i]-Close[i+1]-Open[i+1]); if(MathAbs(stepRange2-stepRange1)(endIdx-startIdx)*0.6) { stepRange=stepRange1/2.0; } } if(stepRange>EMPTY) { //renko or meanrenko if((MathAbs(stepRange-ocRange))EMPTY) { // rangebar type=RANGEBAR; } return (true); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { ObjectDelete(TF_LABEL); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { if(Bars