Filled OBJ_RECTANGLE not showing.

 

Good evening.

I am writing an indicator which plots some levels, where each level is made of rectangles plotted for each bar.

I have noticed that, in some cases, filled rectangles are not plotted on the chart, while if OBJPROP_FILL is set to false, it is plotted.

(See attached files for screenshots of the problem)

Can somebody help?

 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

Without any code, we can't offer you any sensible answer.

However, why are you using multiple rectangle graphical objects instead of using buffers?

Using graphical objects is inefficient and can easily slow down the processing of the chart.

EDIT:

And if you really want to use graphical objects, just place a single horizontal trend line (with higher thickness), with a start and finish, instead of drawing multiple rectangles.

And if you really want to use rectangles, then just use one rectangle that extends all the way from the left to the right, start and finish.

 
Fernando Carreiro #:

Without any code, we can't offer you any sensible answer.

However, why are you using multiple rectangle graphical objects instead of using buffers?

Using graphical objects is inefficient and can easily slow down the processing of the chart.

Hi Fernando, Thanks for the response and sorry for my mistake.
This is the code I'm using to draw the rects, the only difference from the first image and the second is that I switched OBJPROP_FILL from false to true (hardcoded).
That's why I'm asking if this could be a MT bug or just me.

    for(int i = 0; i < ArraySize(Levels.levels); i++) {
        LiquidityLevel lvl = Levels.levels[i];

        //Volume lower than min visible
        if(lvl.Volume() < InpMinLevelVolume) {
            continue;
        }

        //Plot level
        ObjectCreate(0, lvl.objName, OBJ_RECTANGLE, 0, lvl.startTime, lvl.minPrice, lvl.endTime, lvl.maxPrice);
        ObjectSetInteger(0, lvl.objName, OBJPROP_COLOR, clrRed);
        ObjectSetInteger(0, lvl.objName, OBJPROP_FILL, false);
        ObjectSetInteger(0, lvl.objName, OBJPROP_BACK, true);
    }

    ChartRedraw();


 
Paolo Besana #: This is the code I'm using to draw the rects, the only difference from the first image and the second is that I switched OBJPROP_FILL from false to true (hardcoded). That's why I'm asking if this could be a MT bug or just me.

But I don't see anything wrong in your screenshots—one is filled and the other is not.

In both images, the rectangles are drawn. So what seems to be the issue?

 
Fernando Carreiro #:

But I don't see anything wrong in your screenshots—one is filled and the other is not.

In both images, the rectangles are drawn. So what seems to be the issue?

If you look at lower levels for example you can see how, if filled, the levels are not protracted (so new rects are not shown), but if not filled they will be protracted till when the market crosses them.
 
Paolo Besana #: If you look at lower levels for example you can see how, if filled, the levels are not protracted (so new rects are not shown), but if not filled they will be protracted till when the market crosses them.

Ok, I see!

However, the information and code you have provided is insufficient for us to know the cause.

What I can suggest, is that you make the "Fill Property" be an Input which you can apply to the rest of the code, to make it easier to identify where the bug may be. And by bug, I mean a bug in your code, and not on the platform.

Also, please confirm if this is indeed MQL5 (and not MQL4).

 

Yes, this is MQL5.

Here is a demo of the indicator with rect fill as input.

Unfortunately the problem persists..



 
Paolo Besana #: Unfortunately the problem persists..

Without your full code, we can only "guess". We can't know what you are doing, much less identify the bug.

If you are not willing to show your code, then you will have to debug your code yourself and find the cause.

And if you still suspect it to be a platform bug, then you will have to provide working sample code that can be verified by others.

Reason: