Download MetaTrader 5
To add comments, please log in or register
Interested in Signals activity? Come and track!
Guillermo
75
Guillermo 2016.04.21 13:56 

Hi,

I'm trying to display a .bmp file in a chart (not relative to a time/price, but to its coordinates from the top-left corner).

I have tried this script  https://docs.mql4.com/constants/objectconstants/enum_object/obj_bitmap_label but haven't managed to get it working. I got my file, called "30x28.bmp" in the Images folder from the data folder.

This is my current try:

    ObjectCreate(0, "logo", OBJ_BITMAP_LABEL, 0, 0, 0);
    ObjectSetString(0, "logo", OBJPROP_BMPFILE, "\\Images\\30x28.bmp");

 
Any help would be appreciated. Thank you.

Alain Verleyen
Moderator
28701
Alain Verleyen 2016.04.21 14:38  
Flood19:

Hi,

I'm trying to display a .bmp file in a chart (not relative to a time/price, but to its coordinates from the top-left corner).

I have tried this script  https://docs.mql4.com/constants/objectconstants/enum_object/obj_bitmap_label but haven't managed to get it working. I got my file, called "30x28.bmp" in the Images folder from the data folder.

This is my current try:

 
Any help would be appreciated. Thank you.

You need to set the modifier parameter :

    ObjectSetString(0, "logo", OBJPROP_BMPFILE, 0, "\\Images\\30x28.bmp");

 modifier: 0-state ON, 1-state OFF

Guillermo
75
Guillermo 2016.04.21 15:11  
Thanks you, got it working. I had that missing, but I think my .bmp file was in another format (I think it was the color depth, 24 vs 32) as well, got it working by overriding it via Paint... Thank you again!
Doerk Hilger
1074
Doerk Hilger 2016.04.23 08:09  
If you want, check the code base for my uploads. There is a modified version of CCanvas which also supports bitmaps which are loaded as resources. By this, you don´t need to distribute the bitmap separately, you rather may include it into the EX4/EX5 file. 
Alain Verleyen
Moderator
28701
Alain Verleyen 2016.04.23 13:01  
Doerk:
If you want, check the code base for my uploads. There is a modified version of CCanvas which also supports bitmaps which are loaded as resources. By this, you don´t need to distribute the bitmap separately, you rather may include it into the EX4/EX5 file. 
Here is your "product" https://www.mql5.com/en/code/13936 
Doerk Hilger
1074
Doerk Hilger 2016.04.23 20:14  
Maybe, yes. I am not sure if I didn't upload a second one for CCanvas separately.
Doerk Hilger
1074
Doerk Hilger 2016.04.24 22:17  
And uhm thank you, Alain :)
Alain Verleyen
Moderator
28701
Alain Verleyen 2016.04.25 06:45  
Doerk:
Maybe, yes. I am not sure if I didn't upload a second one for CCanvas separately.
Nope.
KingOfSand
50
KingOfSand 2016.09.13 08:14  
Is it possible to use an image from the web instead of one that is stored locally using the above method? I tried to simply change the position to "http://www.******.com/test/image.bmp" but no success of course..
JC
1395
JC 2016.09.13 08:19  
KingOfSand:
Is it possible to use an image from the web instead of one that is stored locally using the above method? I tried to simply change the position to "http://www.******.com/test/image.bmp" but no success of course..
Yes, but you have to download the image, using something like WebRequest(); save it as a file; and then display the image as above. You can't set OBJPROP_BMPFILE to a URL.
/
To add comments, please log in or register