From b35e78d74791b5725bd4d0babe1ffb7fa3d6d015 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 23 Aug 2019 08:42:07 +0200 Subject: [PATCH] Bug Fixes: slippage at take profit and strategies at yesterday --- Commons.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Commons.js b/Commons.js index 87f553b61..50cf1e38a 100644 --- a/Commons.js +++ b/Commons.js @@ -1682,9 +1682,9 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { let slippageAmount = slippedTakeProfit * slippage.takeProfit / 100 if (baseAsset === 'BTC') { - slippedTakeProfit = slippedTakeProfit - slippageAmount - } else { slippedTakeProfit = slippedTakeProfit + slippageAmount + } else { + slippedTakeProfit = slippedTakeProfit - slippageAmount } let finalTakeProfit = slippedTakeProfit; @@ -2276,8 +2276,6 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { if (processingDailyFiles) { if (positionedAtYesterday) { - yesterday.currentStrategyIndex = currentStrategyIndex; - yesterday.strategyStage = strategyStage; yesterday.stopLossStage = stopLossStage; yesterday.takeProfitStage = takeProfitStage; yesterday.stopLossPhase = stopLossPhase; @@ -2312,6 +2310,14 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { currentStrategyIndex = -1; strategyStage = 'No Stage'; + + if (processingDailyFiles) { + if (positionedAtYesterday) { + yesterday.currentStrategyIndex = currentStrategyIndex; + yesterday.strategyStage = strategyStage; + } + } + timerToCloseStage = 0 if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> loop -> Closing the Closing Stage -> Exiting Close Stage."); } @@ -2525,6 +2531,12 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { strategiesArray.push(currentStrategy); + if (currentStrategy.begin < currentStrategy.end) { + console.log("ES MENOR:" + i) + } else { + console.log("ES MAYOR:" + i) + } + currentStrategy = { begin: 0, end: 0,