From 426e5e613ef9a457be59af7024343f0bf34e4ef4 Mon Sep 17 00:00:00 2001 From: Paulovms Date: Sat, 27 Jan 2018 11:43:20 -0200 Subject: [PATCH 1/5] Update TSI.js --- strategies/TSI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strategies/TSI.js b/strategies/TSI.js index 6089bb0cc..7f4cd64af 100644 --- a/strategies/TSI.js +++ b/strategies/TSI.js @@ -30,7 +30,7 @@ method.log = function(candle) { var digits = 8; var tsi = this.indicators.tsi; - log.debug('calculated Ultimate Oscillator properties for candle:'); + log.debug('calculated TSI properties for candle:'); log.debug('\t', 'tsi:', tsi.tsi.toFixed(digits)); log.debug('\t', 'price:', candle.close.toFixed(digits)); } From e0e27e86a91cf6bd9e3d85014ee3d3cbca0a85f7 Mon Sep 17 00:00:00 2001 From: Paulovms Date: Sat, 27 Jan 2018 11:49:17 -0200 Subject: [PATCH 2/5] Update varPPO.js --- strategies/varPPO.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/strategies/varPPO.js b/strategies/varPPO.js index 4bcb479e8..a4b762754 100644 --- a/strategies/varPPO.js +++ b/strategies/varPPO.js @@ -37,10 +37,10 @@ method.update = function(candle) { // calculated parameters. method.log = function(candle) { var digits = 8; - var ppo = this.indicators.ppo; + var ppo = this.indicators.ppo.result; var result = ppo.ppo; - var signal = ppo.PPOsignal.result; - var hist = result - signal; + var signal = ppo.ppo.PPOsignal; + var hist = ppo.PPOhist; var momentumResult = this.indicators[momentumName][momentumName]; log.debug('\t', 'PPO:', result.toFixed(digits)); @@ -51,10 +51,8 @@ method.log = function(candle) { } method.check = function() { - var ppo = this.indicators.ppo; - var result = ppo.ppo; - var signal = ppo.PPOsignal.result; - var hist = result - signal; + var ppo = this.indicators.ppo.result; + var hist = ppo.PPOhist; var value = this.indicators[momentumName][momentumName]; From 4bc2e0d52445c5db1579c6f11c8b9cce2e0d37f8 Mon Sep 17 00:00:00 2001 From: Paulovms Date: Sat, 27 Jan 2018 12:36:29 -0200 Subject: [PATCH 3/5] Update TSI.js --- strategies/indicators/TSI.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/strategies/indicators/TSI.js b/strategies/indicators/TSI.js index 2e4973250..9cf8ee5d7 100644 --- a/strategies/indicators/TSI.js +++ b/strategies/indicators/TSI.js @@ -3,7 +3,7 @@ var EMA = require('./EMA.js'); var Indicator = function(settings) { this.input = 'candle'; - this.lastClose = 0; + this.lastClose = null; this.tsi = 0; this.inner = new EMA(settings.long); this.outer = new EMA(settings.short); @@ -14,6 +14,14 @@ var Indicator = function(settings) { Indicator.prototype.update = function(candle) { var close = candle.close; var prevClose = this.lastClose; + + if (prevClose === null) { + // Set initial price to prevent invalid change calculation + this.lastClose = close; + // Do not calculate TSI on first close + return; + } + var momentum = close - prevClose; this.inner.update(momentum); From 55a255a3ada52c244c21f3ba6687e37078e1c67e Mon Sep 17 00:00:00 2001 From: Paulovms Date: Sat, 27 Jan 2018 12:42:29 -0200 Subject: [PATCH 4/5] Update varPPO.js --- strategies/varPPO.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strategies/varPPO.js b/strategies/varPPO.js index a4b762754..3cd2536cf 100644 --- a/strategies/varPPO.js +++ b/strategies/varPPO.js @@ -39,7 +39,7 @@ method.log = function(candle) { var digits = 8; var ppo = this.indicators.ppo.result; var result = ppo.ppo; - var signal = ppo.ppo.PPOsignal; + var signal = ppo.PPOsignal; var hist = ppo.PPOhist; var momentumResult = this.indicators[momentumName][momentumName]; From 230ac36b6efb3f99248bc2758ca4941f349bba69 Mon Sep 17 00:00:00 2001 From: Paulovms Date: Sat, 27 Jan 2018 19:47:06 -0200 Subject: [PATCH 5/5] Update recoverable errors --- exchanges/bitfinex.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exchanges/bitfinex.js b/exchanges/bitfinex.js index 633d45ef8..fe4637f74 100644 --- a/exchanges/bitfinex.js +++ b/exchanges/bitfinex.js @@ -39,7 +39,7 @@ var retryForever = { }; // Probably we need to update these string -var recoverableErrors = new RegExp(/(SOCKETTIMEDOUT|TIMEDOUT|CONNRESET|CONNREFUSED|NOTFOUND|StatusCodeError: 429|StatusCodeError: 5)/) +var recoverableErrors = new RegExp(/(SOCKETTIMEDOUT|TIMEDOUT|CONNRESET|CONNREFUSED|NOTFOUND|429|443|5\d\d)/g); Trader.prototype.processError = function(funcName, error) { if (!error) return undefined;