This tool is designed as an on-screen dashboard for MetaTrader users, providing real-time visual feedback on two critical market variables: the remaining time until the current price bar closes and the current market spread.
By integrating these details directly onto your trading chart, the script eliminates the need to manually calculate time remaining or toggle through different windows to check transaction costs. Here is a breakdown of how the logic functions:
Time Tracking & Countdown
The tool constantly monitors the progression of the current live candle. It calculates the difference between the current market time and the official closing time of the active bar. This information is displayed in two ways:
- Text Overlay: A dynamic comment is updated at the top of your chart, showing exactly how many minutes and seconds are left before the next price update.
- Visual Label: A floating text object appears on the chart near the current price, providing a quick-glance reference to the remaining time in a "Minutes:Seconds" format.
Live Spread Monitoring
The script continuously pulls data from the broker's feed to identify the current spread (the difference between the bid and ask prices). This is displayed as a secondary visual label positioned slightly below the current price. By showing this in real-time, it helps traders stay aware of execution costs, which is especially important during periods of high market volatility.
Dynamic Positioning
To ensure that the information remains readable and does not interfere with your technical analysis, the script automatically anchors both pieces of information to the most recent price point. As the price moves, the labels adjust their position slightly to remain visible on the right side of the screen, keeping the data "pinned" to the live action.
Summary of Benefits
- Enhanced Awareness: Gives you an immediate sense of the "rhythm" of the market by showing how much time is left in each candle.
- Cost Transparency: Keeps the spread visible at all times, helping you make more informed decisions regarding entry and exit points.
- Clean Integration: The tool is designed to update automatically with every price tick, providing a seamless experience without requiring manual interaction.
/*
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");
ObjectDelete("spread");
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." + "\n" + "Current spread = " +DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),0) + " pips.");
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);
ObjectDelete("spread");
if (ObjectFind("spread") != 0) {
ObjectCreate("spread", OBJ_TEXT, 0, Time[0], Close[0] - 0.0050);
ObjectSetText("spread", " " + DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),0), 12, "Arial Bold Italic", ClockColor);
} else ObjectMove("spread", 0, Time[0], Close[0] - 0.0050);
return (0);
}
Comments