-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrule.js
More file actions
34 lines (29 loc) · 777 Bytes
/
rule.js
File metadata and controls
34 lines (29 loc) · 777 Bytes
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
class Rule {
constructor(indicator1, indicator2, comparator) {
this.indicator1 = indicator1;
this.indicator2 = indicator2;
this.comparator = comparator;
}
update(currentCandle) {
this.indicator1.update(currentCandle);
this.indicator2.update(currentCandle);
return;
}
initialize(initialHistory) {
this.indicator1.initialize(initialHistory);
this.indicator2.initialize(initialHistory);
this.comparator.initialize();
return;
}
reset()
{
this.indicator1.reset();
this.indicator2.reset();
this.comparator.reset();
return;
}
checkConditions() {
return this.comparator.checkConditions();
}
}
module.exports = Rule;