How to display an image in the chart?

 

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.

 
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

 
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!
 
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. 
 
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 
 
Maybe, yes. I am not sure if I didn't upload a second one for CCanvas separately.
 
And uhm thank you, Alain :)
 
Doerk:
Maybe, yes. I am not sure if I didn't upload a second one for CCanvas separately.
Nope.
 
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..
 
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.
 
Very nice article .. Need to add the code to make the image at the background .. so can anyone help please
Reason: