From 27eb3665cb9294b18e05991a98e9284f5481c550 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 5 Mar 2019 15:15:12 +0100 Subject: [PATCH] Strategy 2 Signal to Sell --- Multi-Period-Market/User.Bot.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Multi-Period-Market/User.Bot.js b/Multi-Period-Market/User.Bot.js index c39bfab94..f4a9acefc 100644 --- a/Multi-Period-Market/User.Bot.js +++ b/Multi-Period-Market/User.Bot.js @@ -747,8 +747,6 @@ let rate = 0; let newStopLoss; - let presellModeIsActive = false; - let initialBuffer = 3; /* Main Simulation Loop: We go thourgh all the candles at this time period. */ @@ -819,7 +817,7 @@ if (strategyPhase < 4) { // A buy condition has not been detected. - if (strategy === 1) { + if (strategy === 2) { /* Strategy #1: Trend Following. */ @@ -850,7 +848,6 @@ if ( strategyPhase === 1 && - presellModeIsActive === true && band2.movingAverage > band1.movingAverage && band1.movingAverage > band.movingAverage ) { @@ -884,11 +881,9 @@ if ( strategyPhase === 0 && percentgeBandwidth.value >= 70 && - (percentgeBandwidth1.movingAverage > percentgeBandwidth.movingAverage) && - presellModeIsActive === false + (percentgeBandwidth1.movingAverage > percentgeBandwidth.movingAverage) ) { signal = '"Pre-Sell"'; - presellModeIsActive = true; strategyPhase = 1; }; @@ -1020,7 +1015,6 @@ stopLoss = sellRate + sellRate * stopLossPercentage / 100; - presellModeIsActive = false; stopLossDecay = 0; addRecord(); @@ -1046,7 +1040,23 @@ let subChannel = getElement(bollingerSubChannelsArray, candle.begin, candle.end); + /* Signal to be ready to Sell */ + + if ( + strategyPhase === 0 && + subChannel.direction === 'Up' && + ( + subChannel.slope === 'Side' || + subChannel.slope === 'Gentle' || + subChannel.slope === 'Medium' + ) + ) { + + signal = '"Pre-Sell"'; + strategyPhase = 1; + + } } }