time1_v1
Download scriptThis script is designed as a visual time-marking tool for the MetaTrader trading platform. Its primary purpose is to automatically identify and highlight specific key moments during the trading day by drawing vertical lines directly onto your price chart.
Instead of requiring you to manually track the clock or place lines yourself, the logic works as follows:
Historical Mapping When you first apply the script to a chart, it scans through your existing historical data. It looks for specific times of the day and places a permanent vertical line at those exact moments. This allows you to see where these key time markers occurred in past trading sessions.
Real-Time Tracking The script also monitors the live market feed. As time progresses, it constantly checks the current clock. When the market hits one of the pre-defined milestones, the script automatically generates a new vertical line on your screen in real-time.
Specific Time Markers and Visual Coding To help differentiate between different trading periods or sessions, the script uses a color-coded system. Each specific time is assigned a unique color to help you distinguish between them at a glance:
- 08:00: Marked with an Aqua line.
- 11:00: Marked with a Blue line.
- 12:30: Marked with a Purple line.
- 14:00: Marked with an Orange line.
- 17:00: Marked with a Brown line.
By providing these visual cues, the script helps traders quickly identify significant time boundaries, allowing for better organization of the trading day and easier recognition of recurring market shifts.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| time1.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
string t;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
int i;
i=Bars-1;
while(i>0)
{
t=DoubleToStr(i,0);
if(TimeMinute(Time[i])==0&&TimeHour(Time[i])==8)
{
ObjectCreate(t, OBJ_VLINE, 0, Time[i],0);
ObjectSet(t, OBJPROP_COLOR,Aqua);
}
if(TimeMinute(Time[i])==0&&TimeHour(Time[i])==11)
{
ObjectCreate(t, OBJ_VLINE, 0, Time[i],0);
ObjectSet(t, OBJPROP_COLOR,Blue);
}
if(TimeMinute(Time[i])==30&&TimeHour(Time[i])==12)
{
ObjectCreate(t, OBJ_VLINE, 0, Time[i], 0);
ObjectSet(t, OBJPROP_COLOR,Purple);
}
if(TimeMinute(Time[i])==0&&TimeHour(Time[i])==14)
{
ObjectCreate(t, OBJ_VLINE, 0, Time[i],0);
ObjectSet(t, OBJPROP_COLOR,Orange);
}
if(TimeMinute(Time[i])==0&&TimeHour(Time[i])==17)
{
ObjectCreate(t, OBJ_VLINE, 0, Time[i],0);
ObjectSet(t, OBJPROP_COLOR,Brown);
}
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
t=TimeToStr(CurTime());
if(TimeMinute(CurTime())==0&&TimeHour(CurTime())==8)
{
ObjectCreate(t, OBJ_VLINE, 0, CurTime(),0);
ObjectSet(t, OBJPROP_COLOR,Aqua);
}
if(TimeMinute(CurTime())==0&&TimeHour(CurTime())==11)
{
ObjectCreate(t, OBJ_VLINE, 0,CurTime(),0);
ObjectSet(t, OBJPROP_COLOR,Blue);
}
if(TimeMinute(CurTime())==30&&TimeHour(CurTime())==12)
{
ObjectCreate(t, OBJ_VLINE, 0,CurTime(), 0);
ObjectSet(t, OBJPROP_COLOR,Purple);
}
if(TimeMinute(CurTime())==0&&TimeHour(CurTime())==14)
{
ObjectCreate(t, OBJ_VLINE, 0,CurTime(),0);
ObjectSet(t, OBJPROP_COLOR,Orange);
}
if(TimeMinute(CurTime())==0&&TimeHour(CurTime())==17)
{
ObjectCreate(t, OBJ_VLINE, 0,CurTime(),0);
ObjectSet(t, OBJPROP_COLOR,Brown);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments