-
Notifications
You must be signed in to change notification settings - Fork 2
/
X_profile.mq4
88 lines (76 loc) · 2.62 KB
/
X_profile.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
84
85
86
87
88
//+------------------------------------------------------------------+
//| X_profile.mq4 |
//| Copyright © 2005, Trading Studio. |
//| http://www.bluechips.it |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Trading Studio."
#property link "http://www.bluechips.it"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_color3 Green
#property indicator_color4 Yellow
#property indicator_color5 Green
double buffer1[];
double buffer2[];
double buffer3[];
double buffer4[];
double buffer5[];
double parziale;
extern datetime DataInizio=D'2005.08.01 04:30';
//+------------------------------------------------------------------+
//| inizializzazione |
//+------------------------------------------------------------------+
int init()
{
Print("sei nell_indicatore");
//---- settaggio indicatore
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,buffer1);
SetIndexBuffer(1,buffer2);
SetIndexBuffer(2,buffer3);
SetIndexBuffer(3,buffer4);
SetIndexBuffer(4,buffer5);
IndicatorShortName("31Prova3");
if(!SetIndexBuffer(0,buffer1) && !SetIndexBuffer(1,buffer2) && !SetIndexBuffer(2,buffer3) && !SetIndexBuffer(3,buffer4) && !SetIndexBuffer(4,buffer5))
Print("buffer non settato");
//----
return(0);
}
//+------------------------------------------------------------------+
//| deinizializzazione
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| iterazione
//+------------------------------------------------------------------+
int start()
{
double array_price[][6];
int cont;
double deviazione;
ArrayInitialize(array_price,0);
ArrayCopyRates(array_price,(Symbol()));
for (int j = Bars-1; j >= 0; j--) {
if (Time[j]>=DataInizio) {
for (int i = j; i >= 0; i--)
{
cont++;
parziale=parziale+array_price[i][4];
buffer1[i]=parziale/cont;
deviazione=iStdDev(NULL,0,cont,MODE_SMA,0,PRICE_CLOSE,0);
buffer2[i]=buffer1[i]+deviazione;
buffer3[i]=buffer1[i]+(2*deviazione);
buffer4[i]=buffer1[i]-deviazione;
buffer5[i]=buffer1[i]-(2*deviazione);
}
break;
}
}
return(0);
}
//+------------------------------------------------------------------+