Time_indicator

Author: Copyright � 2013, www.FxAutomated.com
Time_indicator

This script is designed as a visual dashboard tool for the MetaTrader trading platform. Its primary purpose is to provide the user with a clear, real-time comparison between two different time sources directly on the trading chart: the broker's server time and the user's local computer time.

How It Works

The indicator functions by creating two distinct text labels on your screen. By displaying these side-by-side, it helps traders avoid confusion when executing trades, as a broker's server might be located in a different time zone than where the trader is physically sitting.

1. Data Retrieval The script constantly pulls two separate pieces of information:

  • Broker Time: The official time provided by your trading platform's server.
  • Local Time: The actual time currently displayed on your personal computer or device.

2. Visual Display The script formats these times into a readable date and second format and places them in the upper-left corner of your chart. It distinguishes between the two sources using different colors (Red for Broker Time and Lime for Computer Time) to ensure that you can tell them apart at a glance.

3. Dynamic Adjustments The logic includes specific settings to help you customize how the information appears:

  • Positioning: You can adjust how far from the top-left corner the text appears.
  • Zooming: There is a zoom level feature that allows you to scale the size of the text, making it easier to read depending on your screen resolution or chart layout.

Summary of Benefits

Instead of having to constantly check your taskbar or switch windows to verify what time it is in the markets, this script consolidates all necessary information into one view. It ensures that you always have an accurate reference for market sessions, news events, and trade expirations relative to your own local clock.

11 Views
1 Downloads
0 Favorites
Time_indicator
//+------------------------------------------------------------------+
//|                                               Time indicator.mq4 |
//|                            Copyright © 2013, www.FxAutomated.com |
//|                                       http://www.FxAutomated.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2013, www.FxAutomated.com"
#property link      "http://www.FxAutomated.com"

#property indicator_chart_window

extern color BrokerTimeColor=Red;
extern color ComputerTimeColor=Lime;
extern int   DistanceFromTopLeft=10;
extern double ZoomLevel=1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   ObjectCreate("Label_bt", OBJ_LABEL, 0, 0, 0);  // Creating obj.
   ObjectSet("Label_bt", OBJPROP_CORNER, 0);    // Reference corner
   ObjectSet("Label_bt", OBJPROP_XDISTANCE, DistanceFromTopLeft*ZoomLevel);// X coordinate   
   ObjectSet("Label_bt", OBJPROP_YDISTANCE, 30*ZoomLevel);// Y coordinate

   ObjectCreate("Label_ct", OBJ_LABEL, 0, 0, 0);  // Creating obj.
   ObjectSet("Label_ct", OBJPROP_CORNER, 0);    // Reference corner
   ObjectSet("Label_ct", OBJPROP_XDISTANCE, DistanceFromTopLeft*ZoomLevel);// X coordinate   
   ObjectSet("Label_ct", OBJPROP_YDISTANCE, 60*ZoomLevel);// Y coordinate

//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
//----
   ObjectSetText("Label_bt",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),20*ZoomLevel,"Arial",BrokerTimeColor);
   ObjectSetText("Label_ct",TimeToStr(TimeLocal(),TIME_DATE|TIME_SECONDS),20*ZoomLevel,"Arial",ComputerTimeColor);
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("Label_bt");
   ObjectDelete("Label_ct");
//----
   return(0);
  }

Comments