Problem with OBJ_BITMAP_LABEL not showing the content properly

 

Hi all,

i am new to mql4 programming and i would really appriciate your help. I am trying to place a custom picture on the chart. I looked all over for working solution but i can not find it. I followed the example on MQL4 documentation but i can not figure out what i am doing wrong. Could someone with more experience please take a look and let me know what i am doing wrong ?


The entire EA code:

#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   Alert ("random stuff test ON");

   ObjectCreate(0,"BmpLabel",OBJ_BITMAP_LABEL,0,0,0);   
   ObjectSetString(0,"BmpLabel",OBJPROP_BMPFILE,0,"\\Images\\123.bmp");
   ObjectSetInteger(0,"BmpLabel",OBJPROP_XDISTANCE,200);   //x
   ObjectSetInteger(0,"BmpLabel",OBJPROP_YDISTANCE,200);   //y
   ObjectSetInteger(0,"BmpLabel",OBJPROP_XSIZE,30); // width
   ObjectSetInteger(0,"BmpLabel",OBJPROP_YSIZE,30); // height
   ObjectSetInteger(0,"BmpLabel",OBJPROP_HIDDEN,false);
   
   
   return(0);
  }

int deinit()
  {
   Alert ("random stuff test OFF");

   return(0);
  }


The picture is in the MQL4/Images folder. It is in bmp file format and it has 30x30 pixels dimensions.

The code above just creates empty bitmap lable object but no picture is visible..


Empty label object


Thank you so much for the help.

Files:
 
Your bitmap is using compression, which is not managed by OBJ_BITMAP_LABEL. Save it without compression (I opened it with Paint and save it without change, and after that it displayed).
 
Alain Verleyen:
Your bitmap is using compression, which is not managed by OBJ_BITMAP_LABEL. Save it without compression (I opened it with Paint and save it without change, and after that it displayed).
Thank you so much. Yes it works now. This would have never crossed my mind.
 
Alain Verleyen #:
Your bitmap is using compression, which is not managed by OBJ_BITMAP_LABEL. Save it without compression (I opened it with Paint and save it without change, and after that it displayed).

hi

I am also getting the same error,

I also followed you using Paint to save but it doesn't work.

after looking on mql5 there are some shared bmp images i have replaced it is working properly.

can you guide how to convert to .bmp so it can work with my images?

 
Dao Ngoc Son #:

hi

I am also getting the same error,

I also followed you using Paint to save but it doesn't work.

after looking on mql5 there are some shared bmp images i have replaced it is working properly.

can you guide how to convert to .bmp so it can work with my images?

Use https://www.xnview.com/en/

MQL expects an older bmp format in order to work.
Image Viewer | Photo Viewer | Image Resize | XnView
Image Viewer | Photo Viewer | Image Resize | XnView
  • GOUGELET Pierre
  • www.xnview.com
XnView, one of the best and popular image viewer
 
Alexandre Borela #:
Use https://www.xnview.com/en/

MQL expects an older bmp format in order to work.
Thank you so much
Reason: