Ho to draw a rectangle with that is filled with a specific color?
JSParticipant
Senior
Try this one:
DefParam DrawOnLastBarOnly=True
//DrawRectangle(x1,y1,x2,y2) FillColor(R,G,B)
DrawRectangle(BarIndex-75,42000,BarIndex,42150) FillColor(0,255,0)
Return
It is also possible to use coloured and bordercolor to fill the rectangle/triangle.
Note that if you use coloured alone, it will only color the rectangle (not filling the inside). If you add bordercolor instruction, then you will color the rectangle and fill it (with same or different color as you wish).
If you want just to fill it, then fillcolor is the best. You can also use bordercolor and fillcolor in order to have 2 diferent color for the rectangle and the filling…
DefParam DrawOnLastBarOnly=True
//DrawRectangle(x1,y1,x2,y2) FillColor(R,G,B)
DrawRectangle(BarIndex-75,close,BarIndex,close+30) FillColor(0,255,0)
DrawRectangle(BarIndex-75,close,BarIndex,close-30) coloured(0,255,0) bordercolor("red",255)style(line,3)
Return
Hi. Finally, you can adjust the transparency (0–255): fillcolor(r, g, b, transparency)
This also applies to all color instructions: drawsegment(x1, y1, x2, y2) coloured(r, g, b, transparency)
Thks for the excellent info.
Plse explain difference between coloured(0,255,0) and bordercolor(“red”,255). I notice that at https://www.prorealcode.com/prorealtime-documentation/ , bordercolor is not listed but it is found in proBuilder manual.
For the transparency, fillcolor(r, g, b, transparency), the smaller value of transparency means less transparent?
For the 3 of them (coloured, bordercolor and fillcolor) you can use either the “color name” or R,G,B numbers and the transparency :
– (“colorname”,tansparency)
– (R,G,B,tansparency)
transparency can go from 0 (completly transparent) to 255 (no transparency)
* Bordercolor instruction can only color rectangle/triangle itself (as it is a segment/line that draws the rectangle/triangle, you can add “style” instruction for the width or/and the style of the line, dotted or not…)
* fillcolor instruction can only color/fill the inside of the rectangle/triangle
* coloured instruction can do both (the color of the rectangle/triangle OR the inside filling) : if it is used alone, it will color the rectangle/triangle itself, if it is used with bordercolor (after of before it), it will color/fill the inside of the rectangle/triangle.
Thks for the explanation.