Drawing Rectangle: fill and UI layer level

Questions about MultiCharts and user contributed studies.
PD Quig
Posts: 190
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Drawing Rectangle: fill and UI layer level

Postby PD Quig » 27 Apr 2019

Using RectangleSetStyle(Rect_ID, 6) it is possible to programmatically set the rectangle's border line to invisible. There does not seem to be a comparable function to set the rectangle's fill to invisible (hollow), so there is no way to programmatically hide a rectangle that has been given a fill color. In my use case, the hidden rectangles are often re-displayed so deleting them is not a satisfactory solution.

Also, apparently new with v12.0.18038 all programmatically drawn rectangles are assigned a UI layer such that both the lines and fill of manually drawn ellipses and rectangles always appear beneath the programmatically drawn ones. This is not the case for trend lines, time lines, horizontal lines, arrows, or text. Is this by design or is there a way to adjust the UI layer assigned to rectangles--either programmatically or manually drawn?
2019-04-27_1713.png
(11.2 KiB) Downloaded 480 times
Thanks,

-pdq

User avatar
Anna MultiCharts
Posts: 461
Joined: 14 Jul 2017
Has thanked: 31 times
Been thanked: 113 times

Re: Drawing Rectangle: fill and UI layer level

Postby Anna MultiCharts » 07 May 2019

Hello, PD Quig!

From the code you can access the same drawing settings as the ones that are available in the Format Drawing settings.
The hollow style for the rectangle can be set using RectangleSetPattern(ID,1).
You can leave a feature request on this page and describe in detail how you’d like to regulate the visual order for the drawings: http://www.multicharts.com/pm/

PD Quig
Posts: 190
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Drawing Rectangle: fill and UI layer level

Postby PD Quig » 08 May 2019

Hi Anna, the RectangleSetPattern function is exactly what I needed. I simply missed that in searching for a solution. Sorry for exercising you and thank you!

PD Quig
Posts: 190
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Drawing Rectangle: fill and UI layer level

Postby PD Quig » 08 May 2019

Hi Anna,
I have raised a minor bug for the UI layer issue (MC-2586). This reply is to provide a test workspace and code. Here's the code:

Code: Select all


[RecoverDrawings = false];

variables:
Rect_ID (0);

if LastBarOnChart_s then once begin

Rect_ID = RectangleNew_BN(barnumber -100, high + 5, barnumber + 10, low - 5);
RectangleSetFillColor(Rect_ID, cyan);
RectangleSetPattern(Rect_ID, 0);
RectangleSetColor(Rect_ID, yellow);
RectangleSetStyle(Rect_ID, tool_solid);
RectangleSetSize(Rect_ID, 0.5);
end;
Here's a picture of behaviors:
UI Layer.wsp
(335.99 KiB) Downloaded 116 times
Attachments
data2_rectangle_plots_wrong.png
(59.22 KiB) Downloaded 422 times

User avatar
Anna MultiCharts
Posts: 461
Joined: 14 Jul 2017
Has thanked: 31 times
Been thanked: 113 times

Re: Drawing Rectangle: fill and UI layer level

Postby Anna MultiCharts » 14 May 2019

PD Quig,

Thanks for the detailed description in PM.
Unfortunately this cannot be viewed as a bug. The reason for the objects from Data(N+1) overlaping the objects from Data(N) is found in the order of the calculations and the series display within MultiCharts. First, the data series is drawn on the chart, then manual drawings, and only then the studies are calculated and add their drawings. So this is a multilayer construction. The later a study is calculated, the higher its drawings are placed. Unfortunately it’s not possible to rework this, because it’s not possible to predict if a study will or will not generate any drawings on the next calculation and where it will place them.

PD Quig
Posts: 190
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Drawing Rectangle: fill and UI layer level

Postby PD Quig » 14 May 2019

Hi Anna,

Sorry, but the explanation given cannot be correct in that it does not explain the following three observed phenomena:
1. Objects drawn by studies NEVER occlude manually-drawn one dimensional objects (trend lines, horizontal lines, time lines, arrows, etc.) despite being calculated later and ostensibly placed in a higher UI layer.
2. Objects drawn by studies DO NOT occlude manually-drawn two dimensional objects when the study-drawn objects are based on DATA1
3. Neither of the above phenomena occurred in prior releases

I suggest you investigate changes introduced in version 12.0 release 6 to discover the source of this new occlusion phenomenon.

Thanks,

-pdq

User avatar
Anna MultiCharts
Posts: 461
Joined: 14 Jul 2017
Has thanked: 31 times
Been thanked: 113 times

Re: Drawing Rectangle: fill and UI layer level

Postby Anna MultiCharts » 16 May 2019

PD Quig,

Could you specify the exact version and release where you observed a different behavior?
We tested this in MultiCharts 12 releases 1 and 3, and it is the same as in release 6.

PD Quig
Posts: 190
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Drawing Rectangle: fill and UI layer level

Postby PD Quig » 16 May 2019

Hi Anna,
It is certainly possible that my recall on point #3 is in error. I have pictures such as this one from 3/15/2019
2019-03-15_1614.png
(40.41 KiB) Downloaded 356 times
It shows manually-drawn ellipses which display above study-drawn rectangles. However, it is possible that the study that produced the rectangles shown above was based on data 1 and not a higher data stream. I have no way of ascertaining that at this point.

The facts are that in the current release 1) study-drawn rectangles based on data 1 do not occlude manually-drawn ellipses (and rectangles) and 2) study-drawn rectangles based on data streams > data 1 do occlude manually-drawn ellipses and rectangles.

I am willing to grant that my use cases are corner cases, but nonetheless it isn't expected behavior that the data stream to which the study is applied should cause the discrepancy. It is an annoyance for me as I share my charts daily with others, but perhaps other users aren't similarly affected.

Thanks,

-pdq

User avatar
Anna MultiCharts
Posts: 461
Joined: 14 Jul 2017
Has thanked: 31 times
Been thanked: 113 times

Re: Drawing Rectangle: fill and UI layer level

Postby Anna MultiCharts » 21 May 2019

PD Quig,

We cross-checked the information, and here’s how it works:
1) data series is created on the chart (Data1), it receives the visual order = 1 (the lowest layer); by default the drawings are docked to the lowest informational series of the chart;
2) if any manual drawings were already applied to this chart, then they will appear first, and only then the drawings created by the strategy will be displayed; if any new drawings are added by the strategy or manually, then they will be displayed in the order of creation;
3) Data2 is created, it receives the visual order = 2 (the upper layer); the drawings created by a study on this data series will be attached to it and will overlay the drawings from Data1 in our example.
The more data series are added, the higher layer they receive.

If you change the visual order of the data 1 and 2 (now they will have visual order = 2 and visual order = 1 correspondingly), then the drawings, attached to them will also switch their order: the drawings of Data1 will appear above the drawings of Data2 because now Data1 is found on a higher visual order.

By default manual drawings are always attached to the series that’s sent to back (data series of indicator’s informational series). So if your study is calculated on Data2 (upper layer) then its drawings will overlay the manual drawings attached to Data1 (the lowest layer) unless you change the visual order on the chart: https://www.multicharts.com/trading-sof ... sual_Order

PD Quig
Posts: 190
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Drawing Rectangle: fill and UI layer level

Postby PD Quig » 21 May 2019

The fact that the behavior was based on the data stream's Visual Order was the missing piece for me. Thanks very much for following up, Anna.


Return to “MultiCharts”