CandleTime
Download scriptThis tool is designed to provide traders with a real-time visual countdown on their trading charts. It helps you keep track of how much time remains before the current price candle closes, which is essential for understanding market momentum and timing entries or exits.
How it Works
The script continuously monitors the current timeframe of your chart and calculates the difference between the current moment and the exact second the next candle is scheduled to begin.
It breaks down this remaining duration into two parts:
- Minutes: The total full minutes left.
- Seconds: The specific remaining seconds within that minute.
Display Options
Depending on your personal preference, the script provides two different ways to view this information:
- On-Screen Text Overlay: By default, the tool places a dynamic text label directly on the price chart. It appears near the current price, showing you exactly how many minutes and seconds are left in the bar. This is ideal for traders who want to keep their eyes on the price action while seeing the countdown.
- Comment Box: If you prefer a cleaner chart layout, you can enable a "comment" mode. This moves the information away from the price candles and places it into a small text box in the corner of your screen.
Visual Customization
To ensure the information is easy to read for every user, the script allows for several visual adjustments:
- Color: You can change the color of the countdown text to suit your chart's theme.
- Font Size: You can scale the text up or down depending on your screen resolution.
- Font Style: You can choose a specific font (such as Verdana) to improve legibility.
Essentially, this tool removes the guesswork of "how much time is left," allowing you to focus more on market movements and less on watching your clock.
//====================================================================
// CandleTime.mq4
// by Derk Wehler
// derkwehler@gmail.com
//====================================================================
#property copyright "Copyright © 2005, Derk Wehler"
#property link "http://www.ArrogantFxBastards.com"
#property indicator_chart_window
extern bool UseComment = false;
extern color TextColor = Aqua;
extern int TextSize = 8;
extern string TextFont = "Verdana";
//extern int Corner = 0;
// buffers
double s1[];
//====================================================================
// Init and Deinit
//+------------------------------------------------------------------+
int init()
{
return(0);
}
int deinit()
{
ObjectDelete("time");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double i;
int m, s, k;
string output;
m = Time[0] + Period() * 60 - CurTime();
i = m / 60.0;
s = m % 60;
m = (m - m % 60) / 60;
output = m + " minutes " + s + " seconds left to bar end";
if (UseComment)
Comment(output);
else
{
ObjectDelete("time");
// Print("NOT == 0, so not in main win, creating");
ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0]+ 0.0005);
ObjectSetText("time", output, TextSize, TextFont, TextColor);
// ObjectSet("time", OBJPROP_CORNER, Corner);
}
return(0);
}
Comments