-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHILOactivator.js
41 lines (33 loc) · 1.13 KB
/
HILOactivator.js
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
var log = require('../core/log');
var hilo = {}
hilo.init = function (){
this.name='HILO';
this.input = 'candle';
this.requiredHistory = 5;
this.period = 20;
this.addIndicator('hilo', 'HILO', this.period);
}
hilo.log = function(candle){
var hilo = this.indicators.hilo;
if (candle.close > this.indicators.hilo.hi){
log.debug('Action COMPRADO - Age:' + this.age + '|Price: ' + this.candle.close + '|High:' + candle.high + '|Low:' + candle.low + '| Hi:' + this.indicators.hilo.hi + '|Lo:' + this.indicators.hilo.lo )
return;
} else if (candle.close < this.indicators.hilo.lo) {
log.debug('Action VENDIDO - Age:' + this.age + '|Price: ' + this.candle.close + '|High:' + candle.high + '|Low:' + candle.low + '| Hi:' + this.indicators.hilo.hi + '|Lo:' + this.indicators.hilo.lo )
return;
} else {
return;
}
}
hilo.check = function(candle){
if (candle.close > this.indicators.hilo.hi){
this.advice("long")
return;
} else if (candle.close < this.indicators.hilo.lo) {
this.advice("short")
return;
} else {
return;
}
}
module.exports = hilo;