MQL4/MT4 BUG report: clrNONE does not work on every light background, especially if G=255 (en) - page 2

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I thank you for your reply and attempt to provide me with a solution.
The OBJPROP_FILL property is non-functioning in MT4, only MT5. In MT4, the closest equivalent of "FILL" is to control the OBJPROP_BACK property. When "True" it behaves as if FILL=true.
But even when FILL="false", in MT5, it will draw the outline of a rectangle, so it's still not the same as achieving a completely invisible object as 'clrNONE' does. (And in MT5, clrNONE works fine; no bug).
Yes I know that MT4 is not being fixed. If it won't be fixed, then the point of my post is to document the bug for the benefit of other MT4 users who might search for it. If they find my post, I also posted my code for the easy workaround, which I discovered on my own. Perhaps no one will notice or care, but it's at least an informational post. Plenty of us are still using MT4 and haven't made the transition.
I was intrigued by what you said about MT5. And MT5 behaviour is exactly the same as MT4 one.
1. There is the same "bug". I will report it to MQ.
2. " But even when FILL="false", in MT5, it will draw the outline of a rectangle, so it's still not the same as achieving a completely invisible object as 'clrNONE' does. "
What you said is not exact, with FILL=false, in MT5, the rectangle is invisible using clrNone. I didn't say to use it (fill=false) in place of the color but additionally to the color set to none.
Thanks for reporting this bug.
My MT4 code has:
extern color colorChoice = clr___; // The user can enter any choice, including clrNONE
So if I had not discovered the workaround I described, my next workaround would have been:
if(colorChoice == clrNONE) colorChoice = ChartGetInteger(0,CHART_COLOR_BACKGROUND);
(I would have to repeat this test for ~20 extern vars; no problem, just an extra nuisance)
Setting the object color to the background color does indeed make it invisible, so it works. (I knew that, but thanks).
Side topic regarding your #define statement:
I am most familiar with the simplest use of "#define identifier constant". I wasn't really aware that 'constant' could be an expression. (Nor did I know identifier could be identifier(par1,...,par8) )
I learned something from your example, because using 'crlBACKGROUND' is indeed a dynamic value, executing the *expression* ChartGetInteger(...) when called.
I read the docs for "#define" so I understand a little more now.
Is there a simple way to describe the difference -- and advantages/disadvantages between:
#define clrBACKGROUND (color) ChartGetInteger(0,CHART_COLOR_BACKGROUND)
vs. defining a function:
color getBackgroundColor() { return( (color) ChartGetInteger(0,CHART_COLOR_BACKGROUND) ); }
With my "#define", as you can see, I added the typecasting, "(color)"
Having done so, these seem almost equivalent. The only difference I've noticed is that when I'm using MetaEditor, if I use a function, typing 'ge' prompts me with auto-complete choices that include my getBackgroundColor function, whereas as #define, a disadvantage is that I have to spell out the complete "clrBACKGROUND" before it turns red, meaning it has an associated #define. In other words, the MetaEditor doesn't help me auto-complete #define identifiers.
Any other differences worth noting?
I was intrigued by what you said about MT5. And MT5 behaviour is exactly the same as MT4 one.
1. There is the same "bug". I will report it to MQ.
2. " But even when FILL="false", in MT5, it will draw the outline of a rectangle, so it's still not the same as achieving a completely invisible object as 'clrNONE' does. "
What you said is not exact, with FILL=false, in MT5, the rectangle is invisible using clrNone. I didn't say to use it (fill=false) in place of the color but additionally to the color set to none.
Thanks for reporting this bug.
I mistakenly had only tested an object with clrNONE and only FILL=false, and that "works" to not show any outline of the rectangle.
But yes, as you discovered, with FILL=true, MT5 does have the same bug: The rectangle, with FILL-true, and clrNONE, should be invisible, yet it is not.
My workaround still works in MT5, which is when the light background color has G=255, make it 254.
So MintCream = 245,255,250 (fails). Change it to 245,254,250 (works; the clrNONE object, with FILL=true, is now invisible as expected).
The other workaround also works, which is to set the object color to be identical to the background color; the object is invisible as expected.
I was intrigued by what you said about MT5. And MT5 behaviour is exactly the same as MT4 one.
1. There is the same "bug". I will report it to MQ.
2. " But even when FILL="false", in MT5, it will draw the outline of a rectangle, so it's still not the same as achieving a completely invisible object as 'clrNONE' does. "
What you said is not exact, with FILL=false, in MT5, the rectangle is invisible using clrNone. I didn't say to use it (fill=false) in place of the color but additionally to the color set to none.
Thanks for reporting this bug.
So I got a MetaQuotes answer about this issue as it's also in MT5.
All objects are filling with its color XOR background
We can't change behaviour of 15 years old code, because it can break behaviour existing MQL programs
So I got a MetaQuotes answer about this issue as it's also in MT5.
I think they didn't understand this and gave a standard answer about XOR.
Only clrNONE changes the color to black when applied to a background of a specific color, no other color does this.
Nobody uses this and fixing this particular case will not change the behavior of other EAs and indicators.
I think they didn't understand this and gave a standard answer about XOR.
Only clrNONE changes the color to black when applied to a background of a specific color, no other color does this.
Nobody uses this and fixing this particular case will not change the behavior of other EAs and indicators.
If nobody is using it, it will not be a problem if it's not fixed.
If nobody is using it, it will not be a problem if it's not fixed.
If it only happens with these two color combinations, then yes, few people will notice it.