(This post will be interesting only to those who code in MQL4 or MQL5 languages.)
Drawing a rectangle in
ObjectCreate("Rectangle", OBJ_RECTANGLE, 0, Time[0], price1, Time[1], price2); |
And in MQL5 it would look almost the same:
ObjectCreate(0, "Rectangle", OBJ_RECTANGLE, 0, Time[0], price1, Time[1], price2); |
But filling the rectangle in MQL5 or drawing it unfilled in MQL4 wasn’t so obvious to me. The rectangles come unfilled by default in MT5 and filled by default in MT4. OBJPROP_BACK is the property that responds for that. For example, to make a rectangle unfilled in MQL4 you can call this function:
ObjectSet("Rectangle", OBJPROP_BACK, false); |
And to fill the rectangle in MQL5 you would change the property to true:
ObjectSetInteger(0, "Rectangle", OBJPROP_BACK, true); |
If you have any questions or comments regarding drawing of the rectangles in MQL4 or MQL5, please, use the commentary form below.