- Please help me.:"error no indicator plot defined for indicator"
- How can I add Objects to Rectangle Label
- Dose it posible to creat any function of "mql code" posting in this forum?
OBJ_RECTANGLE uses two coordinates and will move with the bars as you zoom in and out.
OBJ_LABEL uses 1 coordinate in pixels and will remain relative to the window as you zoom in and out. This is what you are looking for, right?
Try using OBJ_LABEL with Wingdings as a work around. This will draw a "rectangle" that remains relative to the window.
ObjectCreate("rec1", OBJ_LABEL, 0, 0, 0); ObjectSetText("rec1", "n", 200, "Wingdings", Gray); ObjectSet("rec1", OBJPROP_XDISTANCE, 10); ObjectSet("rec1", OBJPROP_YDISTANCE, 20); ObjectSet("rec1", OBJPROP_BACK, true); ObjectCreate("rec2", OBJ_LABEL, 0, 0, 0); ObjectSetText("rec2", "n", 200, "Wingdings", Gray); ObjectSet("rec2", OBJPROP_XDISTANCE, 10); ObjectSet("rec2", OBJPROP_YDISTANCE, 120); ObjectSet("rec2", OBJPROP_BACK, true);
OBJ_RECTANGLE uses two coordinates and will move with the bars as you zoom in and out.
OBJ_LABEL uses 1 coordinate in pixels and will remain relative to the window as you zoom in and out. This is what you are looking for, right?
Try using OBJ_LABEL with Wingdings as a work around. This will draw a "rectangle" that remains relative to the window.
You can NOT "draw a rectangle at the top of each bar"! Each rectangle must have a starting and stopping date/time (and price). Therefor the rectangle must cover one bar to another.
Yes you can, using what MisterDog said. Now what I want to do is to keep them fixed on the top of the chart, for each bar.
You asked about drawing a rectangle. You can NOT use a rectangle object.
MisterDog said to use a LABEL. That would put a SQUARE on the window. That means they will not stay with the bar as the chart scrolls. And you can't zoom the chart unless you repaint the objects each time.
If you want a SQUARE, you can use a wingding text object. Those will move with the bars.
Yes, well put WHRoeder. It took me awhile to wrap my head around the idea that some objects are oriented to the screen and positioned with pixels. While other objects are oriented to the chart positioned by bars and pips.
From your additional comments, it sounds like my recommendation is not your solution.
How do I draw rectangles on the top of the chart? I also want them to stay there if I zoom or unzoom.
Try this
ObjectCreate(ChartID(),"obj_rect",OBJ_RECTANGLE_LABEL,0,0,0) ;
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_XDISTANCE,100);
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_YDISTANCE,100);
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_BACK,false);
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_XSIZE,300);
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_YSIZE,100);
Try this
ObjectCreate(ChartID(),"obj_rect",OBJ_RECTANGLE_LABEL,0,0,0) ;
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_XDISTANCE,100);
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_YDISTANCE,100);
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_BACK,false);
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_XSIZE,300);
ObjectSetInteger(ChartID(),"obj_rect",OBJPROP_YSIZE,100);
Thank you. Saved hours
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use