-
Notifications
You must be signed in to change notification settings - Fork 0
/
FiboTime.mq4
83 lines (70 loc) · 3.02 KB
/
FiboTime.mq4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//+------------------------------------------------------------------+
//| XIT_FIBS.mq4 |
//| Copyright ?2011, Jeff West - Forex-XIT |
//| http://www.forex-xit.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2011, Jeff West - Forex-XIT"
#property link "http://www.forex-xit.com"
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
ObjectDelete("XIT_FIBOTIME");
Comment("");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete("XIT_FIBOTIME");
Comment("");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int fibHigh = iHighest(Symbol(),Period(),MODE_HIGH,WindowFirstVisibleBar()-1,1);
int fibLow = iLowest(Symbol(),Period(),MODE_LOW,WindowFirstVisibleBar()-1,1);
datetime highTime = Time[fibHigh];
datetime lowTime = Time[fibLow];
if(fibHigh>fibLow){
WindowRedraw();
//ObjectCreate("XIT_FIBO",OBJ_FIBO,0,highTime,High[fibHigh],lowTime,Low[fibLow]);
ObjectCreate("XIT_FIBOTIME",OBJ_FIBOTIMES,0,highTime,High[fibHigh],lowTime,Low[fibLow]);
color levelColor = Red;
}
else{
WindowRedraw();
//ObjectCreate("XIT_FIBO",OBJ_FIBO,0,lowTime,Low[fibLow],highTime,High[fibHigh]);
ObjectCreate("XIT_FIBOTIME",OBJ_FIBOTIMES,0,lowTime,Low[fibLow],highTime,High[fibHigh]);
levelColor = Yellow;
}
ObjectSet("XIT_FIBOTIME",OBJPROP_FIBOLEVELS,5);
ObjectSet("XIT_FIBOTIME",OBJPROP_FIRSTLEVEL+0,0.0);
ObjectSet("XIT_FIBOTIME",OBJPROP_FIRSTLEVEL+1,1.0);
ObjectSet("XIT_FIBOTIME",OBJPROP_FIRSTLEVEL+2,1.618);
ObjectSet("XIT_FIBOTIME",OBJPROP_FIRSTLEVEL+3,2.618);
ObjectSet("XIT_FIBOTIME",OBJPROP_FIRSTLEVEL+4,4.618);
ObjectSet("XIT_FIBOTIME",OBJPROP_LEVELCOLOR,levelColor);
ObjectSet("XIT_FIBOTIME",OBJPROP_LEVELWIDTH,1);
ObjectSet("XIT_FIBOTIME",OBJPROP_LEVELSTYLE,STYLE_DASHDOTDOT);
ObjectSetFiboDescription( "XIT_FIBOTIME", 0,"0");
ObjectSetFiboDescription( "XIT_FIBOTIME", 1,"1");
ObjectSetFiboDescription( "XIT_FIBOTIME", 2,"1.618");
ObjectSetFiboDescription( "XIT_FIBOTIME", 3,"2.618");
ObjectSetFiboDescription( "XIT_FIBOTIME", 4,"4.618");
//----
return(0);
}
//+------------------------------------------------------------------+