-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_fatwick.mq4
82 lines (71 loc) · 2.45 KB
/
_fatwick.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
//+------------------------------------------------------------------+
//| FatWick.mq4 |
//| Copyright © 2016, Harry Gui |
//| http://www.AcornInvesting.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, Harry Gui, AcornInvesting.com"
#property link "http://www.AcornInvesting.com"
#property version "1.0"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_width1 2
#property indicator_width2 1
#property indicator_color1 Black
#property indicator_color2 Black
double _aCloudPaintLow[],_aCloudPaintHigh[];
extern int MaxBarsForCalculation = 1200; //Max Bars For Calculation
static datetime PREVTIME;// = 0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int deinit() { /*ObjectsDeleteAll();*/ return(0); }
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0,_aCloudPaintLow);
SetIndexBuffer(1,_aCloudPaintHigh);
SetIndexLabel(0,"Low");
SetIndexLabel(1,"High");
SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,indicator_width1);
SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,indicator_width2);
return(0);
}
int start()
{
int __countedBars = IndicatorCounted(), __limit, __bar;
if(__countedBars > 0) __countedBars--;
__limit = Bars - __countedBars;
for(__bar = 0; __bar < __limit; __bar++)
{
_drawSingleBar(__bar);
}
/*if(PREVTIME == Time[0])
{
_drawSingleBar(0);
return(0);
}
else
{
for(int __bar=0; __bar<_getCountBars(); __bar++)
{
_drawSingleBar(__bar);
}
}
PREVTIME = Time[0];*/
return(0);
}
void _drawSingleBar(int __bar)
{
_aCloudPaintLow[__bar] = High[__bar];
_aCloudPaintHigh[__bar] = Low[__bar];
}
int _getCountBars()
{
int __countBars;
if(MaxBarsForCalculation) __countBars = MaxBarsForCalculation;
else __countBars = iBars(NULL, PERIOD_CURRENT) - 26;
return __countBars;
}