s_v1
Download scriptThis script is designed as a visual time-management tool for traders who need to track multiple different time zones simultaneously on a single price chart. By automatically drawing vertical markers, it helps users identify key market sessions, opening times, or specific regional hours without having to manually calculate the difference between their local time and global markets.
How the Logic Works
The script scans your trading history (up to a user-defined number of past bars) and looks for specific "trigger moments"—the exact hour and minute when a particular time zone starts. When it finds one of these moments, it places a vertical line on your chart to highlight it visually.
Key Features:
-
Multi-Zone Tracking: The tool is pre-configured to monitor four distinct time references:
- EST (Eastern Standard Time): Marked with Blue lines.
- MST (Mountain Standard Time): Marked with Red lines.
- GMT (Greenwich Mean Time): Marked with Yellow lines.
- Broker Time: Marked with White lines to show the "00:00" reset of your trading platform's internal clock.
-
Customizable Timeframes: You can adjust the specific hours for each zone (EST, MST, GMT) within the settings. This allows you to tailor the tool to the specific markets you trade most frequently.
-
Visual Clarity: To keep the chart clean and readable, all markers are drawn as "dash-dot" lines rather than solid ones. This ensures they provide a clear reference point without obstructing your view of the price action.
-
Automatic Cleanup: The script includes a maintenance routine that ensures old markers are managed correctly, preventing unnecessary clutter as you move between different charts or timeframes.
Practical Application
For a trader, this means you can see exactly when the New York session opens, when London begins, or when the Tokyo market is active, all at a single glance. It eliminates the guesswork of "mental math" regarding time conversions, allowing for more disciplined entries and exits based on specific global market hours.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| TimeZones.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//| Made/Modified by Alejandro Galindo |
//| |
//| |
//| if this work/modification is helpful to you |
//| send me a PayPal donation to ag@elcactus.com |
//| any help is apreciated :) |
//| Thanks. |
//+-------------------------------------------------------------------+
#property copyright "Copyright © 2005. Alejandro Galindo"
#property link "http://elCactus.com"
#property indicator_chart_window
extern int EST=7;
extern int MST=6;
extern int GMT=2;
extern int CountBars=500;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
int shift=0;
for (shift=Bars-1;shift>=0;shift--) {
ObjectDelete("EST"+shift);
ObjectDelete("MST"+shift);
ObjectDelete("GMT"+shift);
ObjectDelete("Broker"+shift);
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int shift, NumBars=500;
double CloseTime,OpenTime;
if (Bars<CountBars) { NumBars=Bars-1; } else { NumBars=CountBars; }
for (shift=Bars-1;shift>=0;shift--) {
// OpenTime=StrToTime(TimeDay(Time[shift])+" "+EST+":"+OpenTimeMin);
// CloseTime=StrToTime(TimeDay(Time[shift])+" "+MST+":"+CloseTimeMin);
if (TimeHour(Time[shift])== EST && TimeMinute(Time[shift])==0) {
if(ObjectFind("EST"+shift) != 0)
{
ObjectCreate("EST"+shift, OBJ_VLINE, 0, Time[shift], 0);
ObjectSet("EST"+shift, OBJPROP_STYLE, STYLE_DASHDOTDOT);
ObjectSet("EST"+shift, OBJPROP_COLOR, Blue);
}
}
if (TimeHour(Time[shift])== MST && TimeMinute(Time[shift])==0) {
if(ObjectFind("MST"+shift) != 0)
{
ObjectCreate("MST"+shift, OBJ_VLINE, 0, Time[shift], 0);
ObjectSet("MST"+shift, OBJPROP_STYLE, STYLE_DASHDOTDOT);
ObjectSet("MST"+shift, OBJPROP_COLOR, Red);
}
}
if (TimeHour(Time[shift])== GMT && TimeMinute(Time[shift])==0) {
if(ObjectFind("GMT"+shift) != 0)
{
ObjectCreate("GMT"+shift, OBJ_VLINE, 0, Time[shift], 0);
ObjectSet("GMT"+shift, OBJPROP_STYLE, STYLE_DASHDOTDOT);
ObjectSet("GMT"+shift, OBJPROP_COLOR, Yellow);
}
}
if (TimeHour(Time[shift])== 0 && TimeMinute(Time[shift])==0) {
if(ObjectFind("Broker"+shift) != 0)
{
ObjectCreate("Broker"+shift, OBJ_VLINE, 0, Time[shift], 0);
ObjectSet("Broker"+shift, OBJPROP_STYLE, STYLE_DASHDOTDOT);
ObjectSet("Broker"+shift, OBJPROP_COLOR, White);
}
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments