Show_your_local_time

Download script
Author: Copyright � 2005, Interbankfx
Show_your_local_time

This script is designed to provide traders with a clear, real-time display of their local time directly on the trading chart. Because trading platforms often operate on a standardized Universal Time (GMT) rather than your specific regional time zone, this tool bridges that gap automatically.

How it Works

Time Zone Customization The script allows you to define exactly how many hours your local time differs from the platform's base time. By simply entering your local offset, the software handles the conversion math in the background so you don't have to manually calculate the time difference during your trading session.

Dynamic Display Instead of just showing a static number, the script continuously updates the visual display. It captures the current hour and minute from the platform, applies your custom offset, and formats the result into a clean "Hours:Minutes" layout. For example, it ensures that minutes are always shown as two digits (turning "9" into "09"), maintaining a professional and consistent look on your screen.

Visual Overlay The script creates a dedicated text label in the upper corner of your trading chart. It is styled to be easily readable with a specific font size and color (Yellow), ensuring that you can keep an eye on the time at a glance without it obstructing your view of the price candles or technical indicators.

Automatic Maintenance The tool is programmed to manage itself cleanly. When you first activate it, it generates the label; while the script is running, it constantly refreshes the time; and if you choose to remove the script, it automatically cleans up the chart by deleting the label so no leftover text remains on your screen.

10 Views
0 Downloads
0 Favorites
Show_your_local_time
//+------------------------------------------------------------------+
//|                                         Show_your_local_time.mq4 |
//|                                    Copyright © 2005, Interbankfx |
//|                                      http://www.interbankfx.com/ |
//+------------------------------------------------------------------+
// Our version 4 platform is GMT + 2. 
// Our version 3 platform is GMT + 3. 

#property copyright "Copyright © 2005, Interbankfx"
#property link      "http://www.interbankfx.com/"

extern int Hours_from_GMT = 5;

int deinit(){
   Comment("");
   if (ObjectFind("lbl_time") > -1){
      ObjectDelete("lbl_time");
   }
}

int init(){
   ShowTime();
   return(0);
}

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start(){
   ShowTime();
   return(0);
}

void ShowTime(){
   int hours = Hour() - Hours_from_GMT - 2;
   string strmin = Minute() + "";
   if (StringLen(strmin) == 1)
      strmin = "0" + strmin;
   string txt = hours + ":" + strmin;
   //Comment(txt);
   
   ObjectCreate("lbl_time", OBJ_LABEL, 0, 0, 0);
   ObjectSet("lbl_time", OBJPROP_XDISTANCE, 10);
   ObjectSet("lbl_time", OBJPROP_YDISTANCE, 15);
   
   ObjectSetText("lbl_time", txt, 16, "Arial", Yellow);
   //ObjectMove("lbl_time", 0, Time[50], High[50]);
}
//+------------------------------------------------------------------+

Comments