From fd0ebcddb904aa37e5cf6cef2fb0e8dc6e3ebe14 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:46:22 +0100 Subject: [PATCH] candle.begin >= leftDate.valueOf --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 18 +++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index ae48bd12e34c594e2b3c6bc7f6fd25e24c6ac422..e617a614379215605f5ef57506cce3c7296cdd84 100644 GIT binary patch delta 105 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPxh&^f)dM#dGW}*| mHL%>H1Z1*pu#lVrQVs>{foxtNn+J%QCkr~ZZ9ZV{zytu>(HATL delta 144 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{Ot~y}mtXpCE@b-6 z%$ksElpe6TkZps7-VDG@R$xe|`auUc?C|Cz%I{?|J F$^Z!^9tr>e diff --git a/Candlestick.js b/Candlestick.js index 3c93dc9f0..203270f37 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -344,11 +344,8 @@ let daysOnSides = getSideDays(timePeriod); - let leftDate; - let rightDate; - - leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); - rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); leftDate.setDate(leftDate.getDate() - daysOnSides); rightDate.setDate(rightDate.getDate() + daysOnSides); @@ -404,7 +401,10 @@ function recalculateCandlesUsingMarketFiles() { - if (marketFile === undefined) { return;} // Initialization not complete yet. + if (marketFile === undefined) { return; } // Initialization not complete yet. + + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); candles = []; @@ -425,7 +425,11 @@ if (candle.open < candle.close) { candle.direction = 'up'; } if (candle.open === candle.close) { candle.direction = 'side'; } - candles.push(candle); + if (candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) { + + candles.push(candle); + + } } console.log("Olivia > recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length);