Removing the concept of newStopLoss

This commit is contained in:
Luis Fernando Molina committed 2019-06-04 17:29:47 +02:00
1 parent a7205d6c2f
commit de8fed8c2f
1 file changed
+2 -9
+2 -9
View File
@@ -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.