SoSo_Time
Download scriptThe SoSoTime tool is designed to provide traders with a clear visual map of global market sessions directly on their trading charts. Instead of forcing you to constantly check your local clock and calculate the differences between various world time zones, this script automatically identifies and highlights when major financial hubs are active.
How it Works
The logic behind this indicator focuses on "Session Awareness." It monitors the current time against specific pre-defined opening and closing hours for five of the world's most significant trading regions:
- Sydney
- Tokyo
- Frankfurt
- London
- New York
Key Features & Logic
- Automated Time Tracking: The script scans the historical and real-time data of your chart. For every candle (or "bar"), it checks if the timestamp falls within the specific window of a global session.
- Dynamic Visibility: The indicator only displays information when a market is actually open. If a session is closed, the marker disappears, ensuring your chart remains clean and uncluttered by irrelevant data.
- Overnight Session Handling: The logic is sophisticated enough to understand markets that cross over midnight. For example, if a session starts late in one day and ends early the next morning, the script correctly identifies this continuous block of time as a single active session.
- Visual Organization: Each market is assigned its own unique visual marker. By looking at the indicator window, you can immediately see which markets are currently "live," allowing you to identify periods of high liquidity and volatility—such as when the London and New York sessions overlap.
Summary for Traders
This tool acts as a geographical heartbeat for the forex and global markets. It simplifies your workflow by providing an instant visual reference for market activity, helping you stay informed on where the "big money" is moving at any given moment without needing to perform manual time zone conversions.
/*+------------------------------------------------------------------+
| FxSo_SoSo_Time |
| Author: Copyright © 20061211, |
| |
| |
+------------------------------------------------------------------+*/
#property copyright "Copyright © 2006FxSo,"
#property link "http://fxso.blog.hexun.com/"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 DeepPink
#property indicator_color2 Purple
#property indicator_color3 SandyBrown
#property indicator_color4 DeepSkyBlue
#property indicator_color5 YellowGreen
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_width4 1
#property indicator_width5 1
#property indicator_maximum 5.5
#property indicator_minimum 0.5
//for GMT +2:00
extern string shortName = "SoSoTime for GMT +2:00";
extern int SydneyOpen = 0;
extern int SydneyClose = 8;
extern int TokyoOpen = 2;
extern int TokyoClose = 10;
extern int FrankfurtOpen = 8;
extern int FrankfurtClose = 16;
extern int LondonOpen = 10;
extern int LondonClose = 18;
extern int NewYorkOpen = 15;
extern int NewYorkClose = 0;
// Buffers
double LineSydney[];
double LineTokyo[];
double LineFrankfurt[];
double LineLondon[];
double LineNewYork[];
int init()
{IndicatorShortName(shortName);
IndicatorBuffers(5);
//---- indicator line
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(0,110);
SetIndexBuffer(0,LineSydney);
SetIndexEmptyValue(0,0.0);
SetIndexLabel(0,"L_Sydney");
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(1,110);
SetIndexBuffer(1,LineTokyo);
SetIndexEmptyValue(1,0.0);
SetIndexLabel(1,"L_Tokyo");
SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(2,110);
SetIndexBuffer(2,LineFrankfurt);
SetIndexEmptyValue(2,0.0);
SetIndexLabel(2,"L_Frankfurt");
SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(3,110);
SetIndexBuffer(3,LineLondon);
SetIndexEmptyValue(3,0.0);
SetIndexLabel(3,"L_London");
SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(4,110);
SetIndexBuffer(4,LineNewYork);
SetIndexEmptyValue(4,0.0);
SetIndexLabel(4,"L_NewYork");
return(0);
}
int start()
{
int iBarsToCalc = Bars - IndicatorCounted();
if (iBarsToCalc < Bars) iBarsToCalc++;
for (int i=iBarsToCalc-1;i>=0;i--)
{
if (isMarketOpen(SydneyOpen, SydneyClose, Time[i]))
LineSydney[i] = 5;
else
LineSydney[i] = EMPTY_VALUE;
if (isMarketOpen(TokyoOpen, TokyoClose, Time[i]))
LineTokyo[i] = 4;
else
LineTokyo[i] = EMPTY_VALUE;
if (isMarketOpen(FrankfurtOpen, FrankfurtClose, Time[i]))
LineFrankfurt[i] = 3;
else
LineFrankfurt[i] = EMPTY_VALUE;
if (isMarketOpen(LondonOpen, LondonClose, Time[i]))
LineLondon[i] = 2;
else
LineLondon[i] = EMPTY_VALUE;
if (isMarketOpen(NewYorkOpen, NewYorkClose, Time[i]))
LineNewYork[i] = 1;
else
LineNewYork[i] = EMPTY_VALUE;
}
}
bool isMarketOpen(int iOpenHour, int iCloseHour, datetime timestamp)
{
int iBarHour = TimeHour(timestamp);
if (iOpenHour < iCloseHour && (iBarHour >= iOpenHour && iBarHour < iCloseHour))
return(true);
if (iOpenHour > iCloseHour && (iBarHour >= iOpenHour || iBarHour < iCloseHour))
return(true);
return(false);
}
Comments