-
Notifications
You must be signed in to change notification settings - Fork 2
/
SymbolInfo.mqh
38 lines (33 loc) · 2.86 KB
/
SymbolInfo.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
//+------------------------------------------------------------------+
//| SymbolInfo.mqh |
//| Copyright 2021, Homma.tech |
//| https://www.homma.tech |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, Homma.tech"
#property link "https://www.homma.tech"
class CSymbolInfo {
private:
long sumTimeOnOperation;
public:
CSymbolInfo :: CSymbolInfo();
long CSymbolInfo :: TimeOnOperation();
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
CSymbolInfo :: CSymbolInfo() {
sumTimeOnOperation = 0;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
long CSymbolInfo :: TimeOnOperation() {
long openTime, currentTime;
if(PositionSelect(_Symbol)) {
openTime = PositionGetInteger(POSITION_TIME);
currentTime = TimeCurrent();
sumTimeOnOperation = (currentTime - openTime);
}
return sumTimeOnOperation;
}
//+------------------------------------------------------------------+