//+------------------------------------------------------------------+ //| _TRO_RANGE_EZ_P | //| | //| Copyright © 2008, Avery T. Horton, Jr. aka TheRumpledOne | //| | //| PO BOX 43575, TUCSON, AZ 85733 | //| | //| GIFTS AND DONATIONS ACCEPTED | //| | //| therumpldone@gmail.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, Avery T. Horton, Jr. aka TRO" #property link "http://www.therumpldone.com/" //---- indicator settings #property indicator_chart_window #property indicator_buffers 0 #property indicator_minimum 0 #property indicator_maximum 1 //---- indicator parameters //extern int Threshold = 20; extern int win = 0; extern int price.x.offset= 250;//250 extern int price.y.offset= 0;//-160 extern int Chart_Period = PERIOD_H1; extern int MaxBars = 960; extern color CurrentBarColor = LightGray ; extern color ThresholdColor = LimeGreen; //---- indicator buffers double MaxRange = 0 ; double MinRange = 0 ; double AvgRange = 0 ; double xRange = 0 ; double tRange = 0 ; //---- buffers double zRANGE = 0; bool show.info = true; bool ShowChart = true; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { return(0); } int deinit() { ObjectDelete("RNG430"); ObjectDelete("RNG429"); ObjectDelete("RNG429B"); ObjectDelete("RNG431"); ObjectDelete("RNG432"); ObjectDelete("RNG434"); } //+------------------------------------------------------------------+ //| Range | //+------------------------------------------------------------------+ int start() { MaxRange = 0 ; MinRange = 999999 ; double HighVal,LowVal; int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; if(counted_bars<0) return(-1); limit = MaxBars ; //---- RANGE counted in the 1-st buffer double buf_tmp = 0 ; int z = 0 ; for(int i=0; i<limit; i++) { HighVal = iHigh(NULL,Chart_Period,i); LowVal = iLow(NULL,Chart_Period,i); xRange = HighVal - LowVal ; // range tRange = xRange / Point; // range buf_tmp = buf_tmp + xRange ; if( tRange > MaxRange ) {MaxRange = tRange ; } if( tRange < MinRange ) {MinRange = tRange ; } } AvgRange = buf_tmp / MaxBars /Point ; // average range zRANGE = (iHigh(NULL,Chart_Period,0)-iLow(NULL,Chart_Period,0))/Point ; //} //+------------------------------------------------------------------+ //void DoShowInfo() //{ string tPeriod = " "+TimeFrameToString( Chart_Period ) ; if ( zRANGE > AvgRange ) { color RangeColor = ThresholdColor ; } else { RangeColor = CurrentBarColor ; } ObjectCreate("RNG430", OBJ_LABEL, win, 0, 0);//HiLow LABEL ObjectSetText("RNG430","RANGE", 30, "Arial Bold", Gray); ObjectSet("RNG430", OBJPROP_CORNER, 0); ObjectSet("RNG430", OBJPROP_XDISTANCE, 760+price.x.offset); ObjectSet("RNG430", OBJPROP_YDISTANCE, 160+price.y.offset); ObjectCreate("RNG429", OBJ_LABEL, win, 0, 0);//HiLow LABEL ObjectSetText("RNG429",DoubleToStr(MaxRange,0), 15, "Arial Bold", Lime); ObjectSet("RNG429", OBJPROP_CORNER, 0); ObjectSet("RNG429", OBJPROP_XDISTANCE, 770+price.x.offset); ObjectSet("RNG429", OBJPROP_YDISTANCE, 197+price.y.offset); ObjectCreate("RNG429b", OBJ_LABEL, win, 0, 0);//HiLow LABEL ObjectSetText("RNG429b",DoubleToStr( MinRange ,0), 15, "Arial Bold", Crimson); ObjectSet("RNG429b", OBJPROP_CORNER, 0); ObjectSet("RNG429b", OBJPROP_XDISTANCE, 770+price.x.offset); ObjectSet("RNG429b", OBJPROP_YDISTANCE, 260+price.y.offset); ObjectCreate("RNG431", OBJ_LABEL, win, 0, 0);//HiLow LABEL ObjectSetText("RNG431",DoubleToStr(zRANGE,0)+tPeriod, 40, "Arial Bold", RangeColor ); ObjectSet("RNG431", OBJPROP_CORNER, 0); ObjectSet("RNG431", OBJPROP_XDISTANCE, 800+price.x.offset); // 765 ObjectSet("RNG431", OBJPROP_YDISTANCE, 210+price.y.offset); ObjectCreate("RNG432", OBJ_LABEL, win, 0, 0); // ObjectSetText("RNG432",DoubleToStr( AvgRange ,2), 15, "Arial Bold", Orange); // RANGEBuffer2[0] buf0[0] ObjectSet("RNG432", OBJPROP_CORNER, 0); ObjectSet("RNG432", OBJPROP_XDISTANCE, 860+price.x.offset); ObjectSet("RNG432", OBJPROP_YDISTANCE, 197+price.y.offset); ObjectCreate("RNG434", OBJ_LABEL, win, 0, 0); ObjectSetText("RNG434",DoubleToStr( MaxBars ,0), 15, "Arial Bold", Silver); ObjectSet("RNG434", OBJPROP_CORNER, 0); ObjectSet("RNG434", OBJPROP_XDISTANCE, 860+price.x.offset); ObjectSet("RNG434", OBJPROP_YDISTANCE, 260+price.y.offset); WindowRedraw(); //} return(0); } //+------------------------------------------------------------------+ string TimeFrameToString(int tf) { string tfs; switch(tf) { case PERIOD_M1: tfs="M1" ; break; case PERIOD_M5: tfs="M5" ; break; case PERIOD_M15: tfs="M15" ; break; case PERIOD_M30: tfs="M30" ; break; case PERIOD_H1: tfs="H1" ; break; case PERIOD_H4: tfs="H4" ; break; case PERIOD_D1: tfs="D1" ; break; case PERIOD_W1: tfs="W1" ; break; case PERIOD_MN1: tfs="MN1"; } return(tfs); } //+------------------------------------------------------------------+
Sample
image not available
Analysis
Market Information Used:
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: