From 1908ab39ce46c355b434c1b533af37b543fdf6d4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 4 Jun 2019 17:20:09 +0200 Subject: [PATCH] Getting the Trading System early on --- Commons.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Commons.js b/Commons.js index 6a8c92928..dc03865af 100644 --- a/Commons.js +++ b/Commons.js @@ -71,6 +71,8 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> Entering function."); } + tradingSystem.strategies = await getStrategies(); + /* Initial Values */ let initialDate = startDate; @@ -85,7 +87,6 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { /* Stop Loss Management */ const MIN_STOP_LOSS_VALUE = 1 // We can not let the stop be zero to avoid division by 0 error or infinity numbers as a result. - let stopLossPercentage = 50; let previousStopLoss = 0; let stopLoss = 0; let stopLossPhase = 0; @@ -251,8 +252,6 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { yesterday.anualizedRateOfReturn = anualizedRateOfReturn; } - - tradingSystem.strategies = await getStrategies(); /* Main Simulation Loop: We go thourgh all the candles at this time period. */ @@ -756,7 +755,7 @@ exports.newCommons = function newCommons(bot, logger, UTILITIES) { sellRate = rate; sellAmount = balanceAssetA; - stopLoss = sellRate + sellRate * stopLossPercentage / 100; + stopLoss = sellRate + sellRate * 1 / 100; previousStopLoss = stopLoss; checkStopLoss();