-
Notifications
You must be signed in to change notification settings - Fork 2
/
PythonNumpyMean.mq4
53 lines (47 loc) · 2.84 KB
/
PythonNumpyMean.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
#import "PythonNumpyMean.dll"
double GetNumpyMean(double &value[], int arraysize, int period, int index);
#import
//パラメータ
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
extern int MaPeriod = 120;
double Buf0[];
//--------------------------------------------------------------------
// expert initialization function
//--------------------------------------------------------------------
int init()
{
//--------------------------------------------------------------------
// コメント表示
//--------------------------------------------------------------------
SetIndexBuffer(0, Buf0);
return(0);
}
//+-------------------------------------------------------------------
//| expert deinitialization function
//+-------------------------------------------------------------------
int deinit()
{
return(0);
}
//+-------------------------------------------------------------------
//| expert start function
//+-------------------------------------------------------------------
int start()
{
double close[];
int size = ArrayCopySeries(close, MODE_CLOSE);
double test[];
if(size <= 0){
Print("no size.");
return(0);
}
ArrayResize(test, size);
ArrayCopy(test, close);
int limit = Bars;
for(int i=limit-1000; i>=0; i--){
Buf0[i] = GetNumpyMean(test, size, MaPeriod, i);
}
return(0);
}