Hi Budhax,
To answer your question "So, what is the right hexadecimal format for color variable: 0x00BBGGRR or 0xBBGGRR ?" - Both of these hex formats are correct because the leading zeros are irrelevant.
Note that the position of the hex color digits "0xBBGGRR" will always be the reverse order of the RGB color that you see in the object properties window (RRR,GGG,BBB).
Here's your example, rewritten to only use significant hex digits. Put more zeros directly after the "0x" in the hex number, if you like - the result will be the same.
Cheers,
Raider
To answer your question "So, what is the right hexadecimal format for color variable: 0x00BBGGRR or 0xBBGGRR ?" - Both of these hex formats are correct because the leading zeros are irrelevant.
Note that the position of the hex color digits "0xBBGGRR" will always be the reverse order of the RGB color that you see in the object properties window (RRR,GGG,BBB).
Here's your example, rewritten to only use significant hex digits. Put more zeros directly after the "0x" in the hex number, if you like - the result will be the same.
int start(){ ObjectsDeleteAll(); string NameOB="id1"; ObjectCreate(NameOB,OBJ_TEXT,0,Time[20],Close[1]); ObjectSet(NameOB,OBJPROP_COLOR,0xFF); // Integer 255, RGB(255,0,0) ObjectSetText(NameOB,"Red",20); NameOB="id2"; ObjectCreate(NameOB,OBJ_TEXT,0,Time[40],Close[1]); ObjectSet(NameOB,OBJPROP_COLOR,0xFFFF); // Integer 65535, RGB(255,255,0) ObjectSetText(NameOB,"Yellow",20); NameOB="id3"; ObjectCreate(NameOB,OBJ_TEXT,0,Time[60],Close[1]); ObjectSet(NameOB,OBJPROP_COLOR,0xFF00); // Integer 65280, RGB(0,255,0) ObjectSetText(NameOB,"Lime",20); NameOB="id4"; ObjectCreate(NameOB,OBJ_TEXT,0,Time[80],Close[1]); ObjectSet(NameOB,OBJPROP_COLOR,0xFFFF00); // Integer 16776960, RGB(0,255,255) ObjectSetText(NameOB,"Aqua",20); NameOB="id5"; ObjectCreate(NameOB,OBJ_TEXT,0,Time[100],Close[1]); ObjectSet(NameOB,OBJPROP_COLOR,0xFF0000); // Integer 16711680, RGB(0,0,255) ObjectSetText(NameOB,"Blue",20); NameOB="id6"; ObjectCreate(NameOB,OBJ_TEXT,0,Time[120],Close[1]); ObjectSet(NameOB,OBJPROP_COLOR,0xFF00FF); // Integer 16711935, RGB(255,0,255) ObjectSetText(NameOB,"Magenta",20); NameOB="id7"; ObjectCreate(NameOB,OBJ_TEXT,0,Time[140],Close[1]); ObjectSet(NameOB,OBJPROP_COLOR,0xFFFFFF); // Integer 16777215, RGB(255,255,255) ObjectSetText(NameOB,"White",20); NameOB="id8"; ObjectCreate(NameOB,OBJ_TEXT,0,Time[160],Close[1]); ObjectSet(NameOB,OBJPROP_COLOR,0xFFFFFFFF); // (Color = "None") ObjectSetText(NameOB,"None",20); return(0); }Hope that helps.
Cheers,
Raider
Thanks Raider,
Now it's clear in my mind. I was confused because my tool "Visual Color Picker"
( http://www.linxexplorer.com/colorpicker.html ) or HTML convention ( http://www.w3schools.com/html/html_colors.asp ) use the format RRGGBB (red, green, blue). but MQ4 use BBGGRR (blue, green, red). Be carefull web developers.

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
1.
Dear MT team,
I think there is a color bug in MT 4.0. Try this script. A wide rage of colors 0xXXYYZZ are interpreted as 0xZZYYXX. Is this a bug?
If yes, please could you fix it? Thanks in advance.
I use MT 4.0 211, ME 4.0 209.
2.
This page
https://docs.mql4.com/basis/types/color
explaines to use hexadecimal format "0x00BBGGRR" for color variables
and shows an example like: 0x008000 // green
And this page:
https://docs.mql4.com/constants/special
shows an example like: CLR_NONE 0xFFFFFFFF (different of formats 0x00BBGGRR and 0xBBGGRR)
????
So, what is the right hexadecimal format for color variable: 0x00BBGGRR or 0xBBGGRR ?
Thanks and regards.