/*+------------------------------------------------------------------+ | 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); }
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Implements a curve of type DRAW_ARROW
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: