_b-clock modified V2
Download scriptThis tool serves as a real-time visual countdown timer designed for traders using the MetaTrader platform. Its primary purpose is to provide a clear, live update of how much time remains before the current candlestick (or "bar") on a trading chart expires.
How it Works
The script constantly monitors the current timeframe of your trading chart and performs the following logic:
- Time Calculation: It identifies the exact closing time of the current candle and compares it against the current system time. By calculating the difference between these two points, it determines exactly how many minutes and seconds are left until the next bar opens.
- Live Countdown: As each second passes, the script recalculates this duration. This ensures that the information displayed is always accurate and updated in real-time.
- Visual Display: The tool provides information in two ways:
- On-Screen Text: It places a specific text label directly on the chart near the current price action, showing the remaining time in a "Minutes:Seconds" format.
- Status Comment: It simultaneously generates a small text comment in the corner of your screen, providing a secondary confirmation of the time remaining.
Key Features for Traders
- Visual Awareness: Instead of manually checking the clock or the chart's properties, traders can see at a glance how much "room" they have left to execute a trade or manage an existing position before the price action resets.
- Dynamic Positioning: The visual label is programmed to follow the current market price, ensuring it remains visible and relevant even as the market fluctuates.
- Customizable Appearance: The script allows for adjustments regarding font styles, sizes, and colors, enabling users to tailor the display to match their specific chart layout for better visibility.
//+------------------------------------------------------------------+
//| #OTCFX b-clock.mq4 |
//| Core time code by Nick Bilak |
//| http://metatrader.50webs.com/ beluck[at]gmail.com |
//| modified by adoleh2000 and dwt5 |
//| Modified and improved by "OTCFX" |
//|
//| | |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Nick Bilak"
#property link "http://metatrader.50webs.com/"
#property indicator_chart_window
#property indicator_color1 Aqua
extern color BClockClr = Aqua;
extern string myFont = "Arial Bold" ;
extern string myFont2 = "Arial" ;
extern int myFontSize = 10 ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//}
//if (TimeFrame<Period()) TimeFrame=Period();
return(0);
}
return(0);
int deinit()
{
ObjectDelete("time");
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int t=0; //c=0;
double i;
int m,s,k;
m=Time[0]+Period()*60-CurTime();
i=m/60.0;
s=m%60;
m=(m-m%60)/60;
Comment( m + " minutes " + s + " seconds left to bar end");
ObjectDelete("time");
if(ObjectFind("time") != 0)
{
ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0]+ 0.0000);
ObjectSetText("time", " <"+m+":"+s, myFontSize, "Verdana Bold", BClockClr);
}
else
{
ObjectMove("time", 0, Time[0], Close[0]+0.0005);
}
return(0);
}
//+------------------------------------------------------------------+
Comments