From f475c7eb1af0eeb46160a39d7659455456fe4db0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 25 Feb 2019 03:05:05 +0100 Subject: [PATCH] sellRate to plotter --- Multi-Period-Market/User.Bot.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Multi-Period-Market/User.Bot.js b/Multi-Period-Market/User.Bot.js index 1b4e40220..8b60b9b1b 100644 --- a/Multi-Period-Market/User.Bot.js +++ b/Multi-Period-Market/User.Bot.js @@ -377,7 +377,7 @@ let trailingStop = false; let stopLoss = 0; let stopLossDecay = 0; - let stopLossDecayIncrement = 0.05; + let stopLossDecayIncrement = 0.06; let initialBalanceA = 1; let record; @@ -543,7 +543,8 @@ } /* Not a buy or sell condition */ - + + rate = candle.close; addRecord(); function addRecord() { @@ -566,14 +567,20 @@ ROI: ROI, periods: periods, days: days, - anualizedRateOfReturn: anualizedRateOfReturn + anualizedRateOfReturn: anualizedRateOfReturn, + sellRate: sellRate } recordsArray.push(record); previousStopLoss = stopLoss; - stopLossDecay = stopLossDecay + stopLossDecayIncrement; + if (bollingerBandsMap.get(candles[i - 1].begin).movingAverage < band.movingAverage) { + stopLossDecay = stopLossDecay + stopLossDecayIncrement * 2; + } else { + stopLossDecay = stopLossDecay - stopLossDecayIncrement / 2; + } + type = '""'; } @@ -620,7 +627,8 @@ record.ROI + "," + record.periods + "," + record.days + "," + - record.anualizedRateOfReturn + "]"; + record.anualizedRateOfReturn + "," + + record.sellRate + "]"; if (separator === "") { separator = ","; }