From de8fed8c2f685797e169324cd8b6899aece90c44 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 4 Jun 2019 17:29:47 +0200 Subject: [PATCH] Removing the concept of newStopLoss --- Commons.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Commons.js b/Commons.js index 1cf7da350..b68528d0e 100644 --- a/Commons.js +++ b/Commons.js @@ -111,7 +111,6 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { let anualizedRateOfReturn = 0; let type = '""'; let rate = 0; - let newStopLoss; /* In some cases we need to know if we are positioned at the last candle of the calendar day, for that we need thse variables. */ @@ -671,19 +670,13 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { let phase = strategy.stopLoss.phases[stopLossPhase - 1]; try { - eval(phase.code); // Here is where we apply the formula given for the stop loss for this phase. + stopLoss = eval(phase.code); // Here is where we apply the formula given for the stop loss for this phase. } catch (err) { /* If the code produces an exception, we are covered. */ } - if (newStopLoss < previousStopLoss) { - stopLoss = newStopLoss; - } else { - stopLoss = previousStopLoss; - } - if (stopLoss < MIN_STOP_LOSS_VALUE) { stopLoss = MIN_STOP_LOSS_VALUE } @@ -734,7 +727,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { let phase = strategy.takeProfit.phases[takeProfitPhase - 1]; try { - eval(phase.code); // Here is where we apply the formula given for the buy order at this phase. + takeProfit = eval(phase.code); // Here is where we apply the formula given for the buy order at this phase. } catch (err) { /* If the code produces an exception, we are covered.