Download MetaTrader 5

Draw in the background.

To add comments, please log in or register
sadplanet
18
sadplanet  

Does anyone know how to change this indy so that it draws in the background: 


#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
#property indicator_label1  "Daily open line"
#property indicator_type1   DRAW_ARROW
#property indicator_style1  STYLE_DOT
#property indicator_color1  clrGray


input int TimeShift = 0; // Time shift (in hours)
double openLine[];
//
//
//
//
//
int OnInit() { SetIndexBuffer(0,openLine,INDICATOR_DATA); return(0); }
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
               
   
{
   if (Bars(_Symbol,_Period)<rates_total) return(-1);
      for (int i=(int)MathMax(prev_calculated-1,0); i<rates_total && !IsStopped(); i++)
      {
         string stime = TimeToString(time[i]+TimeShift*3600,TIME_DATE);
            openLine[i] = (i>0) ? (TimeToString(time[i-1]+TimeShift*3600,TIME_DATE)==stime) ? openLine[i-1] : open[i] : open[i];
            
      }
   return(rates_total);
}

Thanks.

whroeder1
17116
whroeder1  

sadplanet: Does anyone know how to change this indy so that it draws in the background:

Question makes no sense. Indicators update when a new tick comes in. No tick, nothing has changed, nothing to do.
sadplanet
18
sadplanet  

What I mean is for it to draw underneath other indicators and drawings:

Files:
Pic.PNG 15 kb
sadplanet
18
sadplanet  

To elaborate, how would I add something like this:


 ObjectSetInteger(chart_id,name,OBJPROP_BACK,true); // background object
To add comments, please log in or register