[MT4指标]ParamonWorkTime工作时间指标
主图指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| i-ParamonWorkTime.mq4 |
//| 疏? 茹铕? ?. aka KimIV |
//| http://www.kimiv.ru |
//| |
//| 23.11.2005 软滂赅蝾? 疣犷麇泐 怵屐屙? 相疣祛磬. |
//+------------------------------------------------------------------+
#property copyright "疏? 茹铕? ?. aka KimIV"
#property link "http://www.kimiv.ru"
#property indicator_chart_window
//------- 马屮龛? 镟疣戾蝠? 桧滂赅蝾疣 -------------------------------
extern int NumberOfDays = 100; // 暑腓麇耱忸 漤彘
extern string Begin_1 = "10:00"; // London open
extern string End_1 = "15:00"; // New York open
extern color Color_1 = Indigo;
extern string Begin_2 = "15:00"; // New York open and London session overlap starts
extern string End_2 = "19:00"; // London close
extern color Color_2 = Navy;
extern string Begin_3 = "19:00"; // London close
extern string End_3 = "23:00"; // New York close
extern color Color_3 = DarkSlateGray;
extern bool HighRange = False;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init() {
DeleteObjects();
for (int i=0; i5) dt=decDateTradeDay(dt);
}
}
//+------------------------------------------------------------------+
//| 橡铕桉钼赅 钺 牝钼 磬 沭圄桕? |
//| 相疣戾蝠?: |
//| dt - 溧蜞 蝾疸钼钽? 漤? |
//| no - 磬桁屙钼囗桢 钺 牝? |
//| tb - 怵屐? 磬鬣豚 皴耨梃 |
//| te - 怵屐? 铌铐鬣龛? 皴耨梃 |
//+------------------------------------------------------------------+
void DrawObjects(datetime dt, string no, string tb, string te) {
datetime t1, t2;
double p1, p2;
int b1, b2;
t1=StrToTime(TimeToStr(dt, TIME_DATE)+" "+tb);
t2=StrToTime(TimeToStr(dt, TIME_DATE)+" "+te);
b1=iBarShift(NULL, 0, t1);
b2=iBarShift(NULL, 0, t2);
p1=High[Highest(NULL, 0, MODE_HIGH, b1-b2, b2)];
p2=Low [Lowest (NULL, 0, MODE_LOW , b1-b2, b2)];
if (!HighRange) {p1=0; p2=2*p2;}
ObjectSet(no, OBJPROP_TIME1 , t1);
ObjectSet(no, OBJPROP_PRICE1, p1);
ObjectSet(no, OBJPROP_TIME2 , t2);
ObjectSet(no, OBJPROP_PRICE2, p2);
}
//+------------------------------------------------------------------+
//| 屿屙 屙桢 溧螓 磬 钿桧 蝾疸钼 溴睃 |
//| 相疣戾蝠?: |
//| dt - 溧蜞 蝾疸钼钽? 漤? |
//+------------------------------------------------------------------+
datetime decDateTradeDay (datetime dt) {
int ty=TimeYear(dt);
int tm=TimeMonth(dt);
int td=TimeDay(dt);
int th=TimeHour(dt);
int ti=TimeMinute(dt);
td--;
if (td==0) {
tm--;
if (tm==0) {
ty--;
tm=12;
}
if (tm==1 || tm==3 || tm==5 || tm==7 || tm==8 || tm==10 || tm==12) td=31;
if (tm==2) if (MathMod(ty, 4)==0) td=29; else td=28;
if (tm==4 || tm==6 || tm==9 || tm==11) td=30;
}
return(StrToTime(ty+"."+tm+"."+td+" "+th+":"+ti));
}
//+------------------------------------------------------------------+
i_ParamonWorkTime.jpg

发表于:2017-08-11 09:32只看该作者
2楼
阅尽天下指标
韬客社区www.talkfx.co