//+------------------------------------------------------------------+ //| Daily OHLCdiv4.mq4 | //+------------------------------------------------------------------+ // modified to draw OHLC/4 lines only // not to clutter up chart #property indicator_chart_window //#property indicator_separate_window #property indicator_buffers 1 // old value 7 #property indicator_color1 MediumBlue //---- buffers double PBuffer[]; string AvgOHLC="AvgOHLC"; int fontsize=6; double P; double LastHigh,LastLow,x; //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here ObjectDelete("AvgOHLC"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line SetIndexStyle(0,DRAW_LINE,0,2,Black); SetIndexBuffer(0,PBuffer); //---- name for DataWindow and indicator subwindow label short_name="D OHLC/4"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0,1); //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit, i; //---- indicator calculation if (counted_bars==0) { x=Period(); if (x>240) return(-1); ObjectCreate("AvgOHLC", OBJ_TEXT, 0, 0,0); ObjectSetText("AvgOHLC", " OHLC/4",fontsize,"Arial",Black); SetIndexLabel(0, "AvgOHLC"); } if(counted_bars<0) return(-1); //---- last counted bar will be recounted // if(counted_bars>0) counted_bars--; limit=(Bars-counted_bars)-1; if(Period()>PERIOD_H1) return(-1); for (i=limit; i>=0;i--) { if (TimeDayOfWeek(Time[i+1])!=0){ // Monday Fix if (High[i+1]>LastHigh) LastHigh=High[i+1]; if (Low[i+1]