//+------------------------------------------------------------------+ //_X-Clock____________________ \¦/ //_http://www.forex-tsd.com__(ò ó) //______________________o0o___(_)___o0o__ //___¦_____¦_____¦mladen¦_____¦_____¦_____¦ //¦_cja_¦_____¦_____¦_____¦_____¦_____¦__ //___¦_____¦_____¦_____¦_Xard¦777__¦_____¦ //¦____¦ihldiaf¦_____¦_____¦_____¦____¦__ //___¦_____¦_____¦_____¦Baba¦Master_¦____¦ //¦FxSniper___¦_____¦_igor_¦_____¦_____¦__ //+------------------------------------------------------------------+ #property indicator_chart_window //+------------------------------------------------------------------+ #import "kernel32.dll" void GetLocalTime(int& TimeArray[]); void GetSystemTime(int& TimeArray[]); int GetTimeZoneInformation(int& TZInfoArray[]); #import //+------------------------------------------------------------------+ #property indicator_buffers 1 //+------------------------------------------------------------------+ //---- input parameters extern int corner=0; extern int topOff=140; extern int left=-230; extern color labelColor=White; extern color clockColor=Orange; extern bool show12HourTime=false; //+------------------------------------------------------------------+ //---- buffers double ExtMapBuffer1[]; int LondonTZ = 1; int TokyoTZ = 9; int NewYorkTZ = -4; int SydneyTZ = 10; int ZurichTZ = 2; //+------------------------------------------------------------------+ string TimeToString( datetime when ) { if ( !show12HourTime ) return (TimeToStr( when, TIME_MINUTES )); int hour = TimeHour( when ); int minute = TimeMinute( when ); string ampm = " AM"; string timeStr; if ( hour >= 12 ) { hour = hour - 12; ampm = " PM"; } if ( hour == 0 ) hour = 12; timeStr = DoubleToStr( hour, 0 ) + ":"; if ( minute < 10 ) timeStr = timeStr + "0"; timeStr = timeStr + DoubleToStr( minute, 0 ); timeStr = timeStr + ampm; return (timeStr); } //+------------------------------------------------------------------+ int start() { if ( !IsDllsAllowed() ) { Alert( "Clock V1_2: DLLs are disabled. To enable tick the checkbox in the Common Tab of indicator" ); return; } int counted_bars=IndicatorCounted(); //+------------------------------------------------------------------+ int TimeArray[4]; int TZInfoArray[43]; int nYear,nMonth,nDay,nHour,nMin,nSec,nMilliSec; string sMilliSec; //+------------------------------------------------------------------+ GetLocalTime(TimeArray); //---- parse date and time from array nYear=TimeArray[0]&0x0000FFFF; nMonth=TimeArray[0]>>16; nDay=TimeArray[1]>>16; nHour=TimeArray[2]&0x0000FFFF; nMin=TimeArray[2]>>16; nSec=TimeArray[3]&0x0000FFFF; nMilliSec=TimeArray[3]>>16; string LocalTimeS = FormatDateTime(nYear,nMonth,nDay,nHour,nMin,nSec); datetime localTime = StrToTime( LocalTimeS ); //+------------------------------------------------------------------+ int gmt_shift=0; int dst=GetTimeZoneInformation(TZInfoArray); if(dst!=0) gmt_shift=TZInfoArray[0]; //Print("Difference between your local time and GMT is: ",gmt_shift," minutes"); if(dst==2) gmt_shift+=TZInfoArray[42]; //+------------------------------------------------------------------+ datetime brokerTime = CurTime(); datetime GMT = localTime + gmt_shift * 60; datetime london = GMT + (LondonTZ + (dst - 1)) * 3600; datetime tokyo = GMT + (TokyoTZ) * 3600; datetime newyork = GMT + (NewYorkTZ + (dst - 1)) * 3600; datetime sydney = GMT + (SydneyTZ + (dst - 1)) * 3600; datetime zurich = GMT + (ZurichTZ + (dst - 1)) * 3600; //+------------------------------------------------------------------+ //Print( brokerTime, " ", GMT, " ", local, " ", london, " ", tokyo, " ", newyork ); string zurichs = TimeToString( zurich ); string locals = TimeToString( localTime ); string londons = TimeToString( london ); string tokyos = TimeToString( tokyo ); string newyorks = TimeToString( newyork ); string sydneys = TimeToString( sydney ); string bars = TimeToStr( CurTime() - Time[0], TIME_MINUTES ); //+------------------------------------------------------------------+ ObjectSetText( "zurl", "Zurich", 11, "Arial Bold", labelColor ); ObjectSetText( "zurt", zurichs, 11, "Euro Ext Bold", clockColor ); ObjectSetText( "nyl", "New York", 11, "Arial Bold", labelColor ); ObjectSetText( "nyt", newyorks, 11, "Euro Ext Bold", clockColor ); ObjectSetText( "lonl", "London", 11, "Arial Bold", labelColor ); ObjectSetText( "lont", londons, 11, "Euro Ext Bold", clockColor ); ObjectSetText( "sydl", "Sydney", 11, "Arial Bold", labelColor ); ObjectSetText( "sydt", sydneys, 11, "Euro Ext Bold", clockColor ); ObjectSetText( "tokl", "Tokyo", 11, "Arial Bold", labelColor ); ObjectSetText( "tokt", tokyos, 11, "Euro Ext Bold", clockColor ); //---- return(0); } //+------------------------------------------------------------------+ int ObjectMakeLabel( string n, int xoff, int yoff ) { ObjectCreate( n, OBJ_LABEL, 0, 0, 0 ); ObjectSet( n, OBJPROP_CORNER, corner ); ObjectSet( n, OBJPROP_XDISTANCE, xoff ); ObjectSet( n, OBJPROP_YDISTANCE, yoff ); ObjectSet( n, OBJPROP_BACK, true ); } //+------------------------------------------------------------------+ string FormatDateTime(int nYear,int nMonth,int nDay,int nHour,int nMin,int nSec) { string sMonth,sDay,sHour,sMin,sSec; //+------------------------------------------------------------------+ sMonth=100+nMonth; sMonth=StringSubstr(sMonth,1); sDay=100+nDay; sDay=StringSubstr(sDay,1); sHour=100+nHour; sHour=StringSubstr(sHour,1); sMin=100+nMin; sMin=StringSubstr(sMin,1); sSec=100+nSec; sSec=StringSubstr(sSec,1); //+------------------------------------------------------------------+ return(StringConcatenate(nYear,".",sMonth,".",sDay," ",sHour,":",sMin,":",sSec)); } //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); int top=topOff; //+------------------------------------------------------------------+ ObjectMakeLabel( "zurl", left+705, top-120 ); ObjectMakeLabel( "zurt", left+700, top-105 ); ObjectMakeLabel( "lonl", left+588, top-120 ); ObjectMakeLabel( "lont", left+590, top-105 ); ObjectMakeLabel( "nyl", left+472, top-120 ); ObjectMakeLabel( "nyt", left+480, top-105 ); ObjectMakeLabel( "sydl", left+370, top-120 ); ObjectMakeLabel( "sydt", left+370, top-105 ); ObjectMakeLabel( "tokl", left+265, top-120 ); ObjectMakeLabel( "tokt", left+260, top-105 ); //+------------------------------------------------------------------+ return(0); } //+------------------------------------------------------------------+ int deinit() { //---- ObjectDelete( "zurl" ); ObjectDelete( "zurt" ); ObjectDelete( "nyl" ); ObjectDelete( "nyt" ); ObjectDelete( "lonl" ); ObjectDelete( "lont" ); ObjectDelete( "tokl" ); ObjectDelete( "tokt" ); ObjectDelete( "brol" ); ObjectDelete( "brot" ); ObjectDelete( "barl" ); ObjectDelete( "bart" ); ObjectDelete( "sydl" ); ObjectDelete( "sydt" ); //---- return(0); }
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Custom Indicators Used:
kernel32
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen