Problem with BMP object in Mql4

 
Hi all, I'm trying to insert a BMP object but even if the object is created correctly and I have no errors in compiling, I don't see it in the chart ( but i see on object list ). I can't find the error, thanks to whoever can help me. The file is 24bit in bmp.

#resource  "\\Images\\test.bmp"

void DashboardLabel() {

  if ( ObjectFind("myRectBack" ) == -1) {
  ObjectCreate(ChartID(),"myRectBack",OBJ_RECTANGLE_LABEL,0,0,0) ;
  ObjectSetInteger(ChartID(),"myRectBack",OBJPROP_XDISTANCE,7);
  ObjectSetInteger(ChartID(),"myRectBack",OBJPROP_YDISTANCE,20);
  ObjectSetInteger(ChartID(),"myRectBack",OBJPROP_XSIZE,320);
  ObjectSetInteger(ChartID(),"myRectBack",OBJPROP_YSIZE,270);
  ObjectSetInteger(ChartID(),"myRectBack",OBJPROP_BGCOLOR, clrWhiteSmoke);
  ObjectSetInteger(ChartID(),"myRectBack",OBJPROP_FILL,false);
  ObjectSetInteger(ChartID(),"myRectBack",OBJPROP_BACK,true);
  ObjectSetInteger(ChartID(),"myRectBack",OBJPROP_BORDER_TYPE,BORDER_RAISED);
  }
  
  if ( ObjectFind("myRect" ) == -1) {
  ObjectCreate(ChartID(),"myRect",OBJ_RECTANGLE_LABEL,0,0,0) ;
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_XDISTANCE,15);
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_YDISTANCE,30);
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_BACK,false);
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_XSIZE,300);
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_YSIZE,250);
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_BGCOLOR, clrDarkRed);
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_FILL,false);
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_BACK,false);
  ObjectSetInteger(ChartID(),"myRect",OBJPROP_BORDER_TYPE,BORDER_RAISED);
  }
  
  if ( ObjectFind("Logo" ) == -1) {
  ObjectCreate("Logo", OBJ_BITMAP,0,0,0,0,0,0,0);
  ObjectSet("Logo", OBJPROP_BMPFILE, "::\\Images\\test.bmp");
  ObjectSet("Logo", OBJPROP_CORNER, 0);
  ObjectSet("Logo", OBJPROP_XDISTANCE, 25);
  ObjectSet("Logo", OBJPROP_YDISTANCE, 30); 
  }
  
  if ( ObjectFind("Wintrade" ) == -1) {
  ObjectCreate("WinTrade", OBJ_LABEL, 0, 0, 0);
  ObjectSetText("WinTrade", "Win Trade : " + "\n"  + (string)trades_won, 11, "Arial", White);
  ObjectSet("WinTrade", OBJPROP_CORNER, 0);
  ObjectSet("WinTrade", OBJPROP_XDISTANCE, 25);
  ObjectSet("WinTrade", OBJPROP_YDISTANCE, 60); 
  }
  
  if ( ObjectFind("LossTrade" ) == -1) {
  ObjectCreate("LossTrade", OBJ_LABEL, 0, 0, 0);
  ObjectSetText("LossTrade", "Loss Trade : " + "\n" + (string)trades_lost, 11, "Arial", White);
  ObjectSet("LossTrade", OBJPROP_XDISTANCE, 25);
  ObjectSet("LossTrade", OBJPROP_YDISTANCE, 90); 
  }
  
  if ( ObjectFind("Winratio" ) == -1) {
  ObjectCreate("Winratio", OBJ_LABEL, 0, 0, 0);
  ObjectSetText("Winratio", "Winratio : " + "\n"     + DoubleToStr(win_ratio,0) + "%", 11, "Arial", White);
  ObjectSet("Winratio", OBJPROP_CORNER, 0);
  ObjectSet("Winratio", OBJPROP_XDISTANCE, 25);
  ObjectSet("Winratio", OBJPROP_YDISTANCE, 120); 
  }
    
  if ( ObjectFind("StartLot" ) == -1) {
  ObjectCreate("StartLot", OBJ_LABEL, 0, 0, 0);
  ObjectSetText("StartLot", "Lots : " + "\n"     + DoubleToStr(Lots,2), 11, "Arial", White);
  ObjectSet("StartLot", OBJPROP_CORNER, 0);
  ObjectSet("StartLot", OBJPROP_XDISTANCE, 25);
  ObjectSet("StartLot", OBJPROP_YDISTANCE, 150);
  }
  
  if ( ObjectFind("Balance" ) == -1) {
  ObjectCreate("Balance", OBJ_LABEL, 0, 0, 0);
  ObjectSetText("Balance", "Equity : " + "\n"     + DoubleToStr(AccountEquity(),2), 11, "Arial", White);
  ObjectSet("Balance", OBJPROP_CORNER, 0);
  ObjectSet("Balance", OBJPROP_XDISTANCE, 25);
  ObjectSet("Balance", OBJPROP_YDISTANCE, 180);
  }
  
  if ( ObjectFind("Risk" ) == -1) {
  ObjectCreate("Risk", OBJ_LABEL, 0, 0, 0);
  ObjectSetText("Risk", "Risk Mode : " + "\n"     + Risk(), 11, "Arial", White);
  ObjectSet("Risk", OBJPROP_CORNER, 0);
  ObjectSet("Risk", OBJPROP_XDISTANCE, 25);
  ObjectSet("Risk", OBJPROP_YDISTANCE, 210);
  }
  
  if ( ObjectFind("Open Order" ) == -1) {
  ObjectCreate("Open Order", OBJ_LABEL, 0, 0, 0);
  ObjectSetText("Open Order", "Order Open : " + "\n"     + numOrders, 11, "Arial", White);
  ObjectSet("Open Order", OBJPROP_CORNER, 0);
  ObjectSet("Open Order", OBJPROP_XDISTANCE, 25);
  ObjectSet("Open Order", OBJPROP_YDISTANCE, 240);
  }
  
}
 

Please don't post randomly in any section. MT4/mql4 has it's own section on the forum.

I have moved your topic to the correct section.

 
  1. Post in the correct place.
  2. #resource  "\\Images\\test.bmp"
    
      ObjectSet("Logo", OBJPROP_BMPFILE, "::\\Images\\test.bmp");

    #resource "\\Indicators… iCustom("::Indicators…
              Use the publicly released code - MQL5 programming forum (2017)
              Resources - MQL4 Reference

    Be aware that using resources is 40x times slower than using CIs directly.
              A custom indicator as a resource - MQL4 programming forum (2019)

    Also make use there are no spaces in the path.
              Getting error 4802 when loading custom indicator that loads another custom indicator with iCustom - Technical Indicators - MQL5 programming forum. (2020)

    Also Use of Resources in MQL5 - MQL5 Articles (2011)

 

Sorry for the mistake in the section, I thought it was the correct one related to trading systems, next time I'll pay more attention.


William Roeder # :
  1. Post in the correct place.
  2. #resource "\\Indicators… iCustom("::Indicators…
               Use the publicly released code - MQL5 programming forum (20 17 )
               Resources - MQL4 Reference

    Be aware that using resources is 40x times slower than using CIs directly.
               A custom indicator as a resource - MQL4 programming forum (20 19 )

    Also make use there are no spaces in the path.
               Getting error 4802 when loading custom indicator that loads another custom indicator with iCustom - Technical Indicators - MQL5 programming forum . (20 20 )

    Also Use of Resources in MQL5 - MQL5 Articles (20 11 )


Thanks so much for your response and the linked resources. Unfortunately, modifying the ObjectSet by removing the slashes didn't change anything, but it was still a mistake to correct.I tried to add a check on the creation of the bmp, and it gives me the error 4201 , so I think it may depend on my image


** SOLVED with this :

  if ( ObjectFind("Logo" ) == -1) {
  ObjectCreate("Logo", OBJ_BITMAP_LABEL,0,0,0);
  if(!ObjectSetString(ChartID(),"Logo", OBJPROP_BMPFILE,"::Images\\test.bmp")) Print("Error creating bmp. Error code: %",GetLastError());
  ObjectSet("Logo", OBJPROP_CORNER, 0);
  ObjectSet("Logo", OBJPROP_XDISTANCE, 25);
  ObjectSet("Logo", OBJPROP_YDISTANCE, 30); 
  }