Do you want to put your logo as image and impress your clients with your programming-skills? Mt4gui is perfect tool to master this

Requirements

We assume you use mt4gui framework, assume you understand basic concepts of this framework, if not give it a try. Mt4gui is a library which can use MQL Developers have button, checkbox, radiobox, image, label etc on their charts and capture those events such as clicked.

Requirements

There are few requirements with this approach:

  1. image needs to have BITMAP (.bmp) format
  2. image cannot be transparent and they will cover underlying ohlc chart, i don´t recommend huge images
  3. image needs to be present inside Terminal folder where terminal.exe is inside, if you want to deploy it to your clients, you need to make sure you copy the .bmp file into terminal folder with installer software. Of course you could also tell your clients to put the .bmp file into this folder but if we assume most of clients are novice, it might end up by a mess. I recommend to use a software such as EASetup to install Metatrader clients.
  4. Images does not have any events. So you cannot detect a clicked event for example

Howto

Very basic MQL code is:

#include <mt4gui2.mqh>

int hwnd,image1;

int OnInit()
{
  hwnd = WindowHandle(Symbol(),Period());	
  guiRemoveAll(hwnd);		
  image1 = guiAdd(hwnd,"image",100,100,0,0,"fx1logo.bmp");
  return(INIT_SUCCEEDED);
}

int deinit()
{
  // Very important to cleanup and remove all gui items from chart   
  if (hwnd>0) guiRemoveAll(hwnd);  
  guiCleanup(hwnd); 
  return(0);
}
  
void OnTick()
{  
 // ..... your code ....
}

Result:
mt4guiimage

Easy World

It is very easy to add images with mt4gui. You can display your logo for few seconds and then remove it with guiRemove(hwnd,image1) command simply and it is gone. The dimentions of bmp file will be applied automatically, you dont need to know the dimentions, just the location.

Lets go more advanced

Code is easier than you think

#include <mt4gui2.mqh>

int hwnd,image1,xpos=100;

int OnInit()
{
  hwnd = WindowHandle(Symbol(),Period());	
  guiRemoveAll(hwnd);		
  image1 = guiAdd(hwnd,"image",xpos,100,0,0,"train.bmp");  
  EventSetMillisecondTimer(10);
  return(INIT_SUCCEEDED);
}

int deinit()
{
  // Very important to cleanup and remove all gui items from chart   
  if (hwnd>0) guiRemoveAll(hwnd);  
  guiCleanup(hwnd); 
  return(0);
}
  
void OnTick() {  }

void OnTimer()
{  
 long width;
 if (ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0,width))
 {
   guiSetPos(hwnd,image1,xpos++,100);
   if (xpos>width) xpos=0;
 } 
}