How to add a bitmap to EA

 

Hi

can someone help me how to insert a bitmap to my EA ? 

i tried the manual of MQL5 and i didnt secsussed 


for example

i want to add the defult bitmap of dollat from folder \\Images\\dollar.bmp" to middle of the chart 

how can i do it ? 

 
Netanel Tanami :


Examples:

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_BUTTON
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_BUTTON
  • www.mql5.com
OBJ_BUTTON - Object Types - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
can i upload a png file and not a bitmap? i need to upload a image without backround 
 
Netanel Tanami :
can i upload a png file and not a bitmap? i need to upload a image without backround 

It is necessary to use a special * .bmp format in which there is no background (this is not a usual * .bmp, but a special one).

 
Netanel Tanami:

Hi

can someone help me how to insert a bitmap to my EA ? 

i tried the manual of MQL5 and i didnt secsussed 


for example

i want to add the defult bitmap of dollat from folder \\Images\\dollar.bmp" to middle of the chart 

how can i do it ? 

//// add this on top on your code
#resource "\\Images\\dollar.bmp"
string  imgaddress= "::Images\\dollar.bmp";

and use this function to draw image on your chart

bool AddBitmapOnChart(const long            chart_ID=0,               // chart's ID
                      const string          name="Button",            // button name
                      const string          filename="",
                      const datetime        time=0,                   // Time 1
                      const double          price=0,                  // Price 1
                      const string          text="Box lable",         // text
                      const string          font="Arial",             // font
                      const int             font_size=10,             // font size
                      const color           clr=clrBlack,             // text color
                      const bool            back=false,               // in the background
                      const bool            selection=false,          // highlight to move
                      const bool            hidden=true               // hidden in the object list
                      )           
  {
   if(ObjectFind(chart_ID,name)<0)
     {
      ObjectCreate(chart_ID,name,OBJ_BITMAP,0,0,0);
      ObjectSetString(chart_ID,name,OBJPROP_BMPFILE,filename);
      ObjectSet(name,OBJPROP_TIME1,time);
      ObjectSetDouble(chart_ID,name,OBJPROP_PRICE1,price);

      ObjectCreate(chart_ID,name+".txt",OBJ_TEXT,0,0,0);
      ObjectSet(name+".txt",OBJPROP_TIME1,time);
      ObjectSetDouble(chart_ID,name+".txt",OBJPROP_PRICE1,price);
      ObjectSetString(chart_ID,name+".txt",OBJPROP_TEXT,text);
      ObjectSetString(chart_ID,name+".txt",OBJPROP_FONT,font);
      ObjectSetInteger(chart_ID,name+".txt",OBJPROP_FONTSIZE,font_size);
      ObjectSetInteger(chart_ID,name+".txt",OBJPROP_COLOR,clr);
     }
   else
     {
      //ObjectSetString(chart_ID,name,OBJPROP_BMPFILE,filename);
      ObjectSet(name,OBJPROP_TIME1,time);
      ObjectSetDouble(chart_ID,name,OBJPROP_PRICE1,price);
     }
   return(true);
  }

double chartHi = WindowPriceMax(0);
double chartLo = WindowPriceMin(0);
double midle   = chartHi - chartLo;

AddBitmapOnChart(0,"name",imgaddress,Time[20],midle,"TEXT on Image","Arial Black",8,clrWhite,false,false,true,"");