Need to create Bitmap Object, but help documentation BitmapCreate function no works!

Back to topics list To post a new topic, please log in or register
wemersonrv 2016.07.27 21:47


I am trying to create an Bitmap Object using  BitmapCreate function of mql4 hqlp documentation... but nothing happens... can you help me?


//| Create a bitmap in the chart window                              | 
bool BitmapCreate(const long            chart_ID=0,        // chart's ID 
                  const string          name="Bitmap",     // bitmap name 
                  const int             sub_window=0,      // subwindow index 
                  datetime              time=0,            // anchor point time 
                  double                price=0,           // anchor point price 
                  const string          file="",           // bitmap file name 
                  const int             width=10,          // visibility scope X coordinate 
                  const int             height=10,         // visibility scope Y coordinate 
                  const int             x_offset=0,        // visibility scope shift by X axis 
                  const int             y_offset=0,        // visibility scope shift by Y axis 
                  const color           clr=clrRed,        // border color when highlighted 
                  const ENUM_LINE_STYLE style=STYLE_SOLID, // line style when highlighted 
                  const int             point_width=1,     // move point size 
                  const bool            back=false,        // in the background 
                  const bool            selection=false,   // highlight to move 
                  const bool            hidden=true,       // hidden in the object list 
                  const long            z_order=0)         // priority for mouse click 
//--- set anchor point coordinates if they are not set 
//--- reset the error value 
//--- create a bitmap 
            ": failed to create a bitmap in the chart window! Error code = ",GetLastError()); 
//--- set the path to the image file 
            ": failed to load the image! Error code = ",GetLastError()); 
//--- set visibility scope for the image; if width or height values 
//--- exceed the width and height (respectively) of a source image, 
//--- it is not drawn; in the opposite case, 
//--- only the part corresponding to these values is drawn 
//--- set the part of an image that is to be displayed in the visibility scope 
//--- the default part is the upper left area of an image; the values allow 
//--- performing a shift from this area displaying another part of the image 
//--- set the border color when object highlighting mode is enabled 
//--- set the border line style when object highlighting mode is enabled 
//--- set a size of the anchor point for moving an object 
//--- display in the foreground (false) or background (true) 
//--- enable (true) or disable (false) the mode of moving the label by mouse 
//--- hide (true) or display (false) graphical object name in the object list 
//--- set the priority for receiving the event of a mouse click in the chart 
//--- successful execution 


Here my call to create the object 

string filename="\\Images\my_image.bmp";

if( !BitmapCreate(0,"logo",0,0,0,filename,
                     10, /* width */
                     10, /* height */
                     0, /*x_offset*/
                     0, /*y_offset*/
                     clrRed, /*clr*/
                     STYLE_SOLID, /*style*/
                     1, /*point_width*/
                     false, /*back*/
                     false, /*selection*/
                     true, /*hidden*/
                     0, /*z_order*/)

   Alert(filename, " not created!");


Ovo 2016.07.27 22:07 #

You seem to miss the modifier in ObjectSetString(chart_ID,name,OBJPROP_BMPFILE,file) 

 The other possible reason might be the file - it must be a 24-bit bmp (not 32-bit)


wemersonrv 2016.07.28 00:20 #

You seem to miss the modifier in ObjectSetString(chart_ID,name,OBJPROP_BMPFILE,file) 

 The other possible reason might be the file - it must be a 24-bit bmp (not 32-bit)


Hi, i've make some testes now and do not miss. Just change filename to a wrong filename and then get the message BitmapCreate: failed to load the image! Error code = 5020, but when i set filename currect not gives me any error, then the function was all executed. but nothing is shown on window.


I try to test with 24 bit colors and 256 colors... and nothing!




wemersonrv 2016.07.28 04:05 #

I found it!


I was using  OBJ_BITMAP then need to put time and price coordinates... as i was using 0 , the element was created but outside the visible candles...


Now i change it to OBJ_BITMAP_LABEL and works fine! Just get it from code suggested on help documentation. thanks!

Back to topics list  

To add comments, please log in or register