GP_Clock~_002

Author: Copyright � 2005, Nick Bilak
GP_Clock~_002

This tool is designed as a visual time-tracking utility for trading platforms, providing real-time feedback on the remaining duration of the current active candle. Rather than requiring manual calculation, it automatically monitors the live market data to show exactly how much time is left before the next price bar begins.

How it Works

The script operates by calculating the difference between the current time and the expiration time of the current candle based on your selected timeframe (e.g., 1 minute, 5 minutes, 1 hour, etc.). It then breaks this remaining duration down into two distinct components:

  • Minutes: The total number of full minutes remaining.
  • Seconds: The specific number of seconds remaining within the current minute.

Visual Display

The tool provides a dual-layered information display on your trading chart:

  1. On-Screen Commentary: It places a dynamic text update in the corner of your screen that reads out the remaining time in a "Minutes and Seconds" format. This allows for a quick glance to see how much time remains in a trade setup.
  2. Dynamic Chart Label: The script creates a visual label on the chart itself. This label is positioned slightly above the current closing price of the active candle. It features a prominent clock display (using a bold, italic font) that updates instantly as every second passes.

Key Functionalities

  • Automatic Scaling: The logic automatically adjusts to whatever timeframe you have currently selected on your chart.
  • Live Updates: The script constantly refreshes the calculation, ensuring the countdown remains accurate as the market moves.
  • Visual Clarity: It uses a customizable color (defaulting to Lime) to ensure the countdown is easily visible against various background colors and price movements.

In summary, this tool acts as a precise "countdown clock" for your trading candles, helping you keep track of time-sensitive entries and exits without needing to look at a separate system clock or manually calculate bar expirations.

11 Views
0 Downloads
0 Favorites
GP_Clock~_002
/*
   Generated by EX4-TO-MQ4 decompiler V4.0.220.2 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2005, Nick Bilak"
#property link      "http://metatrader.50webs.com/"

#property indicator_chart_window

extern color ClockColor = Lime;
double gda_unused_80[];

int deinit() {
   ObjectDelete("time");
   return (0);
}

int init() {
   return (0);
}

int start() {
   int li_8 = Time[0] + 60 * Period() - TimeCurrent();
   double ld_0 = li_8 / 60.0;
   int li_12 = li_8 % 60;
   li_8 = (li_8 - li_8 % 60) / 60;
   Comment(li_8 + " minutes " + li_12 + " seconds left to bar end");
   ObjectDelete("time");
   if (ObjectFind("time") != 0) {
      ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0] + 0.0005);
      ObjectSetText("time", "                           <" + li_8 + ":" + li_12, 12, "Arial Bold Italic", ClockColor);
   } else ObjectMove("time", 0, Time[0], Close[0] + 0.0005);
   return (0);
}

Comments