-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMath.mqh
60 lines (55 loc) · 2.21 KB
/
Math.mqh
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
//+------------------------------------------------------------------+
//| Math.mqh |
//| Copyright 2021, Homma.tech |
//| https://www.homma.tech |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, Homma.tech"
#property link "https://www.homma.tech"
#include <MovingAverages.mqh>
#include "NewTypes.mqh"
class CMath {
private:
public:
CMath();
~CMath();
void MACalculator(double &maBuffer_dest[],
double &values[],
int period,
ENUM_MA_METHOD ma_method = MODE_SMA,
int ma_shift = 0);
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
CMath::CMath() {
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
CMath::~CMath() {
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void CMath :: MACalculator(double &maBuffer_dest[],
double &values[],
int period,
ENUM_MA_METHOD ma_method = MODE_SMA,
int ma_shift = 0) {
int retorno;
switch (ma_method) {
case MODE_SMA:
SimpleMAOnBuffer(ArraySize(values), 0, 0, period, values, maBuffer_dest);
break;
case MODE_EMA:
ExponentialMAOnBuffer(ArraySize(values), 0, 0, period, values, maBuffer_dest);
break;
case MODE_SMMA:
SmoothedMAOnBuffer(ArraySize(values), 0, 0, period, values, maBuffer_dest);
break;
case MODE_LWMA:
LinearWeightedMAOnBuffer(ArraySize(values), 0, 0, period, values, maBuffer_dest, retorno);
break;
}
}
//+------------------------------------------------------------------+