Blue border surrounding two candles

2019-09-14 13:39发布

I hope to draw a graph like this (with blue border surrounding two candles)

enter image description here

with the following code,

      string label_name="Rectangle";
  double maxHigh=MathMax(iHigh(_Symbol,0,1),iHigh(_Symbol,0,2));
          double minLow=MathMin(iLow(_Symbol,0,1),iLow(_Symbol,0,2));
            ObjectCreate(0,label_name, OBJ_RECTANGLE_LABEL, 0, Time[2],maxHigh, Time[1],minLow);
            ObjectSetInteger(0,label_name,OBJPROP_XSIZE,100);
            ObjectSetInteger(0,label_name,OBJPROP_COLOR,clrBlue);
            ObjectSetInteger(0,label_name,OBJPROP_BACK,false);
            ObjectSetInteger(0,label_name,OBJPROP_WIDTH,3);

i get the following (not surrounding the candle), how should I make it work?

enter image description here

标签: mql4
1条回答
Fickle 薄情
2楼-- · 2019-09-14 13:59

do you need OBJ_RECTANGLE_LABEL? it can be useful if you want to have some kind of background, and when you move your chart right or left it remains in the selected corner. It's position depends on x and y coordinates of the chart, width and heigth. If you use OBJ_RECTANGLE - it would be drawn based on price and time coordinates, no need in editing OBJPROP_XSIZE in such case, just ObjectSetDouble(0,name,OBJPROP_PRICE1,fmax(high[1],high[2]); ObjectSetDouble(0,name,OBJPROP_PRICE2,fmin(low[1],low[2]);

查看更多
登录 后发表回答