From 6dd479c7d281cc3074a2299670ed25fbe03edf12 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 19 Feb 2018 19:10:19 +0100 Subject: [PATCH 001/176] Initial commit --- .gitattributes | 2 + .vs/AAOlivia-Plotter/v15/.suo | Bin 0 -> 16896 bytes AAOlivia-Plotter.njsproj | 67 ++++ AAOlivia-Plotter.sln | 25 ++ Candlestick.js | 641 ++++++++++++++++++++++++++++++++++ README.md | 1 + 6 files changed, 736 insertions(+) create mode 100644 .gitattributes create mode 100644 .vs/AAOlivia-Plotter/v15/.suo create mode 100644 AAOlivia-Plotter.njsproj create mode 100644 AAOlivia-Plotter.sln create mode 100644 Candlestick.js create mode 100644 README.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..dfe077042 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo new file mode 100644 index 0000000000000000000000000000000000000000..8e3523b2073c81d39dbb8b947ce4d3dab3877f09 GIT binary patch literal 16896 zcmeHNO>7%Q6dv~n+VazuLMf#{T0$w%HFoVd*+f7cyQZK=K0sVd+&e!{lVWw9la~IiU%t@#bd7akgG2C2(cHx+4f*%Wrep`N3~0vNCM|X z5udW?5vRl)t|f7uQ>jh+#rD-Xf8OV*J>M>T`OWR$LNB1-$)}voXMtE0GvWiFPoZ{7 zT=RKL?d|7m^N>Xj#j5mccIg#cR>x01n)P$H zKaC&vD#kP_7JyO^d5oWB+J&4(OUeCUgF5i#__yGmE`Ah!Kdrp$8C?H$3$Tqk?SCKM z^DN49DEmETKsNc-Q8IrXAFU;O5z zZkzn?MxhM5HmoGLIj_T5@rq(rT)}Er!c}+O!_-SU1kIx=Qx_-!r`7xWRop&S=`sdf z8@Ok%*4bDI&x^})4K9lbxiZ?`uM%AUwxSPpR2TmU`ck(^7l1k@Wl#{8aJ>c&xc)DK zp9$a9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*{iwFR`P%9Kb5-j4?6$HwX~K0Ke+9$x=ZQi|9E27M*c6vd=~$M zqC5Xy`M-AZKg3l8HhhU|kBYz6&OdW5Hg>h${Ex37D;<>VdDVSJ^{bb^ibt7))y@Ah z??au^#b>gJEUa#_LTk9dy9^T&|5 z6-p0A@VOB&6T`8-WZK9KBr-<4f7mpVrkOD!@l?``#mxS6a$tEWnH(+T7xOveY@t{# zTcz;aj6Gi}&Mc({v*Wf^va@Fv@^;oPE|ey$Y{{B0+S&SNvZ>tMWWln_`H9)^jJ>pU zBN|Uf`^`ku$eikn8u3ItZJ5z$)JVmXnP@cKpEk|pGW{Q&A1QxwGx43?Jj^~_J2!*v zPiqH{9?w}P`g4g(5yOhb`;7RBfdRuzOimenR&FY0#w{zBFvF2ZG!aiMISNtzJ|IHs ol(gC?YYdthL_Y%bu=A&s(BiuNd&q0ub^@4Ar(m<^Z#y0Tf4UWJ+W-In literal 0 HcmV?d00001 diff --git a/AAOlivia-Plotter.njsproj b/AAOlivia-Plotter.njsproj new file mode 100644 index 000000000..5520c0b58 --- /dev/null +++ b/AAOlivia-Plotter.njsproj @@ -0,0 +1,67 @@ + + + + Debug + 2.0 + {096b35ad-f86f-47b9-a99f-04ca93397da8} + + ShowAllFiles + Candlestick.js + . + . + {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + + + + + + + + + + + False + True + 0 + / + http://localhost:48022/ + False + True + http://localhost:1337 + False + + + + + + + CurrentPage + True + False + False + False + + + + + + + + + False + False + + + + + \ No newline at end of file diff --git a/AAOlivia-Plotter.sln b/AAOlivia-Plotter.sln new file mode 100644 index 000000000..1fefd2de9 --- /dev/null +++ b/AAOlivia-Plotter.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2027 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "AAOlivia-Plotter", "AAOlivia-Plotter.njsproj", "{096B35AD-F86F-47B9-A99F-04CA93397DA8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {096B35AD-F86F-47B9-A99F-04CA93397DA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {096B35AD-F86F-47B9-A99F-04CA93397DA8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {096B35AD-F86F-47B9-A99F-04CA93397DA8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {096B35AD-F86F-47B9-A99F-04CA93397DA8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E75EDC9D-66A7-4C54-8EA1-5ADC148CACA8} + EndGlobalSection +EndGlobal diff --git a/Candlestick.js b/Candlestick.js new file mode 100644 index 000000000..1e048889c --- /dev/null +++ b/Candlestick.js @@ -0,0 +1,641 @@ + +function newAAMastersAAOliviaCandlesticks() { + + var candles = []; // this changed. + let timePeriod = INITIAL_TIME_PERIOD; + + var plotArea = newPlotArea(); + + var datetime = INITIAL_DATE; + + var candlesticks = { + onLayerStatusChanged: onLayerStatusChanged, + currentCandle: undefined, + positionAtDatetime: positionAtDatetime, + setTimePeriod: setTimePeriod, + setDatetime: setDatetime, + container: undefined, + draw: draw, + getContainer: getContainer, + initialize: initialize + }; + + var container = newContainer(); + container.initialize(); + candlesticks.container = container; + + container.displacement.containerName = "AAMasters AAOlivia Candlesticks"; + container.zoom.containerName = "AAMasters AAOlivia Candlesticks"; + container.frame.containerName = "AAMasters AAOlivia Candlesticks"; + + let marketFile; + let dailyFilesCursor; + + let layerStatus = 'off'; + + let fileCache; + + return candlesticks; + + function initialize(pExchange, pMarket, pDatetime, pTimePeriod, chartLayersPanel) { + + datetime = pDatetime; + timePeriod = pTimePeriod; + + fileCache = newFileCache(); + fileCache.initialize("AAMasters", "AAOlivia", "Candles", "Candlesticks", pExchange, pMarket, pDatetime, onCacheInitialized); + + function onCacheInitialized() { + + marketFile = fileCache.getMarketFile(pTimePeriod, pDatetime); + + recalculateScale(); + + // From here old code... + + + //recalculateCandlesUsingDailyFiles(true); // We need the first day of candles so as to see which is going to be the center of the viewport. + + + // if (marketId === INITIAL_DEFAULT_MARKET) { // For now, lets position the view port at the market USDT/BTC + + // postitionViewPort(); + + // } + + recalculateCandles(); + + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); + } + } + + + + function getContainer(point) { + + if (layerStatus !== 'on') { return; } + + var container; + + /* First we check if this point is inside this space. */ + + if (this.container.frame.isThisPointHere(point) === true) { + + return this.container; + + } else { + + /* This point does not belong to this space. */ + + return undefined; + } + + } + + function onLayerStatusChanged(eventData) { + + if (eventData.layer === 'Olivia Candlesticks') { + layerStatus = eventData.status; + } + + } + + function onZoomChanged(event) { + + recalculateCandles(); + + } + + function onDragFinished() { + + if (timePeriod <= _1_HOUR_IN_MILISECONDS) { + + recalculateCandles(); + + } + } + + + function setTimePeriod(pTimePeriod) { + + timePeriod = period; + + if (timePeriod >= ONE_HOUR_IN_MILISECONDS) { + + marketFile = fileCache.getMarketFile(pTimePeriod, datetime); + + } else { + + dailyFilesCursor = fileCache.getFileCursor(pTimePeriod, datetime); + + } + + recalculateCandles(); + + } + + function setDatetime(newDatetime) { + + datetime = newDatetime; + recalculateCandles(); + } + + + function postitionViewPort() { + + try { + + let targetPoint = { + x: candles[Math.round(candles.length / 2)].begin, + y: candles[Math.round(candles.length / 2)].min + (candles[Math.round(candles.length / 2)].max - candles[Math.round(candles.length / 2)].min) + }; + + targetPoint = plotArea.inverseTransform(targetPoint, candlesticks.container.frame.height); + targetPoint = transformThisPoint(targetPoint, candlesticks.container); + + let displaceVector = { + x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.topLeft.x) / 2 - targetPoint.x, + y: (viewPort.visibleArea.bottomLeft.y - viewPort.visibleArea.topLeft.y) / 2 - targetPoint.y + }; + + viewPort.displace(displaceVector); + + } catch (err) { + + // if there data is missing of the days it must position in then an exception is raised. + } + + } + + + function positionAtDatetime(newDatetime) { + + value = newDatetime.valueOf(); + + /* Now we calculate which candle has this new time, because it will give us the y coordinate. */ + + for (let i = 0; i < candles.length; i++) { + + if (value >= candles[i].begin && value <= candles[i].end) { + + let targetPoint = { + x: value, + y: candles[i].open + }; + + targetPoint = plotArea.inverseTransform(targetPoint, candlesticks.container.frame.height); + targetPoint = transformThisPoint(targetPoint, candlesticks.container); + + let targetMax = { + x: value, + y: candles[i].max + }; + + targetMax = plotArea.inverseTransform(targetMax, candlesticks.container.frame.height); + targetMax = transformThisPoint(targetMax, candlesticks.container); + + let targetMin = { + x: value, + y: candles[i].min + }; + + targetMin = plotArea.inverseTransform(targetMin, candlesticks.container.frame.height); + targetMin = transformThisPoint(targetMin, candlesticks.container); + + let center = { + x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2, + y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) / 2 + }; + + if (targetMax.y < viewPort.visibleArea.topLeft.y || targetMin.y > viewPort.visibleArea.bottomRight.y) { + + let displaceVector = { + x: 0, + y: center.y - targetPoint.y + }; + + viewPort.displaceTarget(displaceVector); + + } + + let displaceVector = { + x: center.x - targetPoint.x, + y: 0 + }; + + viewPort.displace(displaceVector); + + return; + } + } + } + + + + + function draw() { + + if (layerStatus !== 'on') { return; } + + this.container.frame.draw(); + + if (timePeriod !== ONE_DAY_IN_MILISECONDS) { + + if (Math.random() * 100 > 98) { + recalculateCandles(); + } + + + } + + plotCandleChart(); + + } + + + + function recalculateCandles() { + + if (layerStatus === 'off') { return; } + + if (timePeriod >= ONE_HOUR_IN_MILISECONDS) { + + recalculateCandlesUsingMarketFiles(); + + } else { + + recalculateCandlesUsingDailyFiles(); + + } + + candlesticks.container.eventHandler.raiseEvent("Candles Changed", candles); + } + + + + function recalculateCandlesUsingDailyFiles(currentDateOnly) { + + let daysOnSides = getSideDays(timePeriod); + + let leftDate; + let rightDate; + + if (currentDateOnly === true) { + + leftDate = new Date(datetime.getTime()); + rightDate = new Date(datetime.getTime()); + + leftDate = removeTime(datetime); + rightDate = removeTime(datetime); + + } else { + + leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); + rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); + + + + leftDate.setDate(leftDate.getDate() - daysOnSides); + rightDate.setDate(rightDate.getDate() + daysOnSides); + + } + + let currentDate = new Date(leftDate.getTime()); + + candles = []; + + while (currentDate.getTime() <= rightDate.getTime()) { + + let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); + + let dailyFile = dailyFilesCursor.dailyFiles.get(stringDate); + + if (dailyFile !== undefined) { + + const fileTimePeriod = 60 * 1000; + const totalCandles = dailyFile.length * fileTimePeriod / timePeriod; + const recordsPerCandle = timePeriod / fileTimePeriod; + + for (var i = 0; i < totalCandles; i++) { + + var candle = newCandle(); + + let min = dailyFile[i * recordsPerCandle][0]; + let max = dailyFile[i * recordsPerCandle][1]; + + for (var j = 0; j < recordsPerCandle; j++) { + + if (dailyFile[i * recordsPerCandle + j][0] < min) { + + min = dailyFile[i * recordsPerCandle + j][0]; + } + + if (dailyFile[i * recordsPerCandle + j][1] > max) { + + max = dailyFile[i * recordsPerCandle + j][1]; + } + + } + + candle.min = min; + candle.max = max; + + candle.open = dailyFile[i * recordsPerCandle][2]; + candle.close = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][3]; + + candle.begin = dailyFile[i * recordsPerCandle][4]; + candle.end = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][5]; + + candle.beginId = dailyFile[i * recordsPerCandle][6]; + candle.endId = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][7]; + + if (candle.open > candle.close) { candle.direction = 'down'; } + if (candle.open < candle.close) { candle.direction = 'up'; } + if (candle.open === candle.close) { candle.direction = 'side'; } + + candles.push(candle); + + if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { + + candlesticks.currentCandle = candle; + candlesticks.container.eventHandler.raiseEvent("Current Candle Changed", candlesticks.currentCandle); + + } + } + + } + + currentDate.setDate(currentDate.getDate() + 1); + } + + } + + + function recalculateCandlesUsingMarketFiles() { + + if (marketFile === undefined) { return;} // Initialization not complete yet. + + candles = []; + + for (var i = 0; i < marketFile.length; i++) { + + var candle = newCandle(); + + candle.min = marketFile[i][0]; + candle.max = marketFile[i][1]; + + candle.open = marketFile[i][2]; + candle.close = marketFile[i][3]; + + candle.begin = (new Date(marketFile[i][4])).valueOf(); + candle.end = (new Date(marketFile[i][5])).valueOf(); + + if (candle.open > candle.close) { candle.direction = 'down'; } + if (candle.open < candle.close) { candle.direction = 'up'; } + if (candle.open === candle.close) { candle.direction = 'side'; } + + candles.push(candle); + } + + } + + + + + function recalculateScale() { + + if (marketFile === undefined) { return; } // Initialization not complete yet. + + var minValue = { + x: EARLIEST_DATE.valueOf(), + y: 0 + }; + + var maxValue = { + x: MAX_PLOTABLE_DATE.valueOf(), + y: nextPorwerOf10(getMaxRate()) + }; + + + plotArea.initialize( + minValue, + maxValue, + candlesticks.container.frame.width, + candlesticks.container.frame.height + ); + + function getMaxRate() { + + let maxValue = 0; + + for (var i = 0; i < marketIndex.length; i++) { + + let currentMax = marketIndex[i][1]; // 1 = rates. + + if (maxValue < currentMax) { + maxValue = currentMax; + } + } + + return maxValue; + + } + + } + + + + + + + + function plotCandleChart() { + + if (candles.length > 0) { + + /* Now we calculate and plot the candles */ + + for (var i = 0; i < candles.length; i++) { + + candle = candles[i]; + + var candlePoint1 = { + x: candle.begin + timePeriod / 7 * 1.5, + y: candle.open + }; + + var candlePoint2 = { + x: candle.begin + timePeriod / 7 * 5.5, + y: candle.open + }; + + var candlePoint3 = { + x: candle.begin + timePeriod / 7 * 5.5, + y: candle.close + }; + + var candlePoint4 = { + x: candle.begin + timePeriod / 7 * 1.5, + y: candle.close + }; + + candlePoint1 = plotArea.inverseTransform(candlePoint1, candlesticks.container.frame.height); + candlePoint2 = plotArea.inverseTransform(candlePoint2, candlesticks.container.frame.height); + candlePoint3 = plotArea.inverseTransform(candlePoint3, candlesticks.container.frame.height); + candlePoint4 = plotArea.inverseTransform(candlePoint4, candlesticks.container.frame.height); + + candlePoint1 = transformThisPoint(candlePoint1, candlesticks.container); + candlePoint2 = transformThisPoint(candlePoint2, candlesticks.container); + candlePoint3 = transformThisPoint(candlePoint3, candlesticks.container); + candlePoint4 = transformThisPoint(candlePoint4, candlesticks.container); + + if (candlePoint2.x < viewPort.visibleArea.bottomLeft.x || candlePoint1.x > viewPort.visibleArea.bottomRight.x) { + continue; + } + + candlePoint1 = viewPort.fitIntoVisibleArea(candlePoint1); + candlePoint2 = viewPort.fitIntoVisibleArea(candlePoint2); + candlePoint3 = viewPort.fitIntoVisibleArea(candlePoint3); + candlePoint4 = viewPort.fitIntoVisibleArea(candlePoint4); + + var stickPoint1 = { + x: candle.begin + timePeriod / 7 * 3.2, + y: candle.max + }; + + var stickPoint2 = { + x: candle.begin + timePeriod / 7 * 3.8, + y: candle.max + }; + + var stickPoint3 = { + x: candle.begin + timePeriod / 7 * 3.8, + y: candle.min + }; + + var stickPoint4 = { + x: candle.begin + timePeriod / 7 * 3.2, + y: candle.min + }; + + stickPoint1 = plotArea.inverseTransform(stickPoint1, candlesticks.container.frame.height); + stickPoint2 = plotArea.inverseTransform(stickPoint2, candlesticks.container.frame.height); + stickPoint3 = plotArea.inverseTransform(stickPoint3, candlesticks.container.frame.height); + stickPoint4 = plotArea.inverseTransform(stickPoint4, candlesticks.container.frame.height); + + stickPoint1 = transformThisPoint(stickPoint1, candlesticks.container); + stickPoint2 = transformThisPoint(stickPoint2, candlesticks.container); + stickPoint3 = transformThisPoint(stickPoint3, candlesticks.container); + stickPoint4 = transformThisPoint(stickPoint4, candlesticks.container); + + stickPoint1 = viewPort.fitIntoVisibleArea(stickPoint1); + stickPoint2 = viewPort.fitIntoVisibleArea(stickPoint2); + stickPoint3 = viewPort.fitIntoVisibleArea(stickPoint3); + stickPoint4 = viewPort.fitIntoVisibleArea(stickPoint4); + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(stickPoint1.x, stickPoint1.y); + browserCanvasContext.lineTo(stickPoint2.x, stickPoint2.y); + browserCanvasContext.lineTo(stickPoint3.x, stickPoint3.y); + browserCanvasContext.lineTo(stickPoint4.x, stickPoint4.y); + + browserCanvasContext.closePath(); + browserCanvasContext.fillStyle = 'rgba(54, 54, 54, 1)'; + browserCanvasContext.fill(); + + if (datetime !== undefined) { + + let dateValue = datetime.valueOf(); + + if (dateValue >= candle.begin && dateValue <= candle.end) { + + browserCanvasContext.strokeStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time + + } else { + browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)'; + } + + } else { + browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)'; + } + + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(candlePoint1.x, candlePoint1.y); + browserCanvasContext.lineTo(candlePoint2.x, candlePoint2.y); + browserCanvasContext.lineTo(candlePoint3.x, candlePoint3.y); + browserCanvasContext.lineTo(candlePoint4.x, candlePoint4.y); + + browserCanvasContext.closePath(); + + if (candle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 1)'; } + if (candle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 1)'; } + if (candle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(27, 7, 105, 1)'; } + + if (datetime !== undefined) { + + let dateValue = datetime.valueOf(); + + if (dateValue >= candle.begin && dateValue <= candle.end) { + + /* highlight the current candle */ + + browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time + + let currentCandle = { + bodyWidth: candlePoint2.x - candlePoint1.x, + bodyHeight: candlePoint3.y - candlePoint2.y, + stickHeight: stickPoint4.y - stickPoint2.y, + stickWidth: stickPoint2.x - stickPoint1.x, + stickStart: candlePoint2.y - stickPoint2.y, + period: timePeriod, + innerCandle: candle + }; + + candlesticks.container.eventHandler.raiseEvent("Current Candle Info Changed", currentCandle); + + } else { + + if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; } + if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; } + if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; } + } + + } else { + + if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; } + if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; } + if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; } + + } + + + + if ( + candlePoint1.x < viewPort.visibleArea.topLeft.x + 50 + || + candlePoint1.x > viewPort.visibleArea.bottomRight.x - 50 + ) { + // we leave this candles without fill. + } else { + browserCanvasContext.fill(); + } + + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + + + } + } + } + + +} + diff --git a/README.md b/README.md new file mode 100644 index 000000000..5aa302b7d --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# AAOlivia-Plotter From c27f610e7b14fcf7d1036cd1b94aa97a7d08ba20 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 19 Feb 2018 19:16:14 +0100 Subject: [PATCH 002/176] Eliminating bad chars --- Candlestick.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index 1e048889c..4d7e06634 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -1,5 +1,4 @@ - -function newAAMastersAAOliviaCandlesticks() { +function newAAMastersAAOliviaCandlesticks() { var candles = []; // this changed. let timePeriod = INITIAL_TIME_PERIOD; From c4138e4fd7a649b690e25282884cc680f4cfeef3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 07:12:07 +0100 Subject: [PATCH 003/176] Not market index --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 6 +++--- bin/Microsoft.NodejsTools.WebRole.dll | Bin 0 -> 32992 bytes ...ia-Plotter.njsproj.CoreCompileInputs.cache | 1 + ...livia-Plotter.njsproj.FileListAbsolute.txt | 3 +++ ...tter.njsprojResolveAssemblyReference.cache | Bin 0 -> 2216 bytes 6 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 bin/Microsoft.NodejsTools.WebRole.dll create mode 100644 obj/Debug/AAOlivia-Plotter.njsproj.CoreCompileInputs.cache create mode 100644 obj/Debug/AAOlivia-Plotter.njsproj.FileListAbsolute.txt create mode 100644 obj/Debug/AAOlivia-Plotter.njsprojResolveAssemblyReference.cache diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 8e3523b2073c81d39dbb8b947ce4d3dab3877f09..5e725d608a3bf6bb2acfab92c804f0c1814bcac1 100644 GIT binary patch delta 481 zcmYk3O-lk{5Xbj<+|4x~HL=t%GD&(d4+V7yqzoZCc-RH6eSyv!2z8K<=nzrPJt8^< zLG6A4BM;Fbg1(BE4!Qj&T-bphGtYlsc82YAMdwmnuP;b#Y*U)1BNSld`#!4?;O&{u z!j(;3B&j5evHH{NQTp*)C_0v()QE0TJJM9#X#h0(WarA(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aL&|$!(p4Cnd)%xGtaWVf!AD<5esjqln&&4`b%z59oU-$Fog)w@?MIq(( zqt`EZTe{}-jT=iE4O#5Ix7)~^KhXw;^wf-Ut(|iEsI%jQ7a?J0YI@x_2|dCcc0P%z zz2GnScxzB;u0XH&mN$Hw)2*Ov$lsr+vCe&qN=Yj5Osf=e`S zVd}l2rrxxF_8ce=gZ*Y((>e@RMmUqk&Cw3H?4|KTJcIl>u2rXHC0+J?ZM%bxRigP% zm~kl=LhSk6rET6lIN1LAv*2p7w4oINnmVuaELnP*EImP%)-v>dH+$g@Dp^{xWcdF? zVZjBqwb{JGz4|$>>~=Xe{Y}?i=ADC6Lt0xtEIRm-kcP!z#yK@3$I<6MTeuk%N>@~w zRnIkq*K9|C#g$nE+<8fFb~)6p8u|Em&}mPK?Wr! zG9vCQGPK(Ebkd0-S|x!KjhJG!4c@!gt?am|&*LVOl3m9)8mC3%W-q%s{{5luF*c`e zsoGfW+PWpB^XT=d58ss)AFxt6*)Ukgpx@I)`9nirUf+Lz{s7-TWv;0Xv$~j#)0M={@N9B8Hsjmjx5JDQuRf_bx;cE&yJg=l+V^rL x+q|;yb^kiO>i#YDI~A&BCPQ=|G1sr4)edTm$samLW9)U+@hk6`)(u~e{vQLgHC+Gz literal 0 HcmV?d00001 diff --git a/obj/Debug/AAOlivia-Plotter.njsproj.CoreCompileInputs.cache b/obj/Debug/AAOlivia-Plotter.njsproj.CoreCompileInputs.cache new file mode 100644 index 000000000..7b68ca993 --- /dev/null +++ b/obj/Debug/AAOlivia-Plotter.njsproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +172458ce4c7a5d368195f98d8866451da04a9a38 diff --git a/obj/Debug/AAOlivia-Plotter.njsproj.FileListAbsolute.txt b/obj/Debug/AAOlivia-Plotter.njsproj.FileListAbsolute.txt new file mode 100644 index 000000000..4c3907976 --- /dev/null +++ b/obj/Debug/AAOlivia-Plotter.njsproj.FileListAbsolute.txt @@ -0,0 +1,3 @@ +C:\Users\Luis\source\repos\AAOlivia-Plotter\obj\Debug\AAOlivia-Plotter.njsprojResolveAssemblyReference.cache +C:\Users\Luis\source\repos\AAOlivia-Plotter\obj\Debug\AAOlivia-Plotter.njsproj.CoreCompileInputs.cache +C:\Users\Luis\source\repos\AAOlivia-Plotter\bin\Microsoft.NodejsTools.WebRole.dll diff --git a/obj/Debug/AAOlivia-Plotter.njsprojResolveAssemblyReference.cache b/obj/Debug/AAOlivia-Plotter.njsprojResolveAssemblyReference.cache new file mode 100644 index 0000000000000000000000000000000000000000..67d5be9b7a12b38e6fe524eedeba2ea6a1a31246 GIT binary patch literal 2216 zcmb_d+iu%N5T)*RdTpA)&tW2&Cd7K4^8EmeX{a^_^}K>O{gp42hO3tnZvAqmX;w!0b$% zLwqo5wu4Tv8?;(}r^(u^M8-b7-o{|2G(-cA|0w}SaS=4l}-Sv+P}L{la~Zj;ik@ZnU73+{t7>BoTo2t|xY zl^?M%0c9A4f>A1MnAh3r&vo6t#^?SO{ja{i_ay~et&;Orkwgi_HqB_ETt;!w-5);g zpM3S*tN7z& z1%zec5=J+x+udE(@j9Qk_S$!$d2g>ow%*8Fg005XY9uC811)(xwz(ScXc_`RaeKlP z)|&@P33({J3D;QT*i`+vmr&fa$>LFzq~&f)h}d)reou<1Kxr+0lEwNEf~-B(0L2ySaRO}Wl?GcxSQfv{Ynk^4-6>1GX3bE*3e!?BQDPoj_3KYK!UMXaR= zKXkE3L_8*Q$U3Kt%Ug3DDYmgjSoijga%qms{?wJh_Q7o9~R z!~q{Ck`bHE%LQ9_KAo*O`*x>3yIPl5Li^&T{$&2IA#ja>)qYFi$(J`Vdm9Tg6092K z{U;RVEfhy|&+IoEjqZLUBiY8XvXNvP3zBUtS*Ed~kVw|rMpebX@H%}vtf-MI7j(b4 zu3;8`M#g@P%19xuV441jvv&e(-9kznuTbYrFkC Date: Tue, 20 Feb 2018 07:26:39 +0100 Subject: [PATCH 004/176] Recalculate viewport activated --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 13 +------------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 5e725d608a3bf6bb2acfab92c804f0c1814bcac1..1bed97a92c6d4139a12c80da44a927f7d1bd29ef 100644 GIT binary patch delta 777 zcmbtSze~eF6n>YaHI_@;B()l>wt~N?psgr4D5CAqL1@G*jv@{&QuT1|ZviooJZc!>zuh4Tq|zU5^lN)fnbXPF*6B<%VA$M zYpY}?fJ5kj4+n4przY&6CVV{ClPE!O)M;g9GJ$!KVYS@f`!G|SOtqrE5X7> zG$7eOpj>HT=O6J(L1%)Vi@5N??l<4e&U_QpSx{$>yPV}=f{&$~htuZ$oj&1j%pFK1 z5*b7mkwbWTKl#p>O~UTY*7KpOk5hY0Br(>F_{0MjLsJm-jJv%^^dKxmA0nlvty2Us!r}qk6mLZr#tKGUE7#{@7#XS>XGH@w*m2e%$b=B`Wl-5G z;C5Ni_tbwZRJJeDNc5XzWY;We@K?2X4Nk5kh!`;fTIH%tGID{2iS<$57i5uVkc~o8 zpLrGoue9AML~1(d%~E?P6q2P-?iwi&iK=Ae;~z_W@iWAC0W??Q#0%$w`Y^wR$gaxH zo@mTiuF^G&ypD+|jrqk7F^D9&6bF=Bg^IJ@p55UV`TQHmyh=tdb047QeL-8dO=*-J z){b}d|Ll$2cE>Dpfm*G!1WfXbUah?Fc6ovgHW^m@K5e|u;hk*h0(a|DKW%LCFPLid A8~^|S diff --git a/Candlestick.js b/Candlestick.js index 83bfc3157..5430d2d9f 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -50,19 +50,8 @@ recalculateScale(); - // From here old code... - - - //recalculateCandlesUsingDailyFiles(true); // We need the first day of candles so as to see which is going to be the center of the viewport. - - - // if (marketId === INITIAL_DEFAULT_MARKET) { // For now, lets position the view port at the market USDT/BTC - - // postitionViewPort(); - - // } - recalculateCandles(); + postitionViewPort(); viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); From de3e5b388e75cfe3031ce5961d0e8c89e49e71b5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 07:29:17 +0100 Subject: [PATCH 005/176] Layer Status --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 1bed97a92c6d4139a12c80da44a927f7d1bd29ef..d304e7062928dfc8edefaa66a7d89ff08453f968 100644 GIT binary patch delta 394 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPK8zxh7m6sbYVV4sPi~Y_nf!%0L{J1MAPU67Kr9Bt5}PAg-Yar|gy8B* zctSY%kOjW*`13OI0!4U`MN4>lHfcBm#l?Z5AhQq#X!cCvbKwEH87zhn*9+kgLQ=T- z3m*^TBq0|b7NDRsvP6kc03(kCP=p;xbn+MN5Dt*T5eAB!=Vb)(aD^P$RS+In^XORTc zBqNW_9%2oQlTR?|Z2n@b%Ppw}R0IR2K!ySkgS^5#S Date: Tue, 20 Feb 2018 07:31:52 +0100 Subject: [PATCH 006/176] _1_HOUR_IN_MILISECONDS --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index d304e7062928dfc8edefaa66a7d89ff08453f968..db36187e3d3c1bd46e109cf3641f0dbe6d913eae 100644 GIT binary patch delta 417 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0Og=1=eV7zjKOA_X zCNjB@?b2jt=EliK*aKuZf$G?Sm;;EpftU@5LHfCX^kxGNVHRFSkdZ*s8GxeyCpSu| zOfKO$KiOHsaB>N60FN+K0xtPQ-GB07jo8Tx1T-d};MbY_MId0Zi@w3+5%A}A)Sizo{{FB!o#k|QSS|J=D zzrl1){=yf)!wVGPM;0vM_vZx%AIRGbMRqIz7*CdT delta 377 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTJ}iu!lNFidSvN>d z-7Gx0knPgs!)%6=OV}64umM%F12G2>a{@6J5OV`D$dt_n9KtNTU_*iCGXO>YPZpF? znOwqio|l0aD8h^)s@^k6%Y{b>C??ykMh1VE{9d739Z|%|AuinHEWD004Nmc5DCu diff --git a/Candlestick.js b/Candlestick.js index 234c3b846..2190cee20 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -112,7 +112,7 @@ timePeriod = period; - if (timePeriod >= ONE_HOUR_IN_MILISECONDS) { + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { marketFile = fileCache.getMarketFile(pTimePeriod, datetime); @@ -250,7 +250,7 @@ if (layerStatus === 'off') { return; } - if (timePeriod >= ONE_HOUR_IN_MILISECONDS) { + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { recalculateCandlesUsingMarketFiles(); From bdedcc3bd1f77b4ae2ddd133978742e7528157fe Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 07:39:11 +0100 Subject: [PATCH 007/176] pTimePeriod --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index db36187e3d3c1bd46e109cf3641f0dbe6d913eae..66d50ae39befecf37eae1df73b7dc9dc2c3f1af8 100644 GIT binary patch delta 296 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIV=lSEoz=zz!W_B zFk1r<8%{1^_UC2b0V-n!VxW%ylLe(zHh*FESK= _1_HOUR_IN_MILISECONDS) { - marketFile = fileCache.getMarketFile(pTimePeriod, datetime); + marketFile = fileCache.getMarketFile(pTimePeriod); } else { From e5487c53483f520ff2acde0e0876337fbf25ae60 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 09:26:47 +0100 Subject: [PATCH 008/176] datetime deleted --- Candlestick.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Candlestick.js b/Candlestick.js index c0c92bb39..e43362ac6 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -118,7 +118,7 @@ } else { - dailyFilesCursor = fileCache.getFileCursor(pTimePeriod, datetime); + dailyFilesCursor = fileCache.getFileCursor(pTimePeriod); } From ff13093d6da6e7b9b6cdff4de7ac5ad850930184 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 10:13:48 +0100 Subject: [PATCH 009/176] Optimization to load faster --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 22 ++++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 66d50ae39befecf37eae1df73b7dc9dc2c3f1af8..cd4d9d475bc1fc3d6f8c2f2aa3814d14139ccfba 100644 GIT binary patch delta 457 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgXF$ZDwaRCl@kZ zn(WNp$OBaIAEXsTPYx7Unf!%0L{JPUAPU67Kr8{oBAX*wgqc_cgzgAvPcCEw>SW$K zi9m{!7jfpM~ncFSZBNvp|B0*82*fx1C1M%X8Cg=O*yU8~JZ2J-xpuYpo9 X@B_$D0Ai5unI{W6wrxIO@4y5A9yW7D diff --git a/Candlestick.js b/Candlestick.js index e43362ac6..5e66e9893 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -42,22 +42,25 @@ timePeriod = pTimePeriod; fileCache = newFileCache(); - fileCache.initialize("AAMasters", "AAOlivia", "Candles", "Candlesticks", pExchange, pMarket, pDatetime, onCacheInitialized); + fileCache.initialize("AAMasters", "AAOlivia", "Candles", "Candlesticks", pExchange, pMarket, pDatetime, onFileReady); - function onCacheInitialized() { + function onFileReady() { marketFile = fileCache.getMarketFile(pTimePeriod); - recalculateScale(); + if (marketFile !== undefined) { // if the file ready is the one we need then it will continue here. - layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); + recalculateScale(); - recalculateCandles(); - postitionViewPort(); + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + recalculateCandles(); + postitionViewPort(); + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + + } } } @@ -130,6 +133,9 @@ datetime = newDatetime; recalculateCandles(); + + fileCache.setDatetime(newDatetime); + } From 6e0059bfd28d85a2940d064312a73600b7dfafe6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 10:31:15 +0100 Subject: [PATCH 010/176] newMarketFile --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 9 ++++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index cd4d9d475bc1fc3d6f8c2f2aa3814d14139ccfba..d23f98ae2e91f7c602536f471c442abe42b3bc52 100644 GIT binary patch delta 561 zcmY*WJxc>Y5Y6o6lGE&6?qZ@jKR`hxXo5y8g&6J%8!^aLf?y$7XcN57CIPX!LNb3q z%r7we2Lu~CgTLh(8_(J3nq=X@?3;PBGjBT)bnfACcO|8cok}?r1K~SK5=jF#jmFDG z2t9VA53kSeYS?C{=xKEkvjCRosHQ|%Aj}hrgfcOT7wfqQQoPA8JvsNg=lgnZrwg4v42rv=uvnTP1h53;+w(l$m1vDr zUhYk>#Fkv`oxSB~TfAdV5P*)QuD*?$B(jC1kp#lerf4&~!yW^lAZzgtEl=CQcj^R7 z)ReAOK|z&_pwOeYsRQbUGO-Xg2ogj#kO(^@!vINPxzZ^&3Xd4|H%)c=JGwAaB;43r z+uZEiSp%q%?9g$pY-v{{;@fAYHUouQa{HwZGmjcTbYDlFr(<8GkZ7kJQ0LOHPrzKg zp%A>mzaiAbuza%r516Yc@T`eew5|fT= _1_HOUR_IN_MILISECONDS) { - marketFile = fileCache.getMarketFile(pTimePeriod); + let newMarketFile = fileCache.getMarketFile(pTimePeriod); + + if (newMarketFile !== undefined) { + + marketFile = newMarketFile; + + } + } else { From 5900c397548f3b826618333c9f74d2e3bffe8772 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 10:33:38 +0100 Subject: [PATCH 011/176] newFileCursor --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 12 +++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index d23f98ae2e91f7c602536f471c442abe42b3bc52..a608fad024f54419aa02c1a462fe12343fe64d75 100644 GIT binary patch delta 254 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0OgStp2^-hlom{|n zdGcX4!^tJ=AspgBB|w$`CkKkFZ2rQ2g@r>9MTEzniI-6lD8z{*Jh_BFWU>dJ#U=q~ z=E=_5jXbPCNj_u+UxWiDyJ$4<$O8pAkR&#L5joE^`LMC=CW*t0ykMKTP^2Y!G&b2O bGD>CvMPZ;5%HRRg%##Hj+cqDtcVGel-H}iX delta 231 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTIV>y}3T?6{7qDHP z?9ANA!v>U=24bMf|C1Y~R5pKMzrw=7ha$q`&&10h4ipkY5}sV5dttMSz<;L6&bo$^ zON9M-89~-cA}jeK9Kgc`6@XbVxkMv`LkLOL<}V`Wfrd!>ZWfT(%*e~g3Y6nOk(cDr F007Z%PyPS^ diff --git a/Candlestick.js b/Candlestick.js index bcc75fd3a..4064865a5 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -28,7 +28,7 @@ container.frame.containerName = "AAMasters AAOlivia Candlesticks"; let marketFile; - let dailyFilesCursor; + let fileCursor; let layerStatus = 'off'; @@ -128,7 +128,13 @@ } else { - dailyFilesCursor = fileCache.getFileCursor(pTimePeriod); + let newFileCursor = fileCache.getFileCursor(pTimePeriod); + + if (newFileCursor !== undefined) { + + fileCursor = newFileCursor; + + } } @@ -313,7 +319,7 @@ let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); - let dailyFile = dailyFilesCursor.dailyFiles.get(stringDate); + let dailyFile = fileCursor.dailyFiles.get(stringDate); if (dailyFile !== undefined) { From 5a19be9b7d1adc56fa2ed7372d951bcc9a13f9d5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 11:09:38 +0100 Subject: [PATCH 012/176] newMarketFile --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 15 ++++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index a608fad024f54419aa02c1a462fe12343fe64d75..266555c3ef5a0bbda595de04404a82fa59ad188a 100644 GIT binary patch delta 225 zcmZqZVQlDO+>pb>`k@f${Xe-;N@a41ZqFhirbPlwn>1V)H@k?o2y%!c z$#4Fm7Qi&wMYLh_5ltVq%>rUOm=>QfVBCB{au4fd1rwXi2P_j=B~^hsV88^(&;nu} UAZDH{=-9UTfPEq}K_w1M03%;K4*&oF delta 263 zcmZqZVQlDO+>pb>dLcWiT6c3H(|tw}aRvqkF(4KJVhJGr_y7O@%_%G#OsokT*WCpw zVq4D0$qtm@0AlXViX7_f9GpNVP}%>C9`1iK)MskMpoj$1OO4~Mm+!k diff --git a/Candlestick.js b/Candlestick.js index 4064865a5..6e193c766 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -46,9 +46,11 @@ function onFileReady() { - marketFile = fileCache.getMarketFile(pTimePeriod); + let newMarketFile = fileCache.getMarketFile(pTimePeriod); - if (marketFile !== undefined) { // if the file ready is the one we need then it will continue here. + if (newMarketFile !== undefined && marketFile === undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. + + marketFile = newMarketFile; recalculateScale(); @@ -123,8 +125,9 @@ marketFile = newMarketFile; + recalculateCandles(); + } - } else { @@ -134,12 +137,10 @@ fileCursor = newFileCursor; + recalculateCandles(); + } - } - - recalculateCandles(); - } function setDatetime(newDatetime) { From c6a77349b4d28b8941cecd290671b872c7d8df5f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 12:33:50 +0100 Subject: [PATCH 013/176] FileCache implementation ready --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 90 +++++++++++++++++----------------- 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 266555c3ef5a0bbda595de04404a82fa59ad188a..7100e282fdff4f900e4fd047e90d875b5573e056 100644 GIT binary patch delta 106 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjjyzOD5WFE@b-6 m%=)3Dc><8hw!uOYqznd_fDCaU<^f{n$%2k;n-ADKFaZDvf){N7 delta 145 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgXF%Dmrc%Z7yW` u&CF_$6Zi=YS^PzC@B2ORkT diff --git a/Candlestick.js b/Candlestick.js index 6e193c766..ed5cd58d9 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -1,11 +1,10 @@ function newAAMastersAAOliviaCandlesticks() { - var candles = []; // this changed. - let timePeriod = INITIAL_TIME_PERIOD; - + var candles = []; var plotArea = newPlotArea(); - var datetime = INITIAL_DATE; + let timePeriod; + var datetime; var candlesticks = { onLayerStatusChanged: onLayerStatusChanged, @@ -36,22 +35,48 @@ return candlesticks; - function initialize(pExchange, pMarket, pDatetime, pTimePeriod, chartLayersPanel) { + function initialize(pExchange, pMarket, pDatetime, pTimePeriod, chartLayersPanel, callBackFunction) { datetime = pDatetime; timePeriod = pTimePeriod; fileCache = newFileCache(); - fileCache.initialize("AAMasters", "AAOlivia", "Candles", "Candlesticks", pExchange, pMarket, pDatetime, onFileReady); + fileCache.initialize("AAMasters", "AAOlivia", "Market Candles", "Market Candlesticks", pExchange, pMarket, onFileReady); + + fileCursorCache = newFileCursorCache(); + fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, onFileReady); function onFileReady() { - let newMarketFile = fileCache.getMarketFile(pTimePeriod); + let newMarketFile = fileCache.getFile(pTimePeriod); if (newMarketFile !== undefined && marketFile === undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. marketFile = newMarketFile; + finishInitialization(); + + } + + let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); + + if (newFileCursor !== undefined && marketFile === undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. + + fileCursor = newFileCursor; + + let stringDate = datetime.getUTCFullYear() + '-' + pad(datetime.getUTCMonth() + 1, 2) + '-' + pad(datetime.getUTCDate(), 2); + + let dailyFile = fileCursor.files.get(stringDate); + + if (dailyFile !== undefined) { + + finishInitialization(); + + } + } + + function finishInitialization() { + recalculateScale(); layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); @@ -62,7 +87,10 @@ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + callBackFunction(); + } + } } @@ -119,7 +147,7 @@ if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - let newMarketFile = fileCache.getMarketFile(pTimePeriod); + let newMarketFile = fileCache.getFile(pTimePeriod); if (newMarketFile !== undefined) { @@ -148,7 +176,7 @@ datetime = newDatetime; recalculateCandles(); - fileCache.setDatetime(newDatetime); + fileCursorCache.setDatetime(newDatetime); } @@ -305,8 +333,6 @@ leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); - - leftDate.setDate(leftDate.getDate() - daysOnSides); rightDate.setDate(rightDate.getDate() + daysOnSides); @@ -320,46 +346,22 @@ let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); - let dailyFile = fileCursor.dailyFiles.get(stringDate); + let dailyFile = fileCursor.files.get(stringDate); if (dailyFile !== undefined) { - const fileTimePeriod = 60 * 1000; - const totalCandles = dailyFile.length * fileTimePeriod / timePeriod; - const recordsPerCandle = timePeriod / fileTimePeriod; - - for (var i = 0; i < totalCandles; i++) { + for (var i = 0; i < dailyFile.length; i++) { var candle = newCandle(); - let min = dailyFile[i * recordsPerCandle][0]; - let max = dailyFile[i * recordsPerCandle][1]; + candle.min = dailyFile[i][0]; + candle.max = dailyFile[i][1]; - for (var j = 0; j < recordsPerCandle; j++) { + candle.open = dailyFile[i][2]; + candle.close = dailyFile[i][3]; - if (dailyFile[i * recordsPerCandle + j][0] < min) { - - min = dailyFile[i * recordsPerCandle + j][0]; - } - - if (dailyFile[i * recordsPerCandle + j][1] > max) { - - max = dailyFile[i * recordsPerCandle + j][1]; - } - - } - - candle.min = min; - candle.max = max; - - candle.open = dailyFile[i * recordsPerCandle][2]; - candle.close = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][3]; - - candle.begin = dailyFile[i * recordsPerCandle][4]; - candle.end = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][5]; - - candle.beginId = dailyFile[i * recordsPerCandle][6]; - candle.endId = dailyFile[i * recordsPerCandle + recordsPerCandle - 1][7]; + candle.begin = (new Date(dailyFile[i][4])).valueOf(); + candle.end = (new Date(dailyFile[i][5])).valueOf(); if (candle.open > candle.close) { candle.direction = 'down'; } if (candle.open < candle.close) { candle.direction = 'up'; } @@ -377,7 +379,7 @@ } - currentDate.setDate(currentDate.getDate() + 1); + currentDate.setUTCDate(currentDate.getUTCDate() + 1); } } From 89d73f59762a004360d529381be1c5f7209971b3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 13:13:28 +0100 Subject: [PATCH 014/176] fileCursorCache --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 7100e282fdff4f900e4fd047e90d875b5573e056..460dc351785c0494e06e007d4898ff6760aebddc 100644 GIT binary patch delta 100 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0OgSv91z)W6Ts9Z7 k^;>VUQ)HCv0jU53sRIjvv=$Ka05S7qLC3bu2kae~06gIpod5s; delta 61 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTIV`LnI+`cgZ7yW% Gw*~- Date: Tue, 20 Feb 2018 13:24:56 +0100 Subject: [PATCH 015/176] leftDate --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 22 +++++----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 460dc351785c0494e06e007d4898ff6760aebddc..4f44b157e129c2b6e47140321b53699dc4deee2d 100644 GIT binary patch delta 101 zcmZqZVQlDO+>pb>8c=!6$7ORN({E8TsIf8ZLpB+VSoXt152Px9w5y;Spb>>X5W#qTS{~rr*r01z)W6Ts9Z7ZLpAJKmtrawm1;;05S7qLC3bu X2kaA>C41mXqz)_uvbE5ZI4}VK&k+?E diff --git a/Candlestick.js b/Candlestick.js index 749c97d75..fd87fc8c8 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -313,30 +313,18 @@ - function recalculateCandlesUsingDailyFiles(currentDateOnly) { + function recalculateCandlesUsingDailyFiles() { let daysOnSides = getSideDays(timePeriod); let leftDate; let rightDate; - if (currentDateOnly === true) { + leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); + rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); - leftDate = new Date(datetime.getTime()); - rightDate = new Date(datetime.getTime()); - - leftDate = removeTime(datetime); - rightDate = removeTime(datetime); - - } else { - - leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); - rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); - - leftDate.setDate(leftDate.getDate() - daysOnSides); - rightDate.setDate(rightDate.getDate() + daysOnSides); - - } + leftDate.setDate(leftDate.getDate() - daysOnSides); + rightDate.setDate(rightDate.getDate() + daysOnSides); let currentDate = new Date(leftDate.getTime()); From 3c18100ae049c57983b934ba8ecd3128dcf0570c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 13:40:54 +0100 Subject: [PATCH 016/176] recalculateScale --- Candlestick.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index fd87fc8c8..20926d6f7 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -50,6 +50,8 @@ let newMarketFile = fileCache.getFile(pTimePeriod); + recalculateScale(); // With any of the market files we can calculate the scale. + if (newMarketFile !== undefined && marketFile === undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. marketFile = newMarketFile; @@ -77,8 +79,6 @@ function finishInitialization() { - recalculateScale(); - layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); recalculateCandles(); @@ -279,7 +279,7 @@ this.container.frame.draw(); - if (timePeriod !== ONE_DAY_IN_MILISECONDS) { + if (timePeriod < _1_HOUR_IN_MILISECONDS) { if (Math.random() * 100 > 98) { recalculateCandles(); @@ -406,7 +406,9 @@ function recalculateScale() { - if (marketFile === undefined) { return; } // Initialization not complete yet. + if (marketFile === undefined) { return; } // We need the market file to be loaded to make the calculation. + + if (plotArea.maxValue > 0) { return; } // Already calculated. var minValue = { x: EARLIEST_DATE.valueOf(), From 4d27e744c7f8681155b90378bf8388f5d7f15609 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 13:45:49 +0100 Subject: [PATCH 017/176] finishInitialization --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 8 +++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 4f44b157e129c2b6e47140321b53699dc4deee2d..762c3ed89debcff5083218eb54d9a5b139a59e64 100644 GIT binary patch delta 69 zcmZqZVQlDO+>pb>dg05|EgqW-nSL{~UU)crJCMn?!GhPC0RbX5>)C&1#t^#11OP%u B6Jr1X delta 85 zcmZqZVQlDO+>pb>8c=!6$7ORN({E8TsIf8ZLr|&VSoXt14}mR*?(r1G+~4Z ZF)%m**?vGS4-hj?7IbXee8Ap;2>={I6ovo* diff --git a/Candlestick.js b/Candlestick.js index 20926d6f7..5d4c7393f 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -50,8 +50,6 @@ let newMarketFile = fileCache.getFile(pTimePeriod); - recalculateScale(); // With any of the market files we can calculate the scale. - if (newMarketFile !== undefined && marketFile === undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. marketFile = newMarketFile; @@ -72,13 +70,15 @@ if (dailyFile !== undefined) { - finishInitialization(); + callBackFunction(); } } function finishInitialization() { + recalculateScale(); // With any of the market files we can calculate the scale. + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); recalculateCandles(); @@ -87,8 +87,6 @@ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - callBackFunction(); - } } From d91ed9d752be18f065a5ef95d8c29b6b7ed5d656 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 13:59:31 +0100 Subject: [PATCH 018/176] onFileCursorReady --- Candlestick.js | 51 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index 5d4c7393f..43fc62ae6 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -44,39 +44,16 @@ fileCache.initialize("AAMasters", "AAOlivia", "Market Candles", "Market Candlesticks", pExchange, pMarket, onFileReady); fileCursorCache = newFileCursorCache(); - fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, onFileReady); + fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, onFileCursorReady); function onFileReady() { - let newMarketFile = fileCache.getFile(pTimePeriod); + let newMarketFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); - if (newMarketFile !== undefined && marketFile === undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. + if (newMarketFile !== undefined) { marketFile = newMarketFile; - finishInitialization(); - - } - - let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); - - if (newFileCursor !== undefined && marketFile === undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. - - fileCursor = newFileCursor; - - let stringDate = datetime.getUTCFullYear() + '-' + pad(datetime.getUTCMonth() + 1, 2) + '-' + pad(datetime.getUTCDate(), 2); - - let dailyFile = fileCursor.files.get(stringDate); - - if (dailyFile !== undefined) { - - callBackFunction(); - - } - } - - function finishInitialization() { - recalculateScale(); // With any of the market files we can calculate the scale. layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); @@ -88,8 +65,28 @@ canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); } + } + + function onFileCursorReady() { + + let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); + + if (newFileCursor !== undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. + + let stringDate = datetime.getUTCFullYear() + '-' + pad(datetime.getUTCMonth() + 1, 2) + '-' + pad(datetime.getUTCDate(), 2); + + let dailyFile = newFileCursor.files.get(stringDate); + + if (dailyFile !== undefined) { + + fileCursor = newFileCursor; + callBackFunction(); + + } + } } + } @@ -313,6 +310,8 @@ function recalculateCandlesUsingDailyFiles() { + if (fileCursor.files.size === 0) { return;} // We need to wait until there are files in the cursor + let daysOnSides = getSideDays(timePeriod); let leftDate; From b312fce32ff4abb6e06e57b0581cb2e63c4c4a34 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:07:39 +0100 Subject: [PATCH 019/176] initializeFileCursorCache --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 31 +++++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 762c3ed89debcff5083218eb54d9a5b139a59e64..299a4f30bac7d46ebc9afd3c02596aabad995a48 100644 GIT binary patch delta 78 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjkRU&EN06xsd5M WGi!p?uXR8s+Xf3pqs>b8_m}|fITscH delta 89 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgXFnQR*@7_B!e+23Q@WT(goWdZ;U@f!F5 diff --git a/Candlestick.js b/Candlestick.js index 43fc62ae6..a1dcadf67 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -43,9 +43,6 @@ fileCache = newFileCache(); fileCache.initialize("AAMasters", "AAOlivia", "Market Candles", "Market Candlesticks", pExchange, pMarket, onFileReady); - fileCursorCache = newFileCursorCache(); - fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, onFileCursorReady); - function onFileReady() { let newMarketFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); @@ -54,19 +51,18 @@ marketFile = newMarketFile; - recalculateScale(); // With any of the market files we can calculate the scale. - - layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); - - recalculateCandles(); - postitionViewPort(); - - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + initializeFileCursorCache(); } } + function initializeFileCursorCache() { + + fileCursorCache = newFileCursorCache(); + fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, onFileCursorReady); + + } + function onFileCursorReady() { let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); @@ -80,6 +76,17 @@ if (dailyFile !== undefined) { fileCursor = newFileCursor; + + recalculateScale(); // With any of the market files we can calculate the scale. + + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); + + recalculateCandles(); + postitionViewPort(); + + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + callBackFunction(); } From bb41c52030757fb2cf861b6e967638b9554f1c30 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:10:19 +0100 Subject: [PATCH 020/176] cursorCacheInProgress --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 11 +++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 299a4f30bac7d46ebc9afd3c02596aabad995a48..dae2004e8fac27cf25ea0b1e535dfde861466d31 100644 GIT binary patch delta 100 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0OgSv93UR&4KAQ{K k`mHzFDKbiGf>eNk)&W-_%?rdlK+HT@(6Mdv0ec4~01AW@I{*Lx delta 61 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTIV`LRR=?JHZ!To( Gw*~-*y$@Lc diff --git a/Candlestick.js b/Candlestick.js index a1dcadf67..9d6fa8b91 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -37,6 +37,8 @@ function initialize(pExchange, pMarket, pDatetime, pTimePeriod, chartLayersPanel, callBackFunction) { + let cursorCacheInProgress = false; + datetime = pDatetime; timePeriod = pTimePeriod; @@ -58,9 +60,14 @@ function initializeFileCursorCache() { - fileCursorCache = newFileCursorCache(); - fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, onFileCursorReady); + if (cursorCacheInProgress === false) { + cursorCacheInProgress = true; + + fileCursorCache = newFileCursorCache(); + fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, onFileCursorReady); + + } } function onFileCursorReady() { From e7d6ad597f947f9cd95a5ed6353ced4b1de8bb6e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:13:51 +0100 Subject: [PATCH 021/176] finaleStepsInProgress --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 22 ++++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index dae2004e8fac27cf25ea0b1e535dfde861466d31..eb0b90762c6d7714f68c589cefe6450063f7f41e 100644 GIT binary patch delta 94 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPxhzTk3w$;gGHtMt b^asg7K{${$1!5i`W}YnQ*tYqAy#o^fj9e1M delta 133 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{Ot~z#=I{63T*$P+ tM$!l*2L%yOng>WTPZo4++kC*@foYSSBBP`xObvt90aqZK7l=`n0Ra2(8BYKJ diff --git a/Candlestick.js b/Candlestick.js index 9d6fa8b91..e45fca047 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -38,6 +38,7 @@ function initialize(pExchange, pMarket, pDatetime, pTimePeriod, chartLayersPanel, callBackFunction) { let cursorCacheInProgress = false; + let finaleStepsInProgress = false; datetime = pDatetime; timePeriod = pTimePeriod; @@ -82,20 +83,25 @@ if (dailyFile !== undefined) { - fileCursor = newFileCursor; + if (finaleStepsInProgress === false) { - recalculateScale(); // With any of the market files we can calculate the scale. + finaleStepsInProgress = true; - layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); + fileCursor = newFileCursor; - recalculateCandles(); - postitionViewPort(); + recalculateScale(); // With any of the market files we can calculate the scale. - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); - callBackFunction(); + recalculateCandles(); + postitionViewPort(); + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + + callBackFunction(); + + } } } From b939cf9dc2cb4ca8d63c0828925e8c6d37a0c1b2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:30:40 +0100 Subject: [PATCH 022/176] console.log --- Candlestick.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Candlestick.js b/Candlestick.js index e45fca047..22871a0af 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -387,6 +387,8 @@ currentDate.setUTCDate(currentDate.getUTCDate() + 1); } + console.log("Olivia > recalculateCandlesUsingDailyFiles > total candles generated : " + candles.length); + } From 0fd287b72df14d2606fc9c94aa4415f98958e40a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:37:35 +0100 Subject: [PATCH 023/176] If there is a change in the day, then we take some actions, otherwise, we dont. --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 16896 bytes Candlestick.js | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index eb0b90762c6d7714f68c589cefe6450063f7f41e..0ef338d9f096b043a7d5a590516687c86c46c5a0 100644 GIT binary patch delta 66 zcmZo@VQgq&+>pb>YG8NyrT^warr*r04-VaU24u2ru#jBGfBpb>`XR}GfzRebrr*r03UR&4KqlJ;3rT+l1PBK*O@WvPh?yq~I<{>- IVDG>L0CxEg(f|Me diff --git a/Candlestick.js b/Candlestick.js index 22871a0af..27d8eabe2 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -188,11 +188,21 @@ function setDatetime(newDatetime) { - datetime = newDatetime; - recalculateCandles(); + /* If there is a change in the day, then we take some actions, otherwise, we dont. */ - fileCursorCache.setDatetime(newDatetime); + let currentDate = Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS); + let newDate = Math.trunc(newDatetime.valueOf() / ONE_DAY_IN_MILISECONDS); + if (currentDate !== newDate) { + + datetime = newDatetime; + recalculateCandles(); + fileCursorCache.setDatetime(newDatetime); + + } else { + + datetime = newDatetime; + } } From beb92e573545d8cda13712eb6b4feed40fd92fb2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:40:54 +0100 Subject: [PATCH 024/176] recalculateCandlesUsingMarketFiles --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 1 + 2 files changed, 1 insertion(+) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 0ef338d9f096b043a7d5a590516687c86c46c5a0..ae48bd12e34c594e2b3c6bc7f6fd25e24c6ac422 100644 GIT binary patch delta 100 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0OgSv93Ask;0hzqydD G-x>gt6%cy> diff --git a/Candlestick.js b/Candlestick.js index 27d8eabe2..3c93dc9f0 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -428,6 +428,7 @@ candles.push(candle); } + console.log("Olivia > recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length); } From fd0ebcddb904aa37e5cf6cef2fb0e8dc6e3ebe14 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:46:22 +0100 Subject: [PATCH 025/176] 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); From 1ada3dd24924fe4f70d457f5ef3382f409e578f1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:50:16 +0100 Subject: [PATCH 026/176] leftDate.setUTCDate(leftDate.getUTCDate() - 1); --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 3 +++ 2 files changed, 3 insertions(+) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index e617a614379215605f5ef57506cce3c7296cdd84..1a0e894185305bac8d328b93ad6b778846031c04 100644 GIT binary patch delta 143 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgStHmIYfk7cl){ rX4#;ky=`*=+eQn?R*-5am;+_=0Qt<51s&TqAFy{|+GMB5NQ5!~jv5?& delta 104 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIV=X}Th%ugF#Ta> mF|gdDw7Gz7qlM%YkZLGc4`lNK**rkZJXz4OZSw(p2POcw0T#Fb diff --git a/Candlestick.js b/Candlestick.js index 203270f37..d650bbb3c 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -406,6 +406,9 @@ let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); + leftDate.setUTCDate(leftDate.getUTCDate() - 1); + rightDate.setUTCDate(leftDate.getUTCDate() + 1); + candles = []; for (var i = 0; i < marketFile.length; i++) { From e2e6ff62648627aaba100fc2576f08086307e382 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:51:30 +0100 Subject: [PATCH 027/176] rightDate --- Candlestick.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Candlestick.js b/Candlestick.js index d650bbb3c..3c211fce2 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -407,7 +407,7 @@ let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); leftDate.setUTCDate(leftDate.getUTCDate() - 1); - rightDate.setUTCDate(leftDate.getUTCDate() + 1); + rightDate.setUTCDate(rightDate.getUTCDate() + 1); candles = []; From 0d66d8201d9a40206e67bf322ac5f79e8e8ee746 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 14:54:25 +0100 Subject: [PATCH 028/176] + 2) --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 1a0e894185305bac8d328b93ad6b778846031c04..df16b1f43499130b9b9f65e8902b7cdf2eec4af5 100644 GIT binary patch delta 43 wcmZqZVQlDO+>pb>65zu3dUFBOA7+*ZyC%NfT)?*1f^ouTJ^TO6VCoVR0C_zTU;qFB delta 43 wcmZqZVQlDO+>pb>qF`CDb#npJA7+*fD%#sN7qIQMV4SmA&;CC%n7YIS09ri|1^@s6 diff --git a/Candlestick.js b/Candlestick.js index 3c211fce2..d2ddb42f7 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -407,7 +407,7 @@ let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); leftDate.setUTCDate(leftDate.getUTCDate() - 1); - rightDate.setUTCDate(rightDate.getUTCDate() + 1); + rightDate.setUTCDate(rightDate.getUTCDate() + 2); candles = []; From 451ae0a00abbcf982b8944a902217bb10d268767 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 15:24:13 +0100 Subject: [PATCH 029/176] onDragFinished --- Candlestick.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Candlestick.js b/Candlestick.js index d2ddb42f7..a09be7a3b 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -152,6 +152,8 @@ recalculateCandles(); + console.log("onDragFinished") + } } From 2603fcb9e3163f9256ae5234b95501a29d4e7033 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 15:27:11 +0100 Subject: [PATCH 030/176] logs added --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 12 +++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index df16b1f43499130b9b9f65e8902b7cdf2eec4af5..4c2d36f602232514d14bc4ee4b18d5a33f237bd9 100644 GIT binary patch delta 94 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPxh(qW_rf+8GHtMt cv;?Vv0!JWQ5y<8NV&=($j%}L{*gG%*0F7i4v;Y7A delta 133 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{Ot~yBe6IsH7cy 98) { recalculateCandles(); + + console.log("draw"); } From 339c8eaf80f918b4c0c008195f33295b17345e09 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 15:28:58 +0100 Subject: [PATCH 031/176] draw disabled --- Candlestick.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index d9eab009c..940296eb2 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -317,9 +317,9 @@ if (timePeriod < _1_HOUR_IN_MILISECONDS) { if (Math.random() * 100 > 98) { - recalculateCandles(); + //recalculateCandles(); - console.log("draw"); + //console.log("draw"); } From 98ccf02ebac343f444e89bc3d7334c8785d65dfb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 15:35:58 +0100 Subject: [PATCH 032/176] setDatetime --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 16896 bytes Candlestick.js | 15 ++++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 4c2d36f602232514d14bc4ee4b18d5a33f237bd9..69bf95afe7d5bf8cf053d5ea00e182d50c2308d0 100644 GIT binary patch delta 66 zcmZo@VQgq&+>pb>DzN>Qc*N#Hrr*r03OidwflRgy7Lo@U5a0ro$pfUBCkr~ZZ9ZV{ Gzytt)G7wt; delta 66 zcmZo@VQgq&+>pb>8lazkFKlxm({E Date: Tue, 20 Feb 2018 15:38:19 +0100 Subject: [PATCH 033/176] onFileCursorReady --- Candlestick.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Candlestick.js b/Candlestick.js index 3e64038e8..42531266c 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -73,6 +73,9 @@ function onFileCursorReady() { + recalculateCandles(); + console.log("onFileCursorReady"); + let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); if (newFileCursor !== undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. From fc3ebe9900d343b5a783d0da93ac379fa53105aa Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 15:40:59 +0100 Subject: [PATCH 034/176] onDragFinished --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 8 ++------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 69bf95afe7d5bf8cf053d5ea00e182d50c2308d0..aa4f26c4ce244a4e50c8a3774a8a77973211878d 100644 GIT binary patch delta 99 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0OgStp7gjJ{*j&Ii i!FrROBBNwCNC6bg1k%z#%mc*ClLZ~yHXpEeU;+Rn*A(Lb delta 60 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTIV>y+J6l9I7qCsR F1^{!t4m|(> diff --git a/Candlestick.js b/Candlestick.js index 42531266c..30f31dff6 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -153,13 +153,9 @@ function onDragFinished() { - if (timePeriod <= _1_HOUR_IN_MILISECONDS) { + recalculateCandles(); + console.log("onDragFinished"); - recalculateCandles(); - - console.log("onDragFinished"); - - } } From 8eec1e2d243de91735bfe58e9354c2acbd65851c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 15:54:35 +0100 Subject: [PATCH 035/176] sideDays --- Candlestick.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index 30f31dff6..992337797 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -359,8 +359,8 @@ 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); + leftDate.setUTCDate(leftDate.getUTCDate() - daysOnSides); + rightDate.setUTCDate(rightDate.getUTCDate() + daysOnSides); let currentDate = new Date(leftDate.getTime()); @@ -415,11 +415,13 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. + let daysOnSides = getSideDays(timePeriod); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); - leftDate.setUTCDate(leftDate.getUTCDate() - 1); - rightDate.setUTCDate(rightDate.getUTCDate() + 2); + leftDate.setUTCDate(leftDate.getUTCDate() - daysOnSides); + rightDate.setUTCDate(rightDate.getUTCDate() + daysOnSides); candles = []; From 105e42733ecc3be75f166c38351c338f5a9055ae Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 16:53:32 +0100 Subject: [PATCH 036/176] setDatetime removed --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 17 ++--------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index aa4f26c4ce244a4e50c8a3774a8a77973211878d..d4cf35094de465053fdc6000dae9b4cc71b6aa4a 100644 GIT binary patch delta 95 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjjrpt5+s%E@awZ dBe@Es2nu!s*_=Q&4-hj?7IbXee8Ap;2>{Dm6e0is delta 134 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgXFq+i!_SY%XNl sU?X`DBnbr recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length); } From 04f2d8c8d08ad6ff4b9506b8c970ed5e23f64e6a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 17:01:02 +0100 Subject: [PATCH 037/176] fileCursorCache --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 16896 bytes Candlestick.js | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index d4cf35094de465053fdc6000dae9b4cc71b6aa4a..d8d73d14b3552df65b99f6af1978e08e441dfc86 100644 GIT binary patch delta 66 zcmZo@VQgq&+>pb>IzhkeSMugUrr*r04LS5a1k;DFDPgK+HT@(6Mdv I0ec4~0JLWjg8%>k delta 66 zcmZo@VQgq&+>pb>y1>4AWzyzCrr*r07gjJ{h}c}nw!uPj6(a*2>;|$qfjk}{W}YnQ L*tYqAy#o^fvCk1^ diff --git a/Candlestick.js b/Candlestick.js index 2f528d396..c8f86ed7f 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -199,10 +199,12 @@ if (currentDate !== newDate) { if (timePeriod < _1_HOUR_IN_MILISECONDS) { - /* - recalculateCandles(); + fileCursorCache.setDatetime(newDatetime); + /* + recalculateCandles(); + console.log("setDatetime"); */ } From 4158dcb39f937513369f7049f39632f63287c6c4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 17:10:54 +0100 Subject: [PATCH 038/176] setTimePeriod --- Candlestick.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index c8f86ed7f..81ad5c9cd 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -185,6 +185,13 @@ } } + + if (timePeriod === _1_HOUR_IN_MILISECONDS) { + + fileCursorCache.setDatetime(datetime); + + } + } function setDatetime(newDatetime) { @@ -198,15 +205,10 @@ if (currentDate !== newDate) { - if (timePeriod < _1_HOUR_IN_MILISECONDS) { + if (timePeriod <= _1_HOUR_IN_MILISECONDS) { fileCursorCache.setDatetime(newDatetime); - /* - recalculateCandles(); - - console.log("setDatetime"); - */ } } } From 495df69da10c32205af6598bde7187489b8ad952 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 17:52:45 +0100 Subject: [PATCH 039/176] recalculateCandlesUsingDailyFiles --- Candlestick.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index 81ad5c9cd..8b952f654 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -352,8 +352,13 @@ let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); - leftDate.setUTCDate(leftDate.getUTCDate() - daysOnSides); - rightDate.setUTCDate(rightDate.getUTCDate() + daysOnSides); + // leftDate.setUTCDate(leftDate.getUTCDate() - daysOnSides); + // rightDate.setUTCDate(rightDate.getUTCDate() + daysOnSides); + + let dateDiff = rightDate.valueOf() - leftDate.valueOf(); + + leftDate = new Date(leftDate.valueOf() - dateDiff); + rightDate = new Date(rightDate.valueOf() + dateDiff); let currentDate = new Date(leftDate.getTime()); From 06d98aa89636a73679c95612e5d446a42d72fc59 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 18:03:30 +0100 Subject: [PATCH 040/176] recalculateCandlesUsingDailyFiles fixed --- Candlestick.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index 8b952f654..a375a47b0 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -360,11 +360,11 @@ leftDate = new Date(leftDate.valueOf() - dateDiff); rightDate = new Date(rightDate.valueOf() + dateDiff); - let currentDate = new Date(leftDate.getTime()); + let currentDate = new Date(leftDate.valueOf()); candles = []; - while (currentDate.getTime() <= rightDate.getTime()) { + while (currentDate.valueOf() <= rightDate.valueOf()) { let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); @@ -389,19 +389,21 @@ 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()) { - if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { + candles.push(candle); - candlesticks.currentCandle = candle; - candlesticks.container.eventHandler.raiseEvent("Current Candle Changed", candlesticks.currentCandle); + if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { + candlesticks.currentCandle = candle; + candlesticks.container.eventHandler.raiseEvent("Current Candle Changed", candlesticks.currentCandle); + + } } } - } - currentDate.setUTCDate(currentDate.getUTCDate() + 1); + currentDate = new Date( currentDate.valueOf + 24 * 60 * 60 * 1000); } console.log("Olivia > recalculateCandlesUsingDailyFiles > total candles generated : " + candles.length); From f7152dddcded66c6fca061554cfb3cd6de47e7e1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 18:07:01 +0100 Subject: [PATCH 041/176] ONE_DAY_IN_MILISECONDS --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index d8d73d14b3552df65b99f6af1978e08e441dfc86..061bee66353236423ee70bb51105ef688bcf7c4b 100644 GIT binary patch delta 144 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{Y`H83+xO>eE@b-6 x%v#XWVV1kOkZps7WC%z(6huMUJU~A4WI@Na%?Ioqm^RrdGD_AVDVvE^835S|9RvUX delta 106 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjj@(%YG$qE@b-6 n%-Z1N{u9V#+h8HN1*8rN&H-tlDGWS7%sg4pv2F7Kdj}=}I-eN{ diff --git a/Candlestick.js b/Candlestick.js index a375a47b0..0cf00c799 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -403,7 +403,7 @@ } } - currentDate = new Date( currentDate.valueOf + 24 * 60 * 60 * 1000); + currentDate = new Date(currentDate.valueOf() + ONE_DAY_IN_MILISECONDS); } console.log("Olivia > recalculateCandlesUsingDailyFiles > total candles generated : " + candles.length); From 117f9f1f61f58257d728404ce051d44e1777bf6f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 18:14:04 +0100 Subject: [PATCH 042/176] console.log("Olivia > recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length); --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 061bee66353236423ee70bb51105ef688bcf7c4b..b7df5c1e30748a98c1d4c8e6f2db4d7d6b61571e 100644 GIT binary patch delta 106 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjj@ZU+U*=E@b-6 n%$ktJE&*h+ZLpAB0a6bICxC1RAe#q>nI{W6wrxIO@4y5A{Aw4x delta 145 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgXF#2HW@NY%XN_ y&CFWR(qWdnxsYvxg=7dwJrqPi**ri#^JGECw#^6Z9hf%RDKbjdAt{@QRT%&gza4-8 diff --git a/Candlestick.js b/Candlestick.js index 0cf00c799..ed1c1a6b0 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -352,9 +352,6 @@ let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); - // leftDate.setUTCDate(leftDate.getUTCDate() - daysOnSides); - // rightDate.setUTCDate(rightDate.getUTCDate() + daysOnSides); - let dateDiff = rightDate.valueOf() - leftDate.valueOf(); leftDate = new Date(leftDate.valueOf() - dateDiff); @@ -420,8 +417,10 @@ let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); - leftDate.setUTCDate(leftDate.getUTCDate() - daysOnSides); - rightDate.setUTCDate(rightDate.getUTCDate() + daysOnSides); + let dateDiff = rightDate.valueOf() - leftDate.valueOf(); + + leftDate = new Date(leftDate.valueOf() - dateDiff); + rightDate = new Date(rightDate.valueOf() + dateDiff); candles = []; @@ -446,8 +445,16 @@ candles.push(candle); + if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { + + candlesticks.currentCandle = candle; + candlesticks.container.eventHandler.raiseEvent("Current Candle Changed", candlesticks.currentCandle); + + } } } + + console.log("Olivia > recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length); } From 8c6e924e639ab909ba8480f913d326d19e673f1c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 18:21:08 +0100 Subject: [PATCH 043/176] dateDiff * 1.5) --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 16896 bytes Candlestick.js | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index b7df5c1e30748a98c1d4c8e6f2db4d7d6b61571e..68eff7da1a31be5063d25cd456f5e859c3c5d852 100644 GIT binary patch delta 66 zcmZo@VQgq&+>pb>dcdJqH-B>>({Epb>Izj!Ve%|Inrr*r030dqCKqlJ;3&|CX3~+D)$aVnocz~FBvY=zz J<^%Q)OaOL45H Date: Tue, 20 Feb 2018 18:49:52 +0100 Subject: [PATCH 044/176] rightDate.valueOf() + ONE_DAY_IN_MILISECONDS --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 68eff7da1a31be5063d25cd456f5e859c3c5d852..3fb33d14fed232031b8191878ea80545c1e883a1 100644 GIT binary patch delta 100 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0OgSv90WW@N7jG_P j>$l!yr^qN70a6JC*+6y(kj(?c%##Hj+cqDtcVGelLkbl` delta 61 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTIV`LbYIbSoZ!To( Gw*~-*G7l^O diff --git a/Candlestick.js b/Candlestick.js index 19255d7b6..03d9465b0 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -361,7 +361,7 @@ candles = []; - while (currentDate.valueOf() <= rightDate.valueOf()) { + while (currentDate.valueOf() <= rightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); From 3bb48bb73c3108b27ec30c01deb42b8c4084fc1b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Feb 2018 19:50:43 +0100 Subject: [PATCH 045/176] console.log("draw"); --- Candlestick.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Candlestick.js b/Candlestick.js index 03d9465b0..f1d91a6ac 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -311,10 +311,11 @@ if (timePeriod < _1_HOUR_IN_MILISECONDS) { - if (Math.random() * 100 > 98) { - //recalculateCandles(); + if (Math.random() * 1000 > 995) { - //console.log("draw"); + recalculateCandles(); + + console.log("draw"); } From b7c348c62c9b96fe2d0bdd8a86d6fc9a773da240 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 11:04:54 +0100 Subject: [PATCH 046/176] pTimePeriod --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 9 +++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 3fb33d14fed232031b8191878ea80545c1e883a1..143fa7e00650cefb4083a4a98b69846bc84d4086 100644 GIT binary patch delta 106 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjj!h+arE&E@b-6 o%xX~iVD-<1WIF=cJV4AmS recalculateCandlesUsingDailyFiles > total candles generated : " + candles.length); + //console.log("Olivia > recalculateCandlesUsingDailyFiles > total candles generated : " + candles.length); } @@ -455,7 +452,7 @@ } } - console.log("Olivia > recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length); + //console.log("Olivia > recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length); } From 15d53c26fc2c139137f338c294997a3cd694dee1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 11:09:23 +0100 Subject: [PATCH 047/176] reversed --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 143fa7e00650cefb4083a4a98b69846bc84d4086..f923c4deab6494fb7f13f008f7bca04447c1015d 100644 GIT binary patch delta 87 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0Ot~y9Z|>#)-dxDm cZ@tM*myy>5C@%-ZJYaQ#j%}L{*gG%*0A~yo;s5{u delta 60 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTxhyP|4_5!&T*%gM F4FG Date: Wed, 21 Feb 2018 11:14:05 +0100 Subject: [PATCH 048/176] reversed again! --- Candlestick.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Candlestick.js b/Candlestick.js index f6f45f535..e266132b0 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -66,7 +66,7 @@ cursorCacheInProgress = true; fileCursorCache = newFileCursorCache(); - fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, onFileCursorReady); + fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Candles", "Daily Candlesticks", pExchange, pMarket, pDatetime, pTimePeriod, onFileCursorReady); } } From f341303e1791e7479a024e2f75f8b16272d68648 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 11:33:08 +0100 Subject: [PATCH 049/176] fileCursorCache.setTimePeriod --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 6 ++++++ 2 files changed, 6 insertions(+) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index f923c4deab6494fb7f13f008f7bca04447c1015d..5b0fe4d134e61581054d6feaeb8b6151eef71884 100644 GIT binary patch delta 106 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjjPU%bfmiE@b-6 k%&K7iLk-Ae+h8HN45SVU4nt`kAk92k(6Mdv0ec4~04&lNy#N3J delta 145 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgXF$;oBpAZ!To| z&CF`>=3YLK$+p2lQU|0C3S5BnR3PR7V&=($j%}L{*gG(7vQuP4QDy>^mcvj60DC4L AjsO4v diff --git a/Candlestick.js b/Candlestick.js index e266132b0..92e674363 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -173,6 +173,10 @@ } else { + fileCursorCache.setTimePeriod(pTimePeriod); + + fileCursorCache.setDatetime(datetime); + let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); if (newFileCursor !== undefined) { @@ -186,6 +190,8 @@ if (timePeriod === _1_HOUR_IN_MILISECONDS) { + fileCursorCache.setTimePeriod(pTimePeriod); + fileCursorCache.setDatetime(datetime); } From 958e4c14a35e0cc6c8d8aa25e8380a74674c795d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 11:55:37 +0100 Subject: [PATCH 050/176] File missing while calculating candles, scheduling a recalculation in 1 second. --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 16896 bytes Candlestick.js | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 5b0fe4d134e61581054d6feaeb8b6151eef71884..c7ea17df2de25e6a3539ffe9513584a76e5bc89b 100644 GIT binary patch delta 68 zcmZo@VQgq&+>pb>HbE-1mTC3oBBo!=Y!iMisRpsx)>}wcGcv%z3?MrP$m0QG=E;JN LZJQ6+J1_wN&ngk| delta 68 zcmZo@VQgq&+>pb>Ca}27>Hn(DMNGe#*%ZuwsDapQ>n$XgF(ANUD3b?BGfx(DY} Date: Wed, 21 Feb 2018 11:57:51 +0100 Subject: [PATCH 051/176] 5 sec --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index c7ea17df2de25e6a3539ffe9513584a76e5bc89b..5758cfb22dec54d107f34532d0b6bf9e601bbdea 100644 GIT binary patch delta 87 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgSt9PTWT~7cl){ eW@)(a==A0Swv85yNt>1I?=fw%Q)Fb!1~UPeU>M8* delta 76 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIV=;TLTfh{F#Ta> WnecN-_2vS$jTVg6o0aVEF#!OfO%;Iv diff --git a/Candlestick.js b/Candlestick.js index 9ad2a7bc3..45e50dac2 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -404,9 +404,9 @@ } } else { - setTimeout(recalculateCandlesUsingDailyFiles, 1000); + setTimeout(recalculateCandlesUsingDailyFiles, 5000); - console.log("File missing while calculating candles, scheduling a recalculation in 1 second."); + console.log("File missing while calculating candles, scheduling a recalculation in 5 seconds."); } From 1111b12b7d11c71eaef37f444ee9ff1fd8ac50d1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 11:59:05 +0100 Subject: [PATCH 052/176] removed --- Candlestick.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Candlestick.js b/Candlestick.js index 45e50dac2..b0f54fa14 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -404,7 +404,7 @@ } } else { - setTimeout(recalculateCandlesUsingDailyFiles, 5000); + //setTimeout(recalculateCandlesUsingDailyFiles, 5000); console.log("File missing while calculating candles, scheduling a recalculation in 5 seconds."); From 13597eff64eed3bca939405141e3e3a5818aa774 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 12:07:18 +0100 Subject: [PATCH 053/176] Lests check if all the visible screen is going to be covered by candles --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 28 ++++++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 5758cfb22dec54d107f34532d0b6bf9e601bbdea..40c67a3b57adbc1fafe07bed9f4554021d7647d7 100644 GIT binary patch delta 106 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjjnYb}F!JE@b-6 n%(@_dzBrJ{w!uQO6QmvrW&+vVKsFB$Gfx(DY}k=0& delta 145 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgXFqPTWVCHWxDe wW@c@;@aQy<$+p2lG6|#}3T6P=IY2fK5Hn8}bZpyvz}|srlbs@?WHv!%00jab0ssI2 diff --git a/Candlestick.js b/Candlestick.js index b0f54fa14..bb224383b 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -358,14 +358,14 @@ let dateDiff = rightDate.valueOf() - leftDate.valueOf(); - leftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); - rightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); + let farLeftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); + let farRightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); - let currentDate = new Date(leftDate.valueOf()); + let currentDate = new Date(farLeftDate.valueOf()); candles = []; - while (currentDate.valueOf() <= rightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { + while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); @@ -390,7 +390,7 @@ if (candle.open < candle.close) { candle.direction = 'up'; } if (candle.open === candle.close) { candle.direction = 'side'; } - if (candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) { + if (candle.begin >= farLeftDate.valueOf() && candle.end <= farRightDate.valueOf()) { candles.push(candle); @@ -402,17 +402,21 @@ } } } - } else { - - //setTimeout(recalculateCandlesUsingDailyFiles, 5000); - - console.log("File missing while calculating candles, scheduling a recalculation in 5 seconds."); - - } + } currentDate = new Date(currentDate.valueOf() + ONE_DAY_IN_MILISECONDS); } + /* Lests check if all the visible screen is going to be covered by candles. */ + + if (candles[0].begin > leftDate.valueOf() || candles[candles.length - 1].end > rightDate.valueOf()) { + + //setTimeout(recalculateCandlesUsingDailyFiles, 5000); + + console.log("File missing while calculating candles, scheduling a recalculation in 5 seconds."); + + } + //console.log("Olivia > recalculateCandlesUsingDailyFiles > total candles generated : " + candles.length); } From f5deb7cffe8713cff589fe47ad45b04643e55276 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 12:12:06 +0100 Subject: [PATCH 054/176] lowerEnd --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 5 ++++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 40c67a3b57adbc1fafe07bed9f4554021d7647d7..8efaf6e6f5942a45c6575ec41cb6a5bf68c7e89f 100644 GIT binary patch delta 99 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0OgStp6SlXX++4sm i!FrROBBNvrNFfx=1G0U9Y#tzHo-F9tw)ud)0}}u>nH6FH delta 60 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTIV>y-^5=_hE?}Er F4FGnw4v+u< diff --git a/Candlestick.js b/Candlestick.js index bb224383b..0aeab58bd 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -409,7 +409,10 @@ /* Lests check if all the visible screen is going to be covered by candles. */ - if (candles[0].begin > leftDate.valueOf() || candles[candles.length - 1].end > rightDate.valueOf()) { + let lowerEnd = leftDate.valueOf(); + let upperEnd = removeTime(rightDate).valueOf() + ONE_DAY_IN_MILISECONDS; + + if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { //setTimeout(recalculateCandlesUsingDailyFiles, 5000); From d95d6555dba5730f4a29968929c5b257bcf93ae3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 12:18:34 +0100 Subject: [PATCH 055/176] let upperEnd = rightDate.valueOf(); --- Candlestick.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Candlestick.js b/Candlestick.js index 0aeab58bd..6ed82b213 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -410,7 +410,7 @@ /* Lests check if all the visible screen is going to be covered by candles. */ let lowerEnd = leftDate.valueOf(); - let upperEnd = removeTime(rightDate).valueOf() + ONE_DAY_IN_MILISECONDS; + let upperEnd = rightDate.valueOf(); if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { From 322365edc426d1f06075b0d7cdb92a3145bb0dc3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 12:23:26 +0100 Subject: [PATCH 056/176] uncomment --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 16896 bytes Candlestick.js | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 8efaf6e6f5942a45c6575ec41cb6a5bf68c7e89f..32e729be95cce189d23e9f3da9a881d9c20626af 100644 GIT binary patch delta 95 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?hPIjjP+7DlmcE@awZ cBiRm81O*F#Y#tyRgqbG`I<{>-VDG>L0HvK1EdT%j delta 134 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8O{OgXFyhjuEkY%XNl sU?bTHQUnDvfoyIdn+J%QCkr~ZZ9ZV{z_iIukx{Y*N!dIg+Xq7#0QZ_1I{*Lx diff --git a/Candlestick.js b/Candlestick.js index 6ed82b213..0955b75d7 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -414,9 +414,9 @@ if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { - //setTimeout(recalculateCandlesUsingDailyFiles, 5000); + setTimeout(recalculateCandlesUsingDailyFiles, 2000); - console.log("File missing while calculating candles, scheduling a recalculation in 5 seconds."); + console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); } From 6e2b889b45efb07b05130b3b9eea9137a6461078 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 12:25:55 +0100 Subject: [PATCH 057/176] uncomment --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 16896 bytes Candlestick.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 32e729be95cce189d23e9f3da9a881d9c20626af..8f519847af888a1a57dca5de96fa468e166506dd 100644 GIT binary patch delta 53 zcmZo@VQgq&+>pb>Qt+j6$L0d2Kg_Hb%8zVf+g!-D$AWheBLf2;0|NsO5Hn8}bZpyv Iz}|rg01B=U_y7O^ delta 53 zcmZo@VQgq&+>pb>A~0)V)aC-FKg_HXwzr>T*<8rB$AWhOBLf2u0|YZq7IbXee8Ap; F2>{*r58MC% diff --git a/Candlestick.js b/Candlestick.js index 0955b75d7..4e3be3028 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -416,7 +416,7 @@ setTimeout(recalculateCandlesUsingDailyFiles, 2000); - console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); + //console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); } From aec04f241cc48c015e6e0d510bb57f3de840d111 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 13:00:23 +0100 Subject: [PATCH 058/176] recalculateCandles --- .vs/AAOlivia-Plotter/v15/.suo | Bin 16896 -> 17920 bytes Candlestick.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 8f519847af888a1a57dca5de96fa468e166506dd..b9c2e244a13ba870c88652332816aa7b83805320 100644 GIT binary patch delta 88 zcmZo@VQlDOoM0f!!~g{X3=AwlCL<94`~UwxNR)Z9BZvLQgc8P0OgSv90c{5xxi=TG d^;>VU(`Dpc092_7RKx>TDCpR>`GCCx698DT6iEO8 delta 61 zcmZqZVQgq&oM0f!00ROH41z#5BM|@l|NlQom~pZrhyBKc62?tTIV`Lf%8zVf+g!-j GZw&y85D$+4 diff --git a/Candlestick.js b/Candlestick.js index 4e3be3028..e6a146c33 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -414,7 +414,7 @@ if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { - setTimeout(recalculateCandlesUsingDailyFiles, 2000); + setTimeout(recalculateCandles, 2000); //console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); From b815e553dbc6e29403305ce1dde35bf8768ed8f5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 14:59:07 +0100 Subject: [PATCH 059/176] layerStatus = pLayerStatus; --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 21 +++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index b9c2e244a13ba870c88652332816aa7b83805320..ffb240e45a82bd20176502ecb3295df1f984bd6e 100644 GIT binary patch delta 161 zcmZqZVQlDO+>pb>YS3adQF?PB6FVd0-OZKEpP5)c==~R$*<8p55n-pb>TJWWE2ixXCCU!=~>zgZ?KQplgv>j~Z-dxBA5n-kh{^LDWF~W1Hf?T^&zHa=v176U6WitkmWiyA?Tid?un5TJ1M+x)n0d0GW83Bf S_KD0WN)`Z>Xrd``U;+S8M=SvV diff --git a/Candlestick.js b/Candlestick.js index e6a146c33..ec731f879 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -1,12 +1,6 @@ function newAAMastersAAOliviaCandlesticks() { - var candles = []; - var plotArea = newPlotArea(); - - let timePeriod; - var datetime; - - var candlesticks = { + let candlesticks = { onLayerStatusChanged: onLayerStatusChanged, currentCandle: undefined, positionAtDatetime: positionAtDatetime, @@ -26,16 +20,25 @@ container.zoom.containerName = "AAMasters AAOlivia Candlesticks"; container.frame.containerName = "AAMasters AAOlivia Candlesticks"; + let candles = []; + let plotArea = newPlotArea(); + + let timePeriod; + let datetime; + let marketFile; let fileCursor; let layerStatus = 'off'; let fileCache; + let fileCursorCache; return candlesticks; - function initialize(pExchange, pMarket, pDatetime, pTimePeriod, chartLayersPanel, callBackFunction) { + function initialize(pExchange, pMarket, pDatetime, pTimePeriod, pLayerStatus, callBackFunction) { + + layerStatus = pLayerStatus; let cursorCacheInProgress = false; let finaleStepsInProgress = false; @@ -93,8 +96,6 @@ recalculateScale(); // With any of the market files we can calculate the scale. - layerStatus = chartLayersPanel.getLayerStatus(chartLayersPanel.layerNames.OLIVIA_CANDLES); - recalculateCandles(); postitionViewPort(); From 460b5416f45caabccf0825fb14d77c4933d583a1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 15:02:23 +0100 Subject: [PATCH 060/176] layerStatus = pLayerStatus; --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index ffb240e45a82bd20176502ecb3295df1f984bd6e..3a2dca80319c2376e5055fe88ce075030c0aad3a 100644 GIT binary patch delta 56 zcmZqZVQlDO+>pb>dSGk5hRo(drr*pg0e8=rY%XBiXu&JPfB>4C_3ZyMGlHl~OaKvv B5TXD8 delta 72 zcmZqZVQlDO+>pb>YS3adQF?PB({E;$4|@N_Hy5yNwBWtP$N&e7oAvDfGxHh)1r&go R2Z)&`3p%!KK49;_1OWHG5*Gjf diff --git a/Candlestick.js b/Candlestick.js index ec731f879..ec976a7a7 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -38,8 +38,6 @@ function initialize(pExchange, pMarket, pDatetime, pTimePeriod, pLayerStatus, callBackFunction) { - layerStatus = pLayerStatus; - let cursorCacheInProgress = false; let finaleStepsInProgress = false; @@ -96,6 +94,8 @@ recalculateScale(); // With any of the market files we can calculate the scale. + layerStatus = pLayerStatus; + recalculateCandles(); postitionViewPort(); From 82b6e369280483050e47650b30febae305a9ca45 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 15:04:29 +0100 Subject: [PATCH 061/176] replaces var for let --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 40 +++++++++++++++------------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 3a2dca80319c2376e5055fe88ce075030c0aad3a..03f2e380655a765f78f81286615a832e695be314 100644 GIT binary patch delta 99 zcmZqZVQlDO+>pb>@?g%-eVYrI{xGvV`11Jn<^r~j7Lp7|Kmf>A2Vx!|W}YnQ*tYqA SeIhf85?>|;24OTM4om=U-4+D^ delta 99 zcmZqZVQlDO+>pb>a$sw|#^wU1Kg=uvch8q>E@0beAt}Rv0Gd!H50GY_Ea=*{`G9>Q JGeIQ|OaQmw6SV*U diff --git a/Candlestick.js b/Candlestick.js index ec976a7a7..de3585545 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -12,14 +12,10 @@ initialize: initialize }; - var container = newContainer(); + let container = newContainer(); container.initialize(); candlesticks.container = container; - container.displacement.containerName = "AAMasters AAOlivia Candlesticks"; - container.zoom.containerName = "AAMasters AAOlivia Candlesticks"; - container.frame.containerName = "AAMasters AAOlivia Candlesticks"; - let candles = []; let plotArea = newPlotArea(); @@ -118,7 +114,7 @@ if (layerStatus !== 'on') { return; } - var container; + let container; /* First we check if this point is inside this space. */ @@ -374,9 +370,9 @@ if (dailyFile !== undefined) { - for (var i = 0; i < dailyFile.length; i++) { + for (let i = 0; i < dailyFile.length; i++) { - var candle = newCandle(); + let candle = newCandle(); candle.min = dailyFile[i][0]; candle.max = dailyFile[i][1]; @@ -442,9 +438,9 @@ candles = []; - for (var i = 0; i < marketFile.length; i++) { + for (let i = 0; i < marketFile.length; i++) { - var candle = newCandle(); + let candle = newCandle(); candle.min = marketFile[i][0]; candle.max = marketFile[i][1]; @@ -484,12 +480,12 @@ if (plotArea.maxValue > 0) { return; } // Already calculated. - var minValue = { + let minValue = { x: EARLIEST_DATE.valueOf(), y: 0 }; - var maxValue = { + let maxValue = { x: MAX_PLOTABLE_DATE.valueOf(), y: nextPorwerOf10(getMaxRate()) }; @@ -506,7 +502,7 @@ let maxValue = 0; - for (var i = 0; i < marketFile.length; i++) { + for (let i = 0; i < marketFile.length; i++) { let currentMax = marketFile[i][1]; // 1 = rates. @@ -533,26 +529,26 @@ /* Now we calculate and plot the candles */ - for (var i = 0; i < candles.length; i++) { + for (let i = 0; i < candles.length; i++) { candle = candles[i]; - var candlePoint1 = { + let candlePoint1 = { x: candle.begin + timePeriod / 7 * 1.5, y: candle.open }; - var candlePoint2 = { + let candlePoint2 = { x: candle.begin + timePeriod / 7 * 5.5, y: candle.open }; - var candlePoint3 = { + let candlePoint3 = { x: candle.begin + timePeriod / 7 * 5.5, y: candle.close }; - var candlePoint4 = { + let candlePoint4 = { x: candle.begin + timePeriod / 7 * 1.5, y: candle.close }; @@ -576,22 +572,22 @@ candlePoint3 = viewPort.fitIntoVisibleArea(candlePoint3); candlePoint4 = viewPort.fitIntoVisibleArea(candlePoint4); - var stickPoint1 = { + let stickPoint1 = { x: candle.begin + timePeriod / 7 * 3.2, y: candle.max }; - var stickPoint2 = { + let stickPoint2 = { x: candle.begin + timePeriod / 7 * 3.8, y: candle.max }; - var stickPoint3 = { + let stickPoint3 = { x: candle.begin + timePeriod / 7 * 3.8, y: candle.min }; - var stickPoint4 = { + let stickPoint4 = { x: candle.begin + timePeriod / 7 * 3.2, y: candle.min }; From 314e88ec58183b6a0f1b7594385bd245a8b00a9a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 15:19:51 +0100 Subject: [PATCH 062/176] Tyding Things up.. --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 65 ++++++++++++---------------------- 2 files changed, 23 insertions(+), 42 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 03f2e380655a765f78f81286615a832e695be314..83d13e8cc01a4560c48620e623d6fa855d4a0a79 100644 GIT binary patch delta 77 zcmZqZVQlDO+>pb>df*Y)X1UFUOuv~~4a`_R0-0=kEO?a|7#Na)m-9 delta 77 zcmZqZVQlDO+>pb>`e4q_eKMO1nSL{~KKSzZHjv4-$AVXYfq_9Ch recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length); } - - - function recalculateScale() { if (marketFile === undefined) { return; } // We need the market file to be loaded to make the calculation. @@ -517,12 +486,6 @@ } - - - - - - function plotCandleChart() { if (candles.length > 0) { @@ -707,6 +670,24 @@ } } + function onLayerStatusChanged(eventData) { + if (eventData.layer === 'Olivia Candlesticks') { + layerStatus = eventData.status; + } + + } + + function onZoomChanged(event) { + + recalculateCandles(); + + } + + function onDragFinished() { + + recalculateCandles(); + + } } From 39babc126ab89611e31dccb5030975be66d8f21c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 15:37:49 +0100 Subject: [PATCH 063/176] comments --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 17920 bytes Candlestick.js | 143 ++++++++++++++++++---------------- 2 files changed, 77 insertions(+), 66 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 83d13e8cc01a4560c48620e623d6fa855d4a0a79..f26980059775b37409c30427ad9927131c79c014 100644 GIT binary patch delta 101 zcmZqZVQlDO+>pb>x*$llOmTA|({E;0fiuhNflRgy7Lq&+2%rvR3IH)kjCr!4Yun}n R_KD1r{0J2c*pxUh0RV`G69WJM delta 101 zcmZqZVQlDO+>pb>df*Y)X1UFUOuv~~4a`_R0-09_fD(|M48%M@%sg4pv2F7K L`$T4fN*tH~uFMmu diff --git a/Candlestick.js b/Candlestick.js index cb8ae14f5..f3d92c615 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -1,36 +1,47 @@ function newAAMastersAAOliviaCandlesticks() { - let candlesticks = { + let thisObject = { + + // Main functions and properties. + initialize: initialize, - currentCandle: undefined, container: undefined, getContainer: getContainer, setTimePeriod: setTimePeriod, setDatetime: setDatetime, - positionAtDatetime: positionAtDatetime, draw: draw, + + // Secondary functions. + + currentCandle: undefined, + positionAtDatetime: positionAtDatetime, onLayerStatusChanged: onLayerStatusChanged }; - let container = newContainer(); + /* this is part of the module template */ + + let container = newContainer(); // Do not touch this 3 lines, they are just needed. container.initialize(); - candlesticks.container = container; + thisObject.container = container; - let candles = []; - let plotArea = newPlotArea(); + let layerStatus = 'off'; // Since the moduleis a layer, it must handle the different possible layer status. - let timePeriod; - let datetime; + let plotArea = newPlotArea(); // Needed to be able to plot on the timeline, otherwise not. - let marketFile; - let fileCursor; + let timePeriod; // This will hold the current Time Period the user is at. + let datetime; // This will hold the current Datetime the user is at. - let layerStatus = 'off'; + let marketFile; // This is the current Market File being plotted. + let fileCursor; // This is the current File Cursor being used to retrieve Daily Files. - let fileCache; - let fileCursorCache; + let fileCache; // This object will provide the different Market Files at different Time Periods. + let fileCursorCache; // This object will provide the different File Cursors at different Time Periods. - return candlesticks; + /* these are module specific variables: */ + + let candles = []; // Here we keep the candles to be ploted every time the Draw() function is called by the AAWebPlatform. + + return thisObject; function initialize(pExchange, pMarket, pDatetime, pTimePeriod, pLayerStatus, callBackFunction) { @@ -70,7 +81,7 @@ function onFileCursorReady() { - recalculateCandles(); + recalculate(); let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); @@ -92,7 +103,7 @@ layerStatus = pLayerStatus; - recalculateCandles(); + recalculate(); postitionViewPort(); viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); @@ -141,7 +152,7 @@ marketFile = newMarketFile; - recalculateCandles(); + recalculate(); } @@ -157,7 +168,7 @@ fileCursor = newFileCursor; - recalculateCandles(); + recalculate(); } } @@ -200,8 +211,8 @@ y: candles[Math.round(candles.length / 2)].min + (candles[Math.round(candles.length / 2)].max - candles[Math.round(candles.length / 2)].min) }; - targetPoint = plotArea.inverseTransform(targetPoint, candlesticks.container.frame.height); - targetPoint = transformThisPoint(targetPoint, candlesticks.container); + targetPoint = plotArea.inverseTransform(targetPoint, thisObject.container.frame.height); + targetPoint = transformThisPoint(targetPoint, thisObject.container); let displaceVector = { x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.topLeft.x) / 2 - targetPoint.x, @@ -232,24 +243,24 @@ y: candles[i].open }; - targetPoint = plotArea.inverseTransform(targetPoint, candlesticks.container.frame.height); - targetPoint = transformThisPoint(targetPoint, candlesticks.container); + targetPoint = plotArea.inverseTransform(targetPoint, thisObject.container.frame.height); + targetPoint = transformThisPoint(targetPoint, thisObject.container); let targetMax = { x: value, y: candles[i].max }; - targetMax = plotArea.inverseTransform(targetMax, candlesticks.container.frame.height); - targetMax = transformThisPoint(targetMax, candlesticks.container); + targetMax = plotArea.inverseTransform(targetMax, thisObject.container.frame.height); + targetMax = transformThisPoint(targetMax, thisObject.container); let targetMin = { x: value, y: candles[i].min }; - targetMin = plotArea.inverseTransform(targetMin, candlesticks.container.frame.height); - targetMin = transformThisPoint(targetMin, candlesticks.container); + targetMin = plotArea.inverseTransform(targetMin, thisObject.container.frame.height); + targetMin = transformThisPoint(targetMin, thisObject.container); let center = { x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2, @@ -289,7 +300,7 @@ if (Math.random() * 1000 > 995) { - recalculateCandles(); + recalculate(); } @@ -300,31 +311,31 @@ } - function recalculateCandles() { + function recalculate() { if (layerStatus === 'off') { return; } if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - recalculateCandlesUsingMarketFiles(); + recalculateUsingMarketFiles(); } else { - recalculateCandlesUsingDailyFiles(); + recalculateUsingDailyFiles(); } - candlesticks.container.eventHandler.raiseEvent("Candles Changed", candles); + thisObject.container.eventHandler.raiseEvent("Candles Changed", candles); } - function recalculateCandlesUsingDailyFiles() { + function recalculateUsingDailyFiles() { if (fileCursor.files.size === 0) { return;} // We need to wait until there are files in the cursor let daysOnSides = getSideDays(timePeriod); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, plotArea); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, plotArea); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -366,8 +377,8 @@ if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { - candlesticks.currentCandle = candle; - candlesticks.container.eventHandler.raiseEvent("Current Candle Changed", candlesticks.currentCandle); + thisObject.currentCandle = candle; + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); } } @@ -384,24 +395,24 @@ if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { - setTimeout(recalculateCandles, 2000); + setTimeout(recalculate, 2000); //console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); } - //console.log("Olivia > recalculateCandlesUsingDailyFiles > total candles generated : " + candles.length); + //console.log("Olivia > recalculateUsingDailyFiles > total candles generated : " + candles.length); } - function recalculateCandlesUsingMarketFiles() { + function recalculateUsingMarketFiles() { if (marketFile === undefined) { return; } // Initialization not complete yet. let daysOnSides = getSideDays(timePeriod); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, candlesticks.container, plotArea); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, candlesticks.container, plotArea); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, plotArea); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, plotArea); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -433,14 +444,14 @@ if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { - candlesticks.currentCandle = candle; - candlesticks.container.eventHandler.raiseEvent("Current Candle Changed", candlesticks.currentCandle); + thisObject.currentCandle = candle; + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); } } } - //console.log("Olivia > recalculateCandlesUsingMarketFiles > total candles generated : " + candles.length); + //console.log("Olivia > recalculateUsingMarketFiles > total candles generated : " + candles.length); } function recalculateScale() { @@ -463,8 +474,8 @@ plotArea.initialize( minValue, maxValue, - candlesticks.container.frame.width, - candlesticks.container.frame.height + thisObject.container.frame.width, + thisObject.container.frame.height ); function getMaxRate() { @@ -516,15 +527,15 @@ y: candle.close }; - candlePoint1 = plotArea.inverseTransform(candlePoint1, candlesticks.container.frame.height); - candlePoint2 = plotArea.inverseTransform(candlePoint2, candlesticks.container.frame.height); - candlePoint3 = plotArea.inverseTransform(candlePoint3, candlesticks.container.frame.height); - candlePoint4 = plotArea.inverseTransform(candlePoint4, candlesticks.container.frame.height); + candlePoint1 = plotArea.inverseTransform(candlePoint1, thisObject.container.frame.height); + candlePoint2 = plotArea.inverseTransform(candlePoint2, thisObject.container.frame.height); + candlePoint3 = plotArea.inverseTransform(candlePoint3, thisObject.container.frame.height); + candlePoint4 = plotArea.inverseTransform(candlePoint4, thisObject.container.frame.height); - candlePoint1 = transformThisPoint(candlePoint1, candlesticks.container); - candlePoint2 = transformThisPoint(candlePoint2, candlesticks.container); - candlePoint3 = transformThisPoint(candlePoint3, candlesticks.container); - candlePoint4 = transformThisPoint(candlePoint4, candlesticks.container); + candlePoint1 = transformThisPoint(candlePoint1, thisObject.container); + candlePoint2 = transformThisPoint(candlePoint2, thisObject.container); + candlePoint3 = transformThisPoint(candlePoint3, thisObject.container); + candlePoint4 = transformThisPoint(candlePoint4, thisObject.container); if (candlePoint2.x < viewPort.visibleArea.bottomLeft.x || candlePoint1.x > viewPort.visibleArea.bottomRight.x) { continue; @@ -555,15 +566,15 @@ y: candle.min }; - stickPoint1 = plotArea.inverseTransform(stickPoint1, candlesticks.container.frame.height); - stickPoint2 = plotArea.inverseTransform(stickPoint2, candlesticks.container.frame.height); - stickPoint3 = plotArea.inverseTransform(stickPoint3, candlesticks.container.frame.height); - stickPoint4 = plotArea.inverseTransform(stickPoint4, candlesticks.container.frame.height); + stickPoint1 = plotArea.inverseTransform(stickPoint1, thisObject.container.frame.height); + stickPoint2 = plotArea.inverseTransform(stickPoint2, thisObject.container.frame.height); + stickPoint3 = plotArea.inverseTransform(stickPoint3, thisObject.container.frame.height); + stickPoint4 = plotArea.inverseTransform(stickPoint4, thisObject.container.frame.height); - stickPoint1 = transformThisPoint(stickPoint1, candlesticks.container); - stickPoint2 = transformThisPoint(stickPoint2, candlesticks.container); - stickPoint3 = transformThisPoint(stickPoint3, candlesticks.container); - stickPoint4 = transformThisPoint(stickPoint4, candlesticks.container); + stickPoint1 = transformThisPoint(stickPoint1, thisObject.container); + stickPoint2 = transformThisPoint(stickPoint2, thisObject.container); + stickPoint3 = transformThisPoint(stickPoint3, thisObject.container); + stickPoint4 = transformThisPoint(stickPoint4, thisObject.container); stickPoint1 = viewPort.fitIntoVisibleArea(stickPoint1); stickPoint2 = viewPort.fitIntoVisibleArea(stickPoint2); @@ -633,7 +644,7 @@ innerCandle: candle }; - candlesticks.container.eventHandler.raiseEvent("Current Candle Info Changed", currentCandle); + thisObject.container.eventHandler.raiseEvent("Current Candle Info Changed", currentCandle); } else { @@ -680,13 +691,13 @@ function onZoomChanged(event) { - recalculateCandles(); + recalculate(); } function onDragFinished() { - recalculateCandles(); + recalculate(); } } From 96a8902591d3d277b391072670a55570761ab6e3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 17:52:56 +0100 Subject: [PATCH 064/176] Volume module implemented --- .vs/AAOlivia-Plotter/v15/.suo | Bin 17920 -> 18944 bytes AAOlivia-Plotter.njsproj | 131 +++--- Candlestick.js | 10 +- Volumes.js | 731 ++++++++++++++++++++++++++++++++++ 4 files changed, 802 insertions(+), 70 deletions(-) create mode 100644 Volumes.js diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index f26980059775b37409c30427ad9927131c79c014..b81cdf09cce4d98acaafb42e0a2f8f8020f35257 100644 GIT binary patch delta 916 zcmZqZVQiSfIKe=c0R{vZ7zBZAMj-z8|NnoGFymxL4*QJ>C5)4pa`+xBx))=z`ZA*= zP@;i73T+|=U9jmp}S*W0e*2L>G@DEL4i(*dL=oDx5%f&HKc_5+Xv`azwU5$p$z zN`8|4kg@rIWdk{WK=CIF6N3we=XtoGA)%L5Y&O|TS%({q4-cu^c5cGzupk14k_3dk zd97^;qvQ-EiSf2GZh__ O5}xFEV3LCau}T5D#O?zC delta 462 zcmZpe!r0KmIKe=ci2(`(7#LW9OhzF7_y7NYkSOzHM-Kaq2_=k^m~!|Q1j&{uuD;AD z36yZ)om|CK#b`45D^oM$-N}{A)vSg<;ikzynVT8^Z47J%>kv4zydI>32daY&tb+}# zgB`Aey&I&XnsE}>mdPqy0<1vNIX0CNs)aFvd*&DHk@mO-g-pi~JrYE=Fbs24SF4j0}@MDD42^ zHHl7(Fg#f6ojP! diff --git a/AAOlivia-Plotter.njsproj b/AAOlivia-Plotter.njsproj index 5520c0b58..5d91bdc2c 100644 --- a/AAOlivia-Plotter.njsproj +++ b/AAOlivia-Plotter.njsproj @@ -1,67 +1,70 @@  - - Debug - 2.0 - {096b35ad-f86f-47b9-a99f-04ca93397da8} - - ShowAllFiles - Candlestick.js - . - . - {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - - - - - - - - - - - False - True - 0 - / - http://localhost:48022/ - False - True - http://localhost:1337 - False - - - - - - - CurrentPage - True - False - False - False - - - - - - - - - False - False - - - - + + Debug + 2.0 + {096b35ad-f86f-47b9-a99f-04ca93397da8} + + ShowAllFiles + Candlestick.js + . + . + {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + Code + + + + + + + + + + + + + + + False + True + 0 + / + http://localhost:48022/ + False + True + http://localhost:1337 + False + + + + + + + CurrentPage + True + False + False + False + + + + + + + + + False + False + + + + \ No newline at end of file diff --git a/Candlestick.js b/Candlestick.js index f3d92c615..cd82149c4 100644 --- a/Candlestick.js +++ b/Candlestick.js @@ -11,7 +11,7 @@ setDatetime: setDatetime, draw: draw, - // Secondary functions. + // Secondary functions and properties. currentCandle: undefined, positionAtDatetime: positionAtDatetime, @@ -303,11 +303,9 @@ recalculate(); } - - } - plotCandleChart(); + plotChart(); } @@ -431,7 +429,7 @@ candle.open = marketFile[i][2]; candle.close = marketFile[i][3]; - candle.begin = (new Date(marketFile[i][4])).valueOf(); + candle.begin = (new Date(marketFile[i][4])).valueOf(); //TODO REMOVE THIS candle.end = (new Date(marketFile[i][5])).valueOf(); if (candle.open > candle.close) { candle.direction = 'down'; } @@ -497,7 +495,7 @@ } - function plotCandleChart() { + function plotChart() { if (candles.length > 0) { diff --git a/Volumes.js b/Volumes.js new file mode 100644 index 000000000..ac9504e5f --- /dev/null +++ b/Volumes.js @@ -0,0 +1,731 @@ +function newAAMastersAAOliviaVolumes() { + + let thisObject = { + + // Main functions and properties. + + initialize: initialize, + container: undefined, + getContainer: getContainer, + setTimePeriod: setTimePeriod, + setDatetime: setDatetime, + draw: draw, + + // Secondary functions and properties. + + onLayerStatusChanged: onLayerStatusChanged + }; + + /* this is part of the module template */ + + let container = newContainer(); // Do not touch this 3 lines, they are just needed. + container.initialize(); + thisObject.container = container; + + let layerStatus = 'off'; // Since the moduleis a layer, it must handle the different possible layer status. + + let plotArea = newPlotArea(); // Needed to be able to plot on the timeline, otherwise not. + + let timePeriod; // This will hold the current Time Period the user is at. + let datetime; // This will hold the current Datetime the user is at. + + let marketFile; // This is the current Market File being plotted. + let fileCursor; // This is the current File Cursor being used to retrieve Daily Files. + + let fileCache; // This object will provide the different Market Files at different Time Periods. + let fileCursorCache; // This object will provide the different File Cursors at different Time Periods. + + /* these are module specific variables: */ + + let volumes = []; // Here we keep the volumes to be ploted every time the Draw() function is called by the AAWebPlatform. + + return thisObject; + + function initialize(pExchange, pMarket, pDatetime, pTimePeriod, pLayerStatus, callBackFunction) { + + let cursorCacheInProgress = false; + let finaleStepsInProgress = false; + + datetime = pDatetime; + timePeriod = pTimePeriod; + + fileCache = newFileCache(); + fileCache.initialize("AAMasters", "AAOlivia", "Market Volumes", "Market Volumes", pExchange, pMarket, onFileReady); + + function onFileReady() { + + let newMarketFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); + + if (newMarketFile !== undefined) { + + marketFile = newMarketFile; + + initializeFileCursorCache(); + + } + } + + function initializeFileCursorCache() { + + if (cursorCacheInProgress === false) { + + cursorCacheInProgress = true; + + fileCursorCache = newFileCursorCache(); + fileCursorCache.initialize("AAMasters", "AAOlivia", "Daily Volumes", "Daily Volumes", pExchange, pMarket, pDatetime, pTimePeriod, onFileCursorReady); + + } + } + + function onFileCursorReady() { + + recalculate(); + + let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); + + if (newFileCursor !== undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. + + let stringDate = datetime.getUTCFullYear() + '-' + pad(datetime.getUTCMonth() + 1, 2) + '-' + pad(datetime.getUTCDate(), 2); + + let dailyFile = newFileCursor.files.get(stringDate); + + if (dailyFile !== undefined) { + + if (finaleStepsInProgress === false) { + + finaleStepsInProgress = true; + + fileCursor = newFileCursor; + + recalculateScale(); // With any of the market files we can calculate the scale. + + layerStatus = pLayerStatus; + + recalculate(); + + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + + callBackFunction(); + + } + } + } + + } + + } + + function getContainer(point) { + + if (layerStatus !== 'on') { return; } + + let container; + + /* First we check if this point is inside this space. */ + + if (this.container.frame.isThisPointHere(point) === true) { + + return this.container; + + } else { + + /* This point does not belong to this space. */ + + return undefined; + } + + } + + function setTimePeriod(pTimePeriod) { + + timePeriod = pTimePeriod; + + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + + let newMarketFile = fileCache.getFile(pTimePeriod); + + if (newMarketFile !== undefined) { + + marketFile = newMarketFile; + + recalculate(); + + } + + } else { + + fileCursorCache.setTimePeriod(pTimePeriod); + + fileCursorCache.setDatetime(datetime); + + let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); + + if (newFileCursor !== undefined) { + + fileCursor = newFileCursor; + + recalculate(); + + } + } + + if (timePeriod === _1_HOUR_IN_MILISECONDS) { + + fileCursorCache.setTimePeriod(pTimePeriod); + + fileCursorCache.setDatetime(datetime); + + } + + } + + function setDatetime(newDatetime) { + + /* If there is a change in the day, then we take some actions, otherwise, we dont. */ + + let currentDate = Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS); + let newDate = Math.trunc(newDatetime.valueOf() / ONE_DAY_IN_MILISECONDS); + + datetime = newDatetime; + + if (currentDate !== newDate) { + + if (timePeriod <= _1_HOUR_IN_MILISECONDS) { + + fileCursorCache.setDatetime(newDatetime); + + } + } + } + + function draw() { + + if (layerStatus !== 'on') { return; } + + this.container.frame.draw(); + + if (timePeriod < _1_HOUR_IN_MILISECONDS) { + + if (Math.random() * 1000 > 995) { + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } + } + + plotChart(); + + } + + function recalculate() { + + if (layerStatus === 'off') { return; } + + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + + recalculateUsingMarketFiles(); + + } else { + + recalculateUsingDailyFiles(); + + } + + thisObject.container.eventHandler.raiseEvent("Volumes Changed", volumes); + } + + function recalculateUsingDailyFiles() { + + if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor + + let daysOnSides = getSideDays(timePeriod); + + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, plotArea); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, plotArea); + + let dateDiff = rightDate.valueOf() - leftDate.valueOf(); + + let farLeftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); + let farRightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); + + let currentDate = new Date(farLeftDate.valueOf()); + + volumes = []; + + while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { + + let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); + + let dailyFile = fileCursor.files.get(stringDate); + + if (dailyFile !== undefined) { + + for (let i = 0; i < dailyFile.length; i++) { + + var volume = newVolumeBar(); + + volume.begin = (new Date(marketIndex.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS + volume.end = (new Date(marketIndex.volumes[i][3])).valueOf(); + + volume.amountBuy = marketIndex.volumes[i][0]; + volume.amountSell = marketIndex.volumes[i][1]; + + if (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) { + + volumes.push(volume); + + if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { + + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); + + } + } + } + } + + currentDate = new Date(currentDate.valueOf() + ONE_DAY_IN_MILISECONDS); + } + + /* Lests check if all the visible screen is going to be covered by volumes. */ + + let lowerEnd = leftDate.valueOf(); + let upperEnd = rightDate.valueOf(); + + if (volumes[0].begin > lowerEnd || volumes[volumes.length - 1].end < upperEnd) { + + setTimeout(recalculate, 2000); + + //console.log("File missing while calculating volumes, scheduling a recalculation in 2 seconds."); + + } + + //console.log("Olivia > recalculateUsingDailyFiles > total volumes generated : " + volumes.length); + + } + + function recalculateUsingMarketFiles() { + + if (marketFile === undefined) { return; } // Initialization not complete yet. + + let daysOnSides = getSideDays(timePeriod); + + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, plotArea); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, plotArea); + + let dateDiff = rightDate.valueOf() - leftDate.valueOf(); + + leftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); + rightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); + + volumes = []; + + for (let i = 0; i < marketFile.length; i++) { + + var volume = newVolumeBar(); + + volume.begin = (new Date(marketIndex.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS + volume.end = (new Date(marketIndex.volumes[i][3])).valueOf(); + + volume.amountBuy = marketIndex.volumes[i][0]; + volume.amountSell = marketIndex.volumes[i][1]; + + if (volume.begin >= leftDate.valueOf() && volume.end <= rightDate.valueOf()) { + + volumes.push(volume); + + if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { + + thisObject.container.eventHandler.raiseEvent("Current Volume Changed", thisObject.currentCandle); + + } + } + } + + //console.log("Olivia > recalculateUsingMarketFiles > total volumes generated : " + volumes.length); + } + + function recalculateScaleX() { + + + var minValue = { + x: EARLIEST_DATE.valueOf() + }; + + var maxValue = { + x: MAX_PLOTABLE_DATE.valueOf() + }; + + plotArea.initializeX( + minValue, + maxValue, + volumeChartLayer.container.frame.width + ); + + plotAreaFrame.initializeX( + minValue, + maxValue, + volumeChartLayer.container.frame.width + ); + + } + + function recalculateScaleY() { + + var minValue = { + y: 0 + }; + + var maxValue = { + y: 0 + }; + + let timePeriodRatio = ONE_DAY_IN_MILISECONDS / timePeriod; + + maxValue.y = marketIndex.maxVolume() / (timePeriodRatio / 10); + + plotArea.initializeY( + minValue, + maxValue, + viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y + ); + + plotAreaFrame.initializeY( + minValue, + maxValue, + volumeChartLayer.container.frame.height + ); + + } + + function plotChart() { + + if (volumes.length > 0) { + + /* Now we calculate and plot the volumes */ + + let visibleHeight = viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y; + + let frameCorner1 = { + x: 0, + y: 0 + }; + + let frameCorner2 = { + x: volumeChartLayer.container.frame.width, + y: volumeChartLayer.container.frame.height + }; + + + /* Now the transformations. */ + + frameCorner1 = transformThisPoint(frameCorner1, volumeChartLayer.container.frame.container); + frameCorner2 = transformThisPoint(frameCorner2, volumeChartLayer.container.frame.container); + + let frameHeightInViewPort = frameCorner2.y - frameCorner1.y; + + if (volumes.length > 0) { + + for (var i = 0; i < volumes.length; i++) { + + volume = volumes[i]; + + let volumePointA1; + let volumePointA2; + let volumePointA3; + let volumePointA4; + + function calculateBuys(plot, height) { + + volumePointA1 = { + x: volume.begin + timePeriod / 7 * 2, + y: 0 + }; + + volumePointA2 = { + x: volume.begin + timePeriod / 7 * 2, + y: volume.amountBuy + }; + + volumePointA3 = { + x: volume.begin + timePeriod / 7 * 5, + y: volume.amountBuy + }; + + volumePointA4 = { + x: volume.begin + timePeriod / 7 * 5, + y: 0 + }; + + volumePointA1 = plot.inverseTransform(volumePointA1, height); + volumePointA2 = plot.inverseTransform(volumePointA2, height); + volumePointA3 = plot.inverseTransform(volumePointA3, height); + volumePointA4 = plot.inverseTransform(volumePointA4, height); + + volumePointA1 = transformThisPoint(volumePointA1, volumeChartLayer.container); + volumePointA2 = transformThisPoint(volumePointA2, volumeChartLayer.container); + volumePointA3 = transformThisPoint(volumePointA3, volumeChartLayer.container); + volumePointA4 = transformThisPoint(volumePointA4, volumeChartLayer.container); + + let baseIncrement = (volumePointA3.x - volumePointA1.x) * WIDHTER_VOLUME_BAR_BASE_FACTOR; + + volumePointA1.x = volumePointA1.x - baseIncrement; + volumePointA4.x = volumePointA4.x + baseIncrement; + + if (volumePointA4.x < viewPort.visibleArea.bottomLeft.x || volumePointA1.x > viewPort.visibleArea.bottomRight.x) { + return false; + } + + return true; + + } + + if (calculateBuys(plotAreaFrame, volumeChartLayer.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. + + if (volumePointA1.y > viewPort.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { + + if (calculateBuys(plotArea, visibleHeight) === false) { continue; } // We snap t to the view port. + + /* Now we set the real value of y. */ + + volumePointA1.y = viewPort.visibleArea.bottomRight.y; + volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * plotArea.scale.y; + volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * plotArea.scale.y; + volumePointA4.y = viewPort.visibleArea.bottomRight.y; + + } + + let volumePointB1; + let volumePointB2; + let volumePointB3; + let volumePointB4; + + function calculateSells(plot, height) { + + volumePointB1 = { + x: volume.begin + timePeriod / 7 * 2, + y: height + }; + + volumePointB2 = { + x: volume.begin + timePeriod / 7 * 2, + y: height - volume.amountSell + }; + + volumePointB3 = { + x: volume.begin + timePeriod / 7 * 5, + y: height - volume.amountSell + }; + + volumePointB4 = { + x: volume.begin + timePeriod / 7 * 5, + y: height + }; + + volumePointB1 = plot.inverseTransform2(volumePointB1, height); + volumePointB2 = plot.inverseTransform2(volumePointB2, height); + volumePointB3 = plot.inverseTransform2(volumePointB3, height); + volumePointB4 = plot.inverseTransform2(volumePointB4, height); + + volumePointB1 = transformThisPoint(volumePointB1, volumeChartLayer.container); + volumePointB2 = transformThisPoint(volumePointB2, volumeChartLayer.container); + volumePointB3 = transformThisPoint(volumePointB3, volumeChartLayer.container); + volumePointB4 = transformThisPoint(volumePointB4, volumeChartLayer.container); + + } + + calculateSells(plotAreaFrame, volumeChartLayer.container.frame.height); // We try to see if it fits in the visible area. + + if (volumePointB1.y < viewPort.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { + + calculateSells(plotArea, visibleHeight); // We snap it to the view port. + + /* Now we set the real value of y. */ + + volumePointB1.y = viewPort.visibleArea.topLeft.y; + volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * plotArea.scale.y; + volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * plotArea.scale.y; + volumePointB4.y = viewPort.visibleArea.topLeft.y; + + } + + /* We put a wider base */ + + let baseIncrement = (volumePointB3.x - volumePointB1.x) * WIDHTER_VOLUME_BAR_BASE_FACTOR; + + volumePointB1.x = volumePointB1.x - baseIncrement; + volumePointB4.x = volumePointB4.x + baseIncrement; + + /* We put a less wider top */ + + let baseDencrement = (volumePointA3.x - volumePointA2.x) * LESS_WIDHTER_VOLUME_BAR_TOP_FACTOR; + + volumePointA2.x = volumePointA2.x + baseDencrement; + volumePointA3.x = volumePointA3.x - baseDencrement; + + volumePointB2.x = volumePointB2.x + baseDencrement; + volumePointB3.x = volumePointB3.x - baseDencrement; + + + /* Everything must fit within the visible area */ + + volumePointA1 = viewPort.fitIntoVisibleArea(volumePointA1); + volumePointA2 = viewPort.fitIntoVisibleArea(volumePointA2); + volumePointA3 = viewPort.fitIntoVisibleArea(volumePointA3); + volumePointA4 = viewPort.fitIntoVisibleArea(volumePointA4); + + volumePointB1 = viewPort.fitIntoVisibleArea(volumePointB1); + volumePointB2 = viewPort.fitIntoVisibleArea(volumePointB2); + volumePointB3 = viewPort.fitIntoVisibleArea(volumePointB3); + volumePointB4 = viewPort.fitIntoVisibleArea(volumePointB4); + + /* Everything must fit within the Frame. We know that that is equivalent to say that each bar con not be higher than the base of the opposite . */ + + if (volumePointA2.y < volumePointB1.y) { + + volumePointA2.y = volumePointB1.y; + volumePointA3.y = volumePointB1.y; + + } + + if (volumePointB2.y > volumePointA1.y) { + + volumePointB2.y = volumePointA1.y; + volumePointB3.y = volumePointA1.y; + + } + + /* Now the drawing of the volume bars*/ + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(volumePointA1.x, volumePointA1.y); + browserCanvasContext.lineTo(volumePointA2.x, volumePointA2.y); + browserCanvasContext.lineTo(volumePointA3.x, volumePointA3.y); + browserCanvasContext.lineTo(volumePointA4.x, volumePointA4.y); + + browserCanvasContext.closePath(); + + + if (datetime !== undefined) { + + let dateValue = datetime.valueOf(); + + if (dateValue >= volume.begin && dateValue <= volume.end) { + + browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current bar accroding to time + + } else { + + browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 0.40)'; + } + + } else { + + browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 0.40)'; + + } + + browserCanvasContext.fill(); + browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 0.40)'; + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(volumePointB1.x, volumePointB1.y); + browserCanvasContext.lineTo(volumePointB2.x, volumePointB2.y); + browserCanvasContext.lineTo(volumePointB3.x, volumePointB3.y); + browserCanvasContext.lineTo(volumePointB4.x, volumePointB4.y); + + browserCanvasContext.closePath(); + + if (datetime !== undefined) { + + let dateValue = datetime.valueOf(); + + if (dateValue >= volume.begin && dateValue <= volume.end) { + + browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current candle accroding to time + + } else { + + browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 0.40)'; + } + + } else { + + browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 0.40)'; + + } + + browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 0.40)'; + + browserCanvasContext.fill(); + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + + + + if (datetime !== undefined) { + + let dateValue = datetime.valueOf(); + + if (dateValue >= volume.begin && dateValue <= volume.end) { + + let buyInfo = { + baseWidth: volumePointA4.x - volumePointA1.x, + topWidth: volumePointA3.x - volumePointA2.x, + height: volumePointA2.y - volumePointA1.y + }; + + let sellInfo = { + baseWidth: volumePointB4.x - volumePointB1.x, + topWidth: volumePointB3.x - volumePointB2.x, + height: volumePointB2.y - volumePointB1.y + }; + + let currentVolume = { + buyInfo: buyInfo, + sellInfo: sellInfo, + period: timePeriod, + innerVolumeBar: volume + }; + + volumeChartLayer.container.eventHandler.raiseEvent("Current Volume Info Changed", currentVolume); + + } + } + } + } + } + } + + function onLayerStatusChanged(eventData) { + + if (eventData.layer === 'Olivia Volumes') { + layerStatus = eventData.status; + } + + } + + function onZoomChanged(event) { + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } + + function onDragFinished() { + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } +} + From 343aed45ec0b32bf43af1ee07611044dffb9617c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 17:57:35 +0100 Subject: [PATCH 065/176] Module renamed --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 18432 bytes AAOlivia-Plotter.njsproj | 4 ++-- Candlestick.js => Candles.js | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename Candlestick.js => Candles.js (100%) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index b81cdf09cce4d98acaafb42e0a2f8f8020f35257..009a78426d0ac2ed5deb5ce9791c11408df31ab0 100644 GIT binary patch delta 253 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|92G3BtZCa5xUnQks* zW9MUJ+gvG<%QbnP8{g(Haz4zAY?B?8)=v(!E1A5`fn7^4tGK47+R!A$(A?6@P&X~r z)KJ&N%p^tE($LUQH`ydH&CoE#JjK#7aq>*t>_sYalP@|*OxCyOnta|)W3!)KAtSpL z&>3kA43qus%0NaM5^rQJmvdrXO3viJc19qblmFWpfazR&x5-wn3Y*{096b35ad-f86f-47b9-a99f-04ca93397da8} ShowAllFiles - Candlestick.js + Candles.js . . {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} @@ -16,7 +16,7 @@ - + Code diff --git a/Candlestick.js b/Candles.js similarity index 100% rename from Candlestick.js rename to Candles.js From f1181e44213408c5edab1bdb92709f6cff592aa3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 18:09:14 +0100 Subject: [PATCH 066/176] Rename --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18432 -> 18432 bytes Candles.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 009a78426d0ac2ed5deb5ce9791c11408df31ab0..ff6df837dd866f77685e7b4ef2d8c53c03de9c64 100644 GIT binary patch delta 204 zcmZpez}PT>aYGIh>x7N*oo1U0nSL{~Is{yt24u4N%1mD8z&_dDMSF6f-LlEEY_m40 zRIqHW5b>y&tl%OsS>K*(@_9Rr&3<;NjDieE;1Cl7 pgW~1`&S{L2NTOh-3XtRhV&=*AjyGX8;xj=|9nA=p&E~ErnE(xaFw_75 delta 229 zcmZpez}PT>aYGIh>w`u2VoWv{GW}*|O;BazGTmIr<}0&#pN$jaCY1^nMybt}8o2_K zrQAg}|FUpnW|W%jXtSPi#pI7RRV*c$$=Q?T?X)LPQ_k9Cx1Lc Date: Wed, 21 Feb 2018 18:15:06 +0100 Subject: [PATCH 067/176] recalculateScaleX --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18432 -> 18944 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index ff6df837dd866f77685e7b4ef2d8c53c03de9c64..646f98cef796bf7a5f38fe39fa4725433eb44a6e 100644 GIT binary patch delta 91 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*E_G<*)=C{%%-kyh*AE;Ptv$^9*wnc7C01h%44FCWD delta 107 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|8-G3BsK*cjirxq!*f vYO=OH*W^59jmaOBN+$19GMYTiwh1Q2%*5aV6koRavz Date: Wed, 21 Feb 2018 18:17:49 +0100 Subject: [PATCH 068/176] Re --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 18432 bytes Volumes.js | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 646f98cef796bf7a5f38fe39fa4725433eb44a6e..d8113400c48dc0a528ba07be7c429123b7dbfa42 100644 GIT binary patch delta 128 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|92G3BtZ8Z-&Fn{O^; z^Oc#bZO=71Pg!H~2c?q9`;?3}Pg8D^g9$P-F}MIFmQDU_w@1(qWDFFf0%^_72kae~ I7P&D202b3BNB{r; delta 105 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*FgW<*=|i1YDeEwz-ha oS7!4*8z;t1DiU&&_t_Y2_OiRfB&ZHjj|5aUo4cN5TI9wA02s#@zyJUM diff --git a/Volumes.js b/Volumes.js index ac9504e5f..033929e55 100644 --- a/Volumes.js +++ b/Volumes.js @@ -97,11 +97,11 @@ fileCursor = newFileCursor; - recalculateScale(); // With any of the market files we can calculate the scale. - layerStatus = pLayerStatus; + recalculateScaleX(); recalculate(); + recalculateScaleY(); viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); From 03701df9af42654f9f95bf7218b59e8e9a974424 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 18:18:57 +0100 Subject: [PATCH 069/176] thisObject --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18432 -> 18944 bytes Volumes.js | 36 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index d8113400c48dc0a528ba07be7c429123b7dbfa42..c2816afbd9687c2847ffd1f37f2a5649369fd19d 100644 GIT binary patch delta 103 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*E_G<*+79|IcZ$xsb`% qYV$rNC&o#35|j5S8Ey7*N@Wy`0_g$+sRP+Sw%Fza_6{72+?W9Qgc)D} delta 119 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|8-G3BrZ9R9c0Y;z%# wuhnD=2cyX!lu9P=Q!<)7&9(`|XJ%q>fs1{%+an0l4+DpQmMCsMVDG>I0D93O2LJ#7 diff --git a/Volumes.js b/Volumes.js index 033929e55..62a9a993c 100644 --- a/Volumes.js +++ b/Volumes.js @@ -361,13 +361,13 @@ plotArea.initializeX( minValue, maxValue, - volumeChartLayer.container.frame.width + thisObject.container.frame.width ); plotAreaFrame.initializeX( minValue, maxValue, - volumeChartLayer.container.frame.width + thisObject.container.frame.width ); } @@ -395,7 +395,7 @@ plotAreaFrame.initializeY( minValue, maxValue, - volumeChartLayer.container.frame.height + thisObject.container.frame.height ); } @@ -414,15 +414,15 @@ }; let frameCorner2 = { - x: volumeChartLayer.container.frame.width, - y: volumeChartLayer.container.frame.height + x: thisObject.container.frame.width, + y: thisObject.container.frame.height }; /* Now the transformations. */ - frameCorner1 = transformThisPoint(frameCorner1, volumeChartLayer.container.frame.container); - frameCorner2 = transformThisPoint(frameCorner2, volumeChartLayer.container.frame.container); + frameCorner1 = transformThisPoint(frameCorner1, thisObject.container.frame.container); + frameCorner2 = transformThisPoint(frameCorner2, thisObject.container.frame.container); let frameHeightInViewPort = frameCorner2.y - frameCorner1.y; @@ -464,10 +464,10 @@ volumePointA3 = plot.inverseTransform(volumePointA3, height); volumePointA4 = plot.inverseTransform(volumePointA4, height); - volumePointA1 = transformThisPoint(volumePointA1, volumeChartLayer.container); - volumePointA2 = transformThisPoint(volumePointA2, volumeChartLayer.container); - volumePointA3 = transformThisPoint(volumePointA3, volumeChartLayer.container); - volumePointA4 = transformThisPoint(volumePointA4, volumeChartLayer.container); + volumePointA1 = transformThisPoint(volumePointA1, thisObject.container); + volumePointA2 = transformThisPoint(volumePointA2, thisObject.container); + volumePointA3 = transformThisPoint(volumePointA3, thisObject.container); + volumePointA4 = transformThisPoint(volumePointA4, thisObject.container); let baseIncrement = (volumePointA3.x - volumePointA1.x) * WIDHTER_VOLUME_BAR_BASE_FACTOR; @@ -482,7 +482,7 @@ } - if (calculateBuys(plotAreaFrame, volumeChartLayer.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. + if (calculateBuys(plotAreaFrame, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. if (volumePointA1.y > viewPort.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { @@ -529,14 +529,14 @@ volumePointB3 = plot.inverseTransform2(volumePointB3, height); volumePointB4 = plot.inverseTransform2(volumePointB4, height); - volumePointB1 = transformThisPoint(volumePointB1, volumeChartLayer.container); - volumePointB2 = transformThisPoint(volumePointB2, volumeChartLayer.container); - volumePointB3 = transformThisPoint(volumePointB3, volumeChartLayer.container); - volumePointB4 = transformThisPoint(volumePointB4, volumeChartLayer.container); + volumePointB1 = transformThisPoint(volumePointB1, thisObject.container); + volumePointB2 = transformThisPoint(volumePointB2, thisObject.container); + volumePointB3 = transformThisPoint(volumePointB3, thisObject.container); + volumePointB4 = transformThisPoint(volumePointB4, thisObject.container); } - calculateSells(plotAreaFrame, volumeChartLayer.container.frame.height); // We try to see if it fits in the visible area. + calculateSells(plotAreaFrame, thisObject.container.frame.height); // We try to see if it fits in the visible area. if (volumePointB1.y < viewPort.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { @@ -695,7 +695,7 @@ innerVolumeBar: volume }; - volumeChartLayer.container.eventHandler.raiseEvent("Current Volume Info Changed", currentVolume); + thisObject.container.eventHandler.raiseEvent("Current Volume Info Changed", currentVolume); } } From f3ea7f166dbbc9d1a4b141633fa94a90f0316bc6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 18:24:04 +0100 Subject: [PATCH 070/176] marketFile --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 18432 bytes Volumes.js | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index c2816afbd9687c2847ffd1f37f2a5649369fd19d..c756cd30231ca6277f6569feb8a5aaf61ca9719f 100644 GIT binary patch delta 139 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|8-G3Bs4IH%aUxq#^p zGwX$m%MMy>E@ZQ_6a?vj0cjwEee(hP_soJ!AXA`#56CtL3a2p&&Oj1g31lm8Hg`SA F1OS&w9NPc@ delta 122 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*E_G<*+17|IfL(fawo2 wt3i`+yZPoqHaknfD3Ee6kUEeJWQ%P+VE>+3&<`dGq*H-d6DaJ!w8#yF0HJ>yGynhq diff --git a/Volumes.js b/Volumes.js index 62a9a993c..8bbeab5e0 100644 --- a/Volumes.js +++ b/Volumes.js @@ -25,6 +25,7 @@ let layerStatus = 'off'; // Since the moduleis a layer, it must handle the different possible layer status. let plotArea = newPlotArea(); // Needed to be able to plot on the timeline, otherwise not. + let plotAreaFrame = newPlotArea(); // This chart uses this extra object. let timePeriod; // This will hold the current Time Period the user is at. let datetime; // This will hold the current Datetime the user is at. @@ -267,11 +268,11 @@ var volume = newVolumeBar(); - volume.begin = (new Date(marketIndex.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS - volume.end = (new Date(marketIndex.volumes[i][3])).valueOf(); + volume.begin = (new Date(marketFile.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS + volume.end = (new Date(marketFile.volumes[i][3])).valueOf(); - volume.amountBuy = marketIndex.volumes[i][0]; - volume.amountSell = marketIndex.volumes[i][1]; + volume.amountBuy = marketFile.volumes[i][0]; + volume.amountSell = marketFile.volumes[i][1]; if (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) { @@ -326,11 +327,11 @@ var volume = newVolumeBar(); - volume.begin = (new Date(marketIndex.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS - volume.end = (new Date(marketIndex.volumes[i][3])).valueOf(); + volume.begin = (new Date(marketFile.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS + volume.end = (new Date(marketFile.volumes[i][3])).valueOf(); - volume.amountBuy = marketIndex.volumes[i][0]; - volume.amountSell = marketIndex.volumes[i][1]; + volume.amountBuy = marketFile.volumes[i][0]; + volume.amountSell = marketFile.volumes[i][1]; if (volume.begin >= leftDate.valueOf() && volume.end <= rightDate.valueOf()) { @@ -384,7 +385,7 @@ let timePeriodRatio = ONE_DAY_IN_MILISECONDS / timePeriod; - maxValue.y = marketIndex.maxVolume() / (timePeriodRatio / 10); + maxValue.y = marketFile.maxVolume() / (timePeriodRatio / 10); plotArea.initializeY( minValue, From c01c45b1d3f5d631b3c6d7f85c6548e3bc4ced75 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 18:26:31 +0100 Subject: [PATCH 071/176] dailyFile --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18432 -> 18432 bytes Volumes.js | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index c756cd30231ca6277f6569feb8a5aaf61ca9719f..eca9c1fce1ee3298d1ef17e725afe290a98f6b50 100644 GIT binary patch delta 62 zcmZpez}PT>aYGIhi-2R`?ac*Df0$Vnb`?lkZZ2fAv)sJiIgn|S(|SfhRz?OWkUC%v MWQ%P+;OxKx0A;%n{Qv*} delta 84 zcmZpez}PT>aYGIh%Y$=@t(yy&{xGv%xVY?~#pXgbJ4-GTApDuuo$YL8#smQ8i4&{< diff --git a/Volumes.js b/Volumes.js index 8bbeab5e0..732a25aaf 100644 --- a/Volumes.js +++ b/Volumes.js @@ -268,11 +268,11 @@ var volume = newVolumeBar(); - volume.begin = (new Date(marketFile.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS - volume.end = (new Date(marketFile.volumes[i][3])).valueOf(); + volume.begin = (new Date(dailyFile.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS + volume.end = (new Date(dailyFile.volumes[i][3])).valueOf(); - volume.amountBuy = marketFile.volumes[i][0]; - volume.amountSell = marketFile.volumes[i][1]; + volume.amountBuy = dailyFile.volumes[i][0]; + volume.amountSell = dailyFile.volumes[i][1]; if (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) { From 4ad55ea3615fd57a5e1cd0de21068a62bffe3bd4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 18:31:26 +0100 Subject: [PATCH 072/176] dailyFile.volumes --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18432 -> 18944 bytes Volumes.js | 16 ++++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index eca9c1fce1ee3298d1ef17e725afe290a98f6b50..218bda599228b8d4d0f4076aa6fddd476f7c0df6 100644 GIT binary patch delta 119 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*E_G<*+`u+u-RJ*T7Z;;fz$zCAX{tm0sHsN*o2)OSQfc40RX|=9H;;Q delta 116 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|8-G3BrdI0oLf*j&i; uo0&ynSApc_0ycX~K_-xLDBuIK%{L#gf6pw)3Ky0-U=C!9Z9d@azybiQj2G7c diff --git a/Volumes.js b/Volumes.js index 732a25aaf..d36d6f85f 100644 --- a/Volumes.js +++ b/Volumes.js @@ -268,11 +268,11 @@ var volume = newVolumeBar(); - volume.begin = (new Date(dailyFile.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS - volume.end = (new Date(dailyFile.volumes[i][3])).valueOf(); + volume.begin = (new Date(dailyFile[i][2])).valueOf(); // TODO ELIMINATE THIS + volume.end = (new Date(dailyFile[i][3])).valueOf(); - volume.amountBuy = dailyFile.volumes[i][0]; - volume.amountSell = dailyFile.volumes[i][1]; + volume.amountBuy = dailyFile[i][0]; + volume.amountSell = dailyFile[i][1]; if (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) { @@ -327,11 +327,11 @@ var volume = newVolumeBar(); - volume.begin = (new Date(marketFile.volumes[i][2])).valueOf(); // TODO ELIMINATE THIS - volume.end = (new Date(marketFile.volumes[i][3])).valueOf(); + volume.begin = (new Date(marketFile[i][2])).valueOf(); // TODO ELIMINATE THIS + volume.end = (new Date(marketFile[i][3])).valueOf(); - volume.amountBuy = marketFile.volumes[i][0]; - volume.amountSell = marketFile.volumes[i][1]; + volume.amountBuy = marketFile[i][0]; + volume.amountSell = marketFile[i][1]; if (volume.begin >= leftDate.valueOf() && volume.end <= rightDate.valueOf()) { From f12a84e85a373fca172eb14aba15accce5f68d16 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 18:35:04 +0100 Subject: [PATCH 073/176] if (volumes.length > 0) { --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 18432 bytes Candles.js | 9 ++++++--- Volumes.js | 9 ++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 218bda599228b8d4d0f4076aa6fddd476f7c0df6..77b1e8b0a88f05dd48a7f13eeacfe01917de2ed3 100644 GIT binary patch delta 107 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|92G3BtZZeTm?VYRuC m&CXU(9Ha^iqz)JY*}R(%*rzcHmcxY^7$$?*o6TKMG64XeG!*p! delta 72 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*FgW<*=|Os9!#0xw(+d P&UW*9`#`2eZXg5zNW~Ja diff --git a/Candles.js b/Candles.js index c93ce7d5b..3d91e94a9 100644 --- a/Candles.js +++ b/Candles.js @@ -391,12 +391,15 @@ let lowerEnd = leftDate.valueOf(); let upperEnd = rightDate.valueOf(); - if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { + if (candles.length > 0) { - setTimeout(recalculate, 2000); + if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { - //console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); + setTimeout(recalculate, 2000); + //console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); + + } } //console.log("Olivia > recalculateUsingDailyFiles > total candles generated : " + candles.length); diff --git a/Volumes.js b/Volumes.js index d36d6f85f..63fe74379 100644 --- a/Volumes.js +++ b/Volumes.js @@ -295,12 +295,15 @@ let lowerEnd = leftDate.valueOf(); let upperEnd = rightDate.valueOf(); - if (volumes[0].begin > lowerEnd || volumes[volumes.length - 1].end < upperEnd) { + if (volumes.length > 0) { - setTimeout(recalculate, 2000); + if (volumes[0].begin > lowerEnd || volumes[volumes.length - 1].end < upperEnd) { - //console.log("File missing while calculating volumes, scheduling a recalculation in 2 seconds."); + setTimeout(recalculate, 2000); + //console.log("File missing while calculating volumes, scheduling a recalculation in 2 seconds."); + + } } //console.log("Olivia > recalculateUsingDailyFiles > total volumes generated : " + volumes.length); From 177276ea16f6f3fb11a91df640b92122a2912e4a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 21 Feb 2018 18:40:16 +0100 Subject: [PATCH 074/176] getMaxVolume() --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18432 -> 18944 bytes Volumes.js | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 77b1e8b0a88f05dd48a7f13eeacfe01917de2ed3..fc3fa314b40538d716aff0fba846f9290ccb7f4d 100644 GIT binary patch delta 109 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*E_G<*;5j+55_Bb0L$R ltzbJy5g2G4mfV^ delta 106 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|8-G3Bs6xZHija&sY* movok+ND&xF9q Date: Wed, 21 Feb 2018 20:24:31 +0100 Subject: [PATCH 075/176] Comment TODO ELIMINATE THIS OBJECT DEPENDENCYY --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 18432 bytes Volumes.js | 2 +- ...ia-Plotter.njsproj.CoreCompileInputs.cache | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index fc3fa314b40538d716aff0fba846f9290ccb7f4d..e8ac874b8e6ba3e4e3c36b83ed6911ff325d3c6e 100644 GIT binary patch delta 163 zcmZpe!q_l@ae{#?69W_oFfgzHnT$aE@Bjb*AW`PYjvV$I6G|8-G3Br>XwG_Ly}6L- zH#6&ng?jIROg1}9K^>4fDDVR64c>gfK8;cEBFGphcn)N1Z#H+VU?M@a>q#a6ozEe7 delta 165 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*E`x<+7aYePy+|km)xw z>jt*N9zZ6WouyzqNI4j29hePbZ$4n3#wd6KF3iC25G-u&SivMH4i}a>U Date: Thu, 22 Feb 2018 09:27:36 +0100 Subject: [PATCH 076/176] let candle = newCandle(); --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18432 -> 18432 bytes Candles.js | 10 +++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index e8ac874b8e6ba3e4e3c36b83ed6911ff325d3c6e..c4c027080a51595af00e29ef61dd8be724da5b78 100644 GIT binary patch delta 194 zcmZpez}PT>aYHT>i`}dD+cp<6{bpue5WC|ukjdsNGugtyXz~Z8lF9p&j5beG){sON zm^{t43B+e+VsL>en*7;rkDx9i101jcS@N3?*rzcH&Os7h31Uw+cYH{S0rSxf*lg~4 Gk_iBodNtDk delta 202 zcmZpez}PT>aYHT>OLNv6>&=BsznNJtEYy1kWU~3nOxCvNnw+PsG5Ld1$>e=XMw_Q8 zYe=FCPM&7l1QTOsVsHT}UN-r&-5x<51_bb8WMBy1e84`9QSc&=2?Ni8Z0*VBjt?m^ KV6(aFNhSceSvVa4 diff --git a/Candles.js b/Candles.js index 3d91e94a9..63da54d31 100644 --- a/Candles.js +++ b/Candles.js @@ -424,7 +424,15 @@ for (let i = 0; i < marketFile.length; i++) { - let candle = newCandle(); + let candle = { + open: undefined, + close: undefined, + min: 10000000000000, + max: 0, + begin: undefined, + end: undefined, + direction: undefined + }; candle.min = marketFile[i][0]; candle.max = marketFile[i][1]; From 39b5f1724f021d73ce898732f17c83d59b8c0d34 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 22 Feb 2018 09:29:50 +0100 Subject: [PATCH 077/176] candle.begin = marketFile[i][4]; --- Candles.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Candles.js b/Candles.js index 63da54d31..0ba9f2539 100644 --- a/Candles.js +++ b/Candles.js @@ -440,8 +440,8 @@ candle.open = marketFile[i][2]; candle.close = marketFile[i][3]; - candle.begin = (new Date(marketFile[i][4])).valueOf(); //TODO REMOVE THIS - candle.end = (new Date(marketFile[i][5])).valueOf(); + candle.begin = marketFile[i][4]; + candle.end = marketFile[i][5]; if (candle.open > candle.close) { candle.direction = 'down'; } if (candle.open < candle.close) { candle.direction = 'up'; } From 5ce4490718fd9b2b833859f95032042e1a781405 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 22 Feb 2018 09:33:34 +0100 Subject: [PATCH 078/176] Pending TODOs done --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18432 -> 18944 bytes Candles.js | 14 +++++++++++--- Volumes.js | 22 ++++++++++++++++------ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index c4c027080a51595af00e29ef61dd8be724da5b78..ccd85b9ab981207b7dc36cec13952f01e6d57903 100644 GIT binary patch delta 148 zcmZpez}PT_ae{#?0}Kc-FbD$Kj6nSF|Ns9WVaCah9QGR%N*E_G<+4=&IkSCpA(OAw zWNmw{$$82elRqexOx~wtG candle.close) { candle.direction = 'down'; } if (candle.open < candle.close) { candle.direction = 'up'; } diff --git a/Volumes.js b/Volumes.js index 7e682c7ee..6dd5e1f31 100644 --- a/Volumes.js +++ b/Volumes.js @@ -266,10 +266,15 @@ for (let i = 0; i < dailyFile.length; i++) { - var volume = newVolumeBar(); + var volume = { + amountBuy: 0, + amountSell: 0, + begin: undefined, + end: undefined + }; - volume.begin = (new Date(dailyFile[i][2])).valueOf(); // TODO ELIMINATE THIS - volume.end = (new Date(dailyFile[i][3])).valueOf(); + volume.begin = marketFile[i][2]; + volume.end = marketFile[i][3]; volume.amountBuy = dailyFile[i][0]; volume.amountSell = dailyFile[i][1]; @@ -328,10 +333,15 @@ for (let i = 0; i < marketFile.length; i++) { - var volume = newVolumeBar(); // TODO ELIMINATE THIS OBJECT DEPENDENCYY + var volume = = { + amountBuy: 0, + amountSell: 0, + begin: undefined, + end: undefined + }; - volume.begin = (new Date(marketFile[i][2])).valueOf(); // TODO ELIMINATE THIS - volume.end = (new Date(marketFile[i][3])).valueOf(); + volume.begin = marketFile[i][2]; + volume.end = marketFile[i][3]; volume.amountBuy = marketFile[i][0]; volume.amountSell = marketFile[i][1]; From bc6cea71d93dd29e7f277d8e582ff264721fcd6d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 22 Feb 2018 09:36:18 +0100 Subject: [PATCH 079/176] typo --- Volumes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Volumes.js b/Volumes.js index 6dd5e1f31..0e88d4f1a 100644 --- a/Volumes.js +++ b/Volumes.js @@ -333,7 +333,7 @@ for (let i = 0; i < marketFile.length; i++) { - var volume = = { + var volume = { amountBuy: 0, amountSell: 0, begin: undefined, From 50d40ca1dc73998a80c8199077e819fad6ee4875 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 22 Feb 2018 09:44:10 +0100 Subject: [PATCH 080/176] marketFile --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 18944 bytes Candles.js | 4 ++-- Volumes.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index ccd85b9ab981207b7dc36cec13952f01e6d57903..50b60f0a5db02b5ea1260d79d420e36b4400e8f3 100644 GIT binary patch delta 116 zcmZpe!q_l{aYGIhYr{)6@12_qnSL{~I+#E61TxutWj61#abn!0vRj%}gpq+kYx4p7 kG)BSIKqd^7f`liVJ3gGe&&Fu8mt7$vUX`28T~D$A00z|_KmY&$ delta 147 zcmZpe!q_l{aYGIh>w@Y(XSQ!HWctm_x*&GP=WUw{*?eUtTR0d^{-9Jcd7qNe=4r~R zGOQtt3=Djm57?(M3Pu5$FpvXei%m9nd3|C-5x<*B$aGHE%Fcp<|7HO M1hF@pyPjkL0M1}1o&W#< diff --git a/Candles.js b/Candles.js index f6b22f7f2..6baa586aa 100644 --- a/Candles.js +++ b/Candles.js @@ -370,8 +370,8 @@ candle.open = dailyFile[i][2]; candle.close = dailyFile[i][3]; - candle.begin = marketFile[i][4]; - candle.end = marketFile[i][5]; + candle.begin = dailyFile[i][4]; + candle.end = dailyFile[i][5]; if (candle.open > candle.close) { candle.direction = 'down'; } if (candle.open < candle.close) { candle.direction = 'up'; } diff --git a/Volumes.js b/Volumes.js index 0e88d4f1a..30170b195 100644 --- a/Volumes.js +++ b/Volumes.js @@ -273,8 +273,8 @@ end: undefined }; - volume.begin = marketFile[i][2]; - volume.end = marketFile[i][3]; + volume.begin = dailyFile[i][2]; + volume.end = dailyFile[i][3]; volume.amountBuy = dailyFile[i][0]; volume.amountSell = dailyFile[i][1]; From 14de0af04f4b1757b8eaa029062f579499f0d2e3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 22 Feb 2018 10:28:42 +0100 Subject: [PATCH 081/176] tyding --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 18944 bytes Volumes.js | 16 ++++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 50b60f0a5db02b5ea1260d79d420e36b4400e8f3..8a5f862dcfae67adcacce433bd765881c15184bb 100644 GIT binary patch delta 107 zcmZpe!q_l{aYGIhYrr0ts=b>FnSL{~OyHiEySaeP&up@VgVE#?GgONfB-y<3=HC%57?(MG8S!Ccbvk+>If7u+I+y-feioxIU(2p delta 73 zcmZpe!q_l{aYGIhYr{)6@12_qnSL{~IG8{4++4usXSR8tk`v=3JBi8rl#DieITbRp ViZC)TXl*{=?7+0iX*Uv=4FJ3P7kmH! diff --git a/Volumes.js b/Volumes.js index 30170b195..2eb487ac6 100644 --- a/Volumes.js +++ b/Volumes.js @@ -266,19 +266,19 @@ for (let i = 0; i < dailyFile.length; i++) { - var volume = { + let volume = { amountBuy: 0, amountSell: 0, begin: undefined, end: undefined }; - volume.begin = dailyFile[i][2]; - volume.end = dailyFile[i][3]; - volume.amountBuy = dailyFile[i][0]; volume.amountSell = dailyFile[i][1]; + volume.begin = dailyFile[i][2]; + volume.end = dailyFile[i][3]; + if (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) { volumes.push(volume); @@ -333,19 +333,19 @@ for (let i = 0; i < marketFile.length; i++) { - var volume = { + let volume = { amountBuy: 0, amountSell: 0, begin: undefined, end: undefined }; - volume.begin = marketFile[i][2]; - volume.end = marketFile[i][3]; - volume.amountBuy = marketFile[i][0]; volume.amountSell = marketFile[i][1]; + volume.begin = marketFile[i][2]; + volume.end = marketFile[i][3]; + if (volume.begin >= leftDate.valueOf() && volume.end <= rightDate.valueOf()) { volumes.push(volume); From f7af6d49a990dcaf19fc27355e76fd8cdc84e933 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 23 Feb 2018 18:17:46 +0100 Subject: [PATCH 082/176] All working --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 18944 bytes Candles.js | 27 --------------------------- Volumes.js | 2 +- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 8a5f862dcfae67adcacce433bd765881c15184bb..38ab6b7db3a2df743f2570ebb8938b23a4f63de9 100644 GIT binary patch delta 141 zcmZpe!q_l{aYGIhn}SfzrW0#67cu>2X8m8W5yWKkG26UP$%%22oy6pQN=BQ#oKhJD myBHbZU7cu>2X62rjyA#M{^D&!j;b1iRgHp-leM&}?r`a}v z_{>ZUE^x8Wc6$VWF(3dBBLjo@<^%R=jDkf#CJdAU*;<>;9V?gw?U95Xfovm)>eWcX JP}Qy{SpbtoC&2&! diff --git a/Candles.js b/Candles.js index 6baa586aa..e2b70b21f 100644 --- a/Candles.js +++ b/Candles.js @@ -104,7 +104,6 @@ layerStatus = pLayerStatus; recalculate(); - postitionViewPort(); viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); @@ -202,32 +201,6 @@ } } - function postitionViewPort() { - - try { - - let targetPoint = { - x: candles[Math.round(candles.length / 2)].begin, - y: candles[Math.round(candles.length / 2)].min + (candles[Math.round(candles.length / 2)].max - candles[Math.round(candles.length / 2)].min) - }; - - targetPoint = plotArea.inverseTransform(targetPoint, thisObject.container.frame.height); - targetPoint = transformThisPoint(targetPoint, thisObject.container); - - let displaceVector = { - x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.topLeft.x) / 2 - targetPoint.x, - y: (viewPort.visibleArea.bottomLeft.y - viewPort.visibleArea.topLeft.y) / 2 - targetPoint.y - }; - - viewPort.displace(displaceVector); - - } catch (err) { - - // if there data is missing of the days it must position in then an exception is raised. - } - - } - function positionAtDatetime(newDatetime) { value = newDatetime.valueOf(); diff --git a/Volumes.js b/Volumes.js index 2eb487ac6..ae1961bf6 100644 --- a/Volumes.js +++ b/Volumes.js @@ -418,7 +418,7 @@ for (var i = 0; i < marketFile.length; i++) { - let currentMax = marketFile[i][0] + marketFile[i][1]; + let currentMax = (marketFile[i][0] + marketFile[i][1]) * 4; if (maxValue < currentMax) { maxValue = currentMax; From 4547459331e8e44de8dd7b634f23ca9bc3a88f52 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 27 Feb 2018 15:49:02 +0100 Subject: [PATCH 083/176] Empty folder deleted --- .vs/AAOlivia-Plotter/v15/.suo | Bin 18944 -> 20480 bytes AAOlivia-Plotter.njsproj | 4 ---- 2 files changed, 4 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 38ab6b7db3a2df743f2570ebb8938b23a4f63de9..756e84fad7e4e4f230057cfd51ea7d6e9fe3711a 100644 GIT binary patch delta 1819 zcmbtVUuc_E6u^cN!R@Ex+-*@gg z_ug~PJ@=fG`Pb$ATk=9Ypoq$F3Sq@m0)LguWtLhfr6xaoDklrdL20Fk5^B`9BwxyW za8qhn)?GAbpOd3>S6QW%y5WM==TRZY>2fou9cTflTlEE4XFZrr0B>NP!J`#+LNu>h zrO&iDTw~Gcty}yK76UjaOpC*?IH^U!+bY`VkhjCu2m*R|O^ zyo+u-2KRd_``NO;GH(NI2kL;$KoAH4tlw}CpBUyHz!snrV2=@*E?IDl`>R*syS4&s z#0U84sI}S2tE?^zL;yPH7^Mz}b6^n6PGA?X8yEtrs+cCh>lN8v&=H<59J*8J99QvJ zhHrdtIY4=Bl2+_-xt;EIW>vPrjvI^p#eBnSN+v6g;g=E5iId`a@vN8@$1(2_S@0)B zUgRJ*If? z<1>iww80~!#8h#dgaHt zXA=gVl^3AnvfRZ+>eYPg`Mt;Ku(KP(MXSj7Vv=%NdO=%!Ps$JzV5&ERP* zc$lWrty0i(F!}aUNYb(%rP)}QMG>RbqM$p8YnvxGAVz1~I1C)%OMWHp()2Ek4>&x1MJ-+rDiQ^Qz6873b)eu-DU8oDc`WJ% zejFIF-(;S^nUF5?6wa?>4R+PzC!0jFjgX%-24|6kYl%8weW)1XAqqShe5i2K?AW{1 zHuBS;aM!&)HpD41o-^mQu5CK2_Ficb)H#o%eTk66(fj-O mX+rz|>e|RS#C{zuJXrZ~eCP8Rj^{=j?-BZ5VpSdfXYdsFh6BC; diff --git a/AAOlivia-Plotter.njsproj b/AAOlivia-Plotter.njsproj index ad7ac2f83..b0efda416 100644 --- a/AAOlivia-Plotter.njsproj +++ b/AAOlivia-Plotter.njsproj @@ -21,10 +21,6 @@ Code - - - - From bb924041239313e76019510b51e0a3b8742a0f30 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 1 Mar 2018 10:39:05 +0100 Subject: [PATCH 084/176] Layer Code --- .vs/AAOlivia-Plotter/v15/.suo | Bin 20480 -> 19968 bytes Candles.js | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo index 756e84fad7e4e4f230057cfd51ea7d6e9fe3711a..75a627a985faa7bb108280eb66de60f896171704 100644 GIT binary patch delta 1615 zcmdT^O-NKx6u$TQ)Ny=oe*Jgyr&Kge$1&4%qOqB9&}n9ZR@I`Qg$tKYQxcq^hzd8o zvkCe^23kd+K3hZ(l|n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= zVZ}VP(_9xcH1&_&=}!C}Z z?YYBOVw~EuwuWU$f#AmeY%_48@B4eR)Sk07&_Ic}X=DNS``i5Lg&LsM5p9&t4wR)b@0O%8-(!+u$F1APFUqKU&*ymw+U#bjAdqwSz01c8nN^mbxY4_Q~h3+l#(>GMQo z;3TgqjAw(CkL?CDG znwxfdRK?GR{B%=;Vz?y-AB(cpa>wdnv*^9C;sJRd%$!L6{%dPx>+WxJKg?3SRQ>S| zC2My;AUC-KSv^NitR7q}s;NT}QPM)=lu)SKxJu6GMf$0jpiWU$_rK8{DN{XHr|)xh zH?yolG+~{{$#8I7CR#n#R!?J2_L^%ht6=rPiC)<~-)u7X4|JeG9Z^=3W99=<;5S={ zgzy~87SJ&BUW Date: Thu, 1 Mar 2018 10:57:13 +0100 Subject: [PATCH 085/176] new function names --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 0 -> 10752 bytes Candles.js | 2 +- ...-Plotter.sln => Plotters-Candles-Volumes.sln | 2 +- AAOlivia-Plotter.njsproj => Project.njsproj | 1 + Volumes.js | 2 +- 5 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .vs/Plotters-Candles-Volumes/v15/.suo rename AAOlivia-Plotter.sln => Plotters-Candles-Volumes.sln (87%) rename AAOlivia-Plotter.njsproj => Project.njsproj (99%) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo new file mode 100644 index 0000000000000000000000000000000000000000..51a2547756da9175b500b46077c3fd69ea2a4cf2 GIT binary patch literal 10752 zcmeHM&2Jk;6d$K8v?*Vuw3JdxT0&`|YwUXcu_-M$c1@8IC2EtDgAcg&CXMUZk=IFE z)u}ikaYJz9f)GN20}?&M{+oH=u$;rE;M#Ji3^){dJHwa<|xE_lTz)^*)pb)bk5M>_wS%4_8-LS-k^{;uG3N8u%Bo za{ivsX42cV(hNea1{&VQ;9s?(6LM#ELAm%ZC@|*)XiJG$AtmT#XjKhq} z)I-aLju$bMpR3_3-R(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Z zOn*a~|6mJ5?q070BDpQ(9IOxR{KhP9gP)(ym}jDy$kl*mhV-zepNYjZBa)ld!e(YR zWay?DiWvStAQ;gjRofKm*F(bBBtPXgW-Df)djlV=f6|j0`}X-Gngwo(cu2Ad^znWA z@!n||QOf-fu7zkeBNLk-;#pwrq`Nr=hj|CFV{@{9_wK;X&g|T5^JHk2A=dv7Yp$i% dwRb-GV>or{*S&vze(Bc8&)IveTmC=a{0Ba8#g_m8 literal 0 HcmV?d00001 diff --git a/Candles.js b/Candles.js index 69e59e4bc..87116675d 100644 --- a/Candles.js +++ b/Candles.js @@ -1,4 +1,4 @@ -function newAAMastersAAOliviaCandles() { +function newAAMastersPlottersCandlesVolumesCandles() { let thisObject = { diff --git a/AAOlivia-Plotter.sln b/Plotters-Candles-Volumes.sln similarity index 87% rename from AAOlivia-Plotter.sln rename to Plotters-Candles-Volumes.sln index 1fefd2de9..661fcc076 100644 --- a/AAOlivia-Plotter.sln +++ b/Plotters-Candles-Volumes.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2027 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "AAOlivia-Plotter", "AAOlivia-Plotter.njsproj", "{096B35AD-F86F-47B9-A99F-04CA93397DA8}" +Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "Project", "Project.njsproj", "{096B35AD-F86F-47B9-A99F-04CA93397DA8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/AAOlivia-Plotter.njsproj b/Project.njsproj similarity index 99% rename from AAOlivia-Plotter.njsproj rename to Project.njsproj index b0efda416..ee3f8fe27 100644 --- a/AAOlivia-Plotter.njsproj +++ b/Project.njsproj @@ -12,6 +12,7 @@ {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + Project diff --git a/Volumes.js b/Volumes.js index ae1961bf6..912dfc7c4 100644 --- a/Volumes.js +++ b/Volumes.js @@ -1,4 +1,4 @@ -function newAAMastersAAOliviaVolumes() { +function newAAMastersPlottersCandlesVolumesVolumes() { let thisObject = { From 4ed61945b827284798bf26d7f9e44aded7678cea Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 1 Mar 2018 14:05:33 +0100 Subject: [PATCH 086/176] layer status removed --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 10752 -> 19968 bytes Candles.js | 23 ++--------------------- Volumes.js | 26 ++------------------------ 3 files changed, 4 insertions(+), 45 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 51a2547756da9175b500b46077c3fd69ea2a4cf2..848191cfc14820c2eac1d0b6fd7cff9042082b56 100644 GIT binary patch delta 2330 zcmcIlUuaup6u;l?O_nA1=1-HRNt&eXl5{B)Sxvik-QtoZcBOxohB{E0Vk>)?Le>6} zwi`549~Ae{-s6*0*oF^22&2mo*@F(IAUd$(tBRm6BKl-tBJ2E}+uqW&>6kD-_;K$& z-}%1peCM3s@0Ok_t%#*#LRn4U7P>Ml8mU!j)_zX)zxUkg_aZD|(7g4$I7$`kDZ1_I z)FX;)m1$w$pn4xeh66w8q7wIX;p0=mYb2=wxVKy!O0Q$qkB>$m00e<1fbAhXBR~{r z23mkt-~bQ<)>n(uMp#Y`%enS^<_``_#Z;!A7OV?m0C6pDi%G$h1u$dkeF7g793=)D zd9cGhJUN8@c;5%u06Sm>8~}CLT9i0mmWvrn0#C&9vd{x@VW-wW1lCE& zzv%XyCb$M1AoevXBhoZ$FQ}XbF2k1j7**`2G@-%9Io+}!rCGV5@)LnVC z4o-X-(@_s7H0N5gal)!>?hC?675AdhXx39u`SP4((?_UO@!S^mI(yUf6%v?3oY~e1G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ELX9SB1AJW*6+=xis z)!+j#JgIAZX#X=xT0S!$;U{=4@7&UH$J|1Q2on*4w||g`5;20cahelElE6ov;p3ZlR!ya-8l9??4n@;Ffk7SEn_wEFYfN3bv<7qENI_3vd>D$t1}me=Ter z(r|f3;p-;M61JQx&Enc&*%oue^RI{LnHt})!BW0v4*GkpqF&O$fl$7Wche1Aj0Lb= e@#5p~5%2A#AE{FMll*hzLTkQ#WgEX%+P?uyY&g;Y diff --git a/Candles.js b/Candles.js index 87116675d..947459486 100644 --- a/Candles.js +++ b/Candles.js @@ -14,8 +14,7 @@ // Secondary functions and properties. currentCandle: undefined, - positionAtDatetime: positionAtDatetime, - onLayerStatusChanged: onLayerStatusChanged + positionAtDatetime: positionAtDatetime }; /* this is part of the module template */ @@ -24,8 +23,6 @@ container.initialize(); thisObject.container = container; - let layerStatus = 'off'; // Since the moduleis a layer, it must handle the different possible layer status. - let plotArea = newPlotArea(); // Needed to be able to plot on the timeline, otherwise not. let timePeriod; // This will hold the current Time Period the user is at. @@ -45,7 +42,7 @@ return thisObject; - function initialize(pExchange, pMarket, pDatetime, pTimePeriod, pLayerStatus, callBackFunction) { + function initialize(pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { let cursorCacheInProgress = false; let finaleStepsInProgress = false; @@ -103,8 +100,6 @@ recalculateScale(); // With any of the market files we can calculate the scale. - layerStatus = pLayerStatus; - recalculate(); viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); @@ -122,8 +117,6 @@ function getContainer(point) { - if (layerStatus !== 'on') { return; } - let container; /* First we check if this point is inside this space. */ @@ -267,8 +260,6 @@ function draw() { - if (layerStatus !== 'on') { return; } - this.container.frame.draw(); if (timePeriod < _1_HOUR_IN_MILISECONDS) { @@ -286,8 +277,6 @@ function recalculate() { - if (layerStatus === 'off') { return; } - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { recalculateUsingMarketFiles(); @@ -673,14 +662,6 @@ } } - function onLayerStatusChanged(eventData) { - - if (eventData.layer === LAYER_CODE_NAME) { - layerStatus = eventData.status; - } - - } - function onZoomChanged(event) { recalculate(); diff --git a/Volumes.js b/Volumes.js index 912dfc7c4..9edbc1813 100644 --- a/Volumes.js +++ b/Volumes.js @@ -9,11 +9,7 @@ getContainer: getContainer, setTimePeriod: setTimePeriod, setDatetime: setDatetime, - draw: draw, - - // Secondary functions and properties. - - onLayerStatusChanged: onLayerStatusChanged + draw: draw }; /* this is part of the module template */ @@ -22,8 +18,6 @@ container.initialize(); thisObject.container = container; - let layerStatus = 'off'; // Since the moduleis a layer, it must handle the different possible layer status. - let plotArea = newPlotArea(); // Needed to be able to plot on the timeline, otherwise not. let plotAreaFrame = newPlotArea(); // This chart uses this extra object. @@ -42,7 +36,7 @@ return thisObject; - function initialize(pExchange, pMarket, pDatetime, pTimePeriod, pLayerStatus, callBackFunction) { + function initialize(pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { let cursorCacheInProgress = false; let finaleStepsInProgress = false; @@ -98,8 +92,6 @@ fileCursor = newFileCursor; - layerStatus = pLayerStatus; - recalculateScaleX(); recalculate(); recalculateScaleY(); @@ -119,8 +111,6 @@ function getContainer(point) { - if (layerStatus !== 'on') { return; } - let container; /* First we check if this point is inside this space. */ @@ -202,8 +192,6 @@ function draw() { - if (layerStatus !== 'on') { return; } - this.container.frame.draw(); if (timePeriod < _1_HOUR_IN_MILISECONDS) { @@ -223,8 +211,6 @@ function recalculate() { - if (layerStatus === 'off') { return; } - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { recalculateUsingMarketFiles(); @@ -735,14 +721,6 @@ } } - function onLayerStatusChanged(eventData) { - - if (eventData.layer === 'Olivia Volumes') { - layerStatus = eventData.status; - } - - } - function onZoomChanged(event) { recalculateScaleX(); From c3a1e9677f62d9a4dabfb1ec9b082e7d0401b071 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 1 Mar 2018 19:20:10 +0100 Subject: [PATCH 087/176] Set corrected --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 19968 -> 20480 bytes Candles.js | 6 ++---- Volumes.js | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 848191cfc14820c2eac1d0b6fd7cff9042082b56..4af178b0ddcdaee7f4925f58c2e9b054a094b0a6 100644 GIT binary patch delta 1610 zcmbtUO=uHA6rR~^+O^KMo2IR8jizZ+WBqAkTT3a@MpHGKXg2hw^xz*-{HaJPrJ}4o zh(Zr0PdtcK7AQAk5*7uTblHw1DZ~2&+@4bEVerCqF z!j0?vZbagXz$3X!kFC8jeQx|EuVjoF6)+-=@EClNqM{B72VxEdVl`d}ER$i_77;~A zN(BnF8y9>y8-c)4dgvSCC7L3!`QF^bUV z*RzS({iFyfRA};*scBs3Fd_LNEp$O--2$ch0)l=69#>+#rBO9k_5AN;W69>A%Bj9o z*Sw-)N-Rc#63CM+V@WNjG8xH|1quzF+mW&Qkclm=O^Iblx(iH`wX!5L7_rscH?v{Z z1~+UCf;vfEv^FZ*hKr|pt9I}d_t|$436FZhFj2Dsrh0m5{D;b6;2d30s@6s@Up_M} z1P8}JM-cF{cH87+Rge0&>z^D9M{R-*kX$bk(K)TWeT6LSsY5T%TC6~(PaJ9lW_OX5V>FhWgWGC1F+s_W* zyqWdk`Y;<}apVTsQDh=G?m>MJ$020m=#sH+c(k_79>SRd-zuX@;rWAjl`iN;(kqdR z&1k~BIu(1W!{GXVZ_gxd70ucq7fo1DrRdqRRDX?#r|)hko|}F1}0f zu>Jz*!B!Y;I1741D|C4;(mK_6hdWoJb4yxqg6|0M#&a3_5#MJwy`z@UMca&^8)(at z@NT6WZilMqo-lr|(Xrsn8Cwi6nhev}+QFeC{0v6x0ub0_{3)WFja;KlNeUgMA`kgb DZO0ML delta 1230 zcmZ`&OHUI~6z-W0Wf-Op9tBE)LaBgFmGVX&I?!qxAhaZqun^OQTNj#QNZnLp3`>~9 z(uKNmVn0S&eckX%2d3`tk4DwIm^^ydw*dqm8 z-$!ojZR~%A4jYLZb5ahb@mNaX``Re#gEDT}m$cs`6507g@P?eDbU6SHvDv%`a{q2- zz))ph3*B1@Z3G{|PxwVa?RZBCU`X-oXKsTbErH8QUb?0K;N%*)>5W$MBpy2`xpbCX zCSwgjB*$`X_e>orY6%KKB{&H61Wx9p(?xI-JcI^9BcX{9BJ8f{xFgG_<=ljV8Ujq# zAM9pAhL%(~qLM1Br8RDxdlE{s+@^uyikY!40L@Mo?owEd78;p*+X%k5nkYAxG#)M2 zDqPHR?<(Mt6v1p~TI1??RKkko3n?dXe_U@xoAs2eHE_dc%7#@uaz(J*-+`X+q|$lL z7*1Oe?bXVBLdKKuCnxZxcyQuhRwJvVU@@X`t(i_!F80=VvvW86Dah{*OD z9nR$u;Qgw26pq#))8hl~yvTsDi-4he%3Q((h)U~L_dJw%bK0h)x z7ssN$gPFLB7#qMxb5AfmH;hyBdqP);y@Dn#S4bay%yZh~Hf9yC zhXhNbWBiHFduHwHpH+Mt@u9~XLOoG5)S`!JQw=Ps-KU&b|CbXmf}2`OW5V(3#CTvB zk4epB<-8U35N9S_WoM%Dfjhq`g2lbWksA1A@9pYiv zLyft@>=5A=;R0ub3w~3&s?11aQ<#BO{^nL_5uCt}ir Date: Fri, 2 Mar 2018 12:48:23 +0100 Subject: [PATCH 088/176] Final Details --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 20480 -> 20480 bytes Candles.js | 2 ++ Volumes.js | 2 ++ 3 files changed, 4 insertions(+) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 4af178b0ddcdaee7f4925f58c2e9b054a094b0a6..3e53531af0d60afa9fcb9580ccf7280ad49d18ee 100644 GIT binary patch delta 733 zcmZuu&r1SP5O$u=cD3F7kx7)5l~Gg&vmohaYq5}pLC`Jw7Xkwb0_hMPI_>xegwZhw z_gZw&Lr@UawPSxlbV!0~p88^geem&yZ{~gT&Ajp%l+WNQ&mf9VEWvjsUn{uBp3zXs zI%pn`Cqek3gV2}64{v57N<>eG4ADJJ2orh<-&7c(TeCO$7qm6iMRPn}dx1gRXB${o z=J2EI5e=PgB@ykSYL%c9`~-!7Q|f{h;P$Ti#(6gp*61u2^(}RTV(G<-ar_MCxmV^x z1ua0aX#cM!l-FX!1syyV!>3j}rwRN04qj-Mk`I_0`q4o;bBdLQ@6ia}SYtVj(>t*r zN7^n$3V?UxnOe;Bs=}B|y1Uoc&W&Lp!CRZ9zrh+aX;AX;r&CQZVN7x6<;G8_=Fc`H)j+sdOK5{ z-gOZF-0p2R=eKp-%>@vRDLl#^V4w0lh7tk6P!8mEv9<02F{lv+W R6tR7{`og7zn{0L6`wI)+*{J{k delta 895 zcmZuv&1%$86wbZ5X)-m*WID0fPH|??>ZmQX(nWFQG`5U(Y^E>|;3Ftpp&&wWAr%G} zIW84ST?;z*5jqbb)}>2dK*%Nt>N&AVui}A2PQLH_pSyp^_7B;IK4%qZ^QQG^`OTLD zc+5Y0M$0ga8tN|;sI@M`ofQFlX5XDckn2Qht}o6Y@RM9o0<^EAQgn#wqq?YdwJUxw z=1`?d@OJ&{%a13lp`P#^2FFvYklL-#Mn4CYig>7$6FSbCsNj!!=zJ3}v2TL(hDmz~ z(z)1URMJG2zImf^<`ktQ1*+0{p8@wbTxyTnDj1Odz^x)cGn8P8;5h`SZVAfjCc?Kb5n6hQ%IeV3&uGz@9I~tTJx1r! zr%slI+UxY0s3U<7!Rq1HfvmBeH>V#$$%PR+S`y>Vgb8|GrMt=+HXpAIJZNrB14JEo z-hBas?k%{z@w&jq(R)_EfnkNLps`~Zz@mdwpKI`R^LvdRd?EMH*i_H9PDGLBf2ofi Gn7;v-FeCT? diff --git a/Candles.js b/Candles.js index bd7cb5f24..d0ebe2e4b 100644 --- a/Candles.js +++ b/Candles.js @@ -290,6 +290,8 @@ function recalculateUsingDailyFiles() { + if (fileCursor === undefined) { return; } // We need to wait + if (fileCursor.files.size === 0) { return;} // We need to wait until there are files in the cursor let daysOnSides = getSideDays(timePeriod); diff --git a/Volumes.js b/Volumes.js index ec80cec09..db889e796 100644 --- a/Volumes.js +++ b/Volumes.js @@ -226,6 +226,8 @@ function recalculateUsingDailyFiles() { + if (fileCursor === undefined) { return; } // We need to wait + if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor let daysOnSides = getSideDays(timePeriod); From 85203e489e1f941c42d0e8f74627f2d9c42ac72e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 2 Mar 2018 21:47:52 +0100 Subject: [PATCH 089/176] Initialize improved --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 20480 -> 22528 bytes Candles.js | 74 +++++------------------ Volumes.js | 81 +++++++------------------- 3 files changed, 37 insertions(+), 118 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 3e53531af0d60afa9fcb9580ccf7280ad49d18ee..51998f4f15d066eb9f0b3c58ff9272314e3c522a 100644 GIT binary patch delta 285 zcmZozz}T>Xae{#Y0}Kc-FmM6cj6nSF|Ns9WVGw&`;CjZ%{~2@HKI|@!b=tJKh$)DX zhYcv90K`Cb|0fG7s7(ICY{4izS(ineR|F^w($52=g*FGWd>7#WF<~kWae{#Y69W_oFfgzHnT$aE@Bjb*AW>!@-Wa%^aq@rGJk~h%J5x4pE@BE| zqK&HS{ZZ46$!o$IZ zB4XgrJozw_A*%;alwHTz+$a K;|8WheoO$lq&@in diff --git a/Candles.js b/Candles.js index d0ebe2e4b..5e8cb0d86 100644 --- a/Candles.js +++ b/Candles.js @@ -40,76 +40,34 @@ return thisObject; - function initialize(pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { + function initialize(pStorage, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { - let cursorCacheInProgress = false; - let finaleStepsInProgress = false; + /* Store the information received. */ + + fileCache = pStorage.fileCache; + fileCursorCache = pStorage.fileCursorCache; datetime = pDatetime; timePeriod = pTimePeriod; - fileCache = newFileCache(); - fileCache.initialize("AAMasters", "AAOlivia", "Candles", "Market Files", pExchange, pMarket, onFileReady); + /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ - function onFileReady() { + marketFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. - let newMarketFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); + recalculateScale(); + recalculate(); - if (newMarketFile !== undefined) { + /* Now we set the right files according to current Period. */ - marketFile = newMarketFile; + marketFile = fileCache.getFile(pTimePeriod); + fileCursor = fileCursorCache.getFileCursor(pTimePeriod); - initializeFileCursorCache(); + /* Listen to the necesary events. */ - } - } + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - function initializeFileCursorCache() { - - if (cursorCacheInProgress === false) { - - cursorCacheInProgress = true; - - fileCursorCache = newFileCursorCache(); - fileCursorCache.initialize("AAMasters", "AAOlivia", "Candles", "Daily Files", pExchange, pMarket, pDatetime, pTimePeriod, onFileCursorReady); - - } - } - - function onFileCursorReady() { - - recalculate(); - - let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); - - if (newFileCursor !== undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. - - let stringDate = datetime.getUTCFullYear() + '-' + pad(datetime.getUTCMonth() + 1, 2) + '-' + pad(datetime.getUTCDate(), 2); - - let dailyFile = newFileCursor.files.get(stringDate); - - if (dailyFile !== undefined) { - - if (finaleStepsInProgress === false) { - - finaleStepsInProgress = true; - - fileCursor = newFileCursor; - - recalculateScale(); // With any of the market files we can calculate the scale. - - recalculate(); - - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - - callBackFunction(); - - } - } - } - - } + callBackFunction(); } diff --git a/Volumes.js b/Volumes.js index db889e796..ad1520b2c 100644 --- a/Volumes.js +++ b/Volumes.js @@ -30,82 +30,43 @@ let fileCache; // This object will provide the different Market Files at different Time Periods. let fileCursorCache; // This object will provide the different File Cursors at different Time Periods. + let scaleFile; // This file is used to calculate the scale. + /* these are module specific variables: */ let volumes = []; // Here we keep the volumes to be ploted every time the Draw() function is called by the AAWebPlatform. return thisObject; - function initialize(pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { + function initialize(pStorage, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { - let cursorCacheInProgress = false; - let finaleStepsInProgress = false; + /* Store the information received. */ + + fileCache = pStorage.fileCache; + fileCursorCache = pStorage.fileCursorCache; datetime = pDatetime; timePeriod = pTimePeriod; - fileCache = newFileCache(); - fileCache.initialize("AAMasters", "AAOlivia", "Volumes", "Market Files", pExchange, pMarket, onFileReady); + /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ - function onFileReady() { + scaleFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. - let newMarketFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); + recalculateScaleX(); + recalculate(); + recalculateScaleY(); - if (newMarketFile !== undefined) { + /* Now we set the right files according to current Period. */ - marketFile = newMarketFile; + marketFile = fileCache.getFile(pTimePeriod); + fileCursor = fileCursorCache.getFileCursor(pTimePeriod); - initializeFileCursorCache(); + /* Listen to the necesary events. */ - } - } + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - function initializeFileCursorCache() { - - if (cursorCacheInProgress === false) { - - cursorCacheInProgress = true; - - fileCursorCache = newFileCursorCache(); - fileCursorCache.initialize("AAMasters", "AAOlivia", "Volumes", "Daily Files", pExchange, pMarket, pDatetime, pTimePeriod, onFileCursorReady); - - } - } - - function onFileCursorReady() { - - recalculate(); - - let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); - - if (newFileCursor !== undefined) { // if the file ready is the one we need then it and we dont have it yet, then we will continue here. - - let stringDate = datetime.getUTCFullYear() + '-' + pad(datetime.getUTCMonth() + 1, 2) + '-' + pad(datetime.getUTCDate(), 2); - - let dailyFile = newFileCursor.files.get(stringDate); - - if (dailyFile !== undefined) { - - if (finaleStepsInProgress === false) { - - finaleStepsInProgress = true; - - fileCursor = newFileCursor; - - recalculateScaleX(); - recalculate(); - recalculateScaleY(); - - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - - callBackFunction(); - - } - } - } - - } + callBackFunction(); } @@ -404,9 +365,9 @@ let maxValue = 0; - for (var i = 0; i < marketFile.length; i++) { + for (var i = 0; i < scaleFile.length; i++) { - let currentMax = (marketFile[i][0] + marketFile[i][1]) * 4; + let currentMax = (scaleFile[i][0] + scaleFile[i][1]) * 4; if (maxValue < currentMax) { maxValue = currentMax; From e54b4186f0e1568fa2dd491a974aacfa9d9bbc30 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 3 Mar 2018 12:09:56 +0100 Subject: [PATCH 090/176] plotArea refactored Part 1 --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 22528 -> 20480 bytes Candles.js | 41 ++++++++++++++------------ Volumes.js | 38 +++++++++++++----------- 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 51998f4f15d066eb9f0b3c58ff9272314e3c522a..e5084fecadc0b623c010c5c4a17aacc6c30883d9 100644 GIT binary patch delta 232 zcmZqJz}T>Wae{#Y69W_oFfgzHnT$aE@Bjb*AW>!@-Wa%^aq@r0T-FE2S}xw(T*&mB znN?s@o3)zAgCm&`r-28<-gq1@9s1~U0|71Z0mB}T%7dE?SG%#*H!r#Ee0}=)q z1(V)fB6Nk3gAGMQM1j>!Su XMw6>tKMBI*K(r(fD{QWHYvu$10q;oT delta 324 zcmZozz}T>Xae{#Y0}Kc-FmM6cj6nSF|Ns9WVGw&`;CjZ%{~2>xKkP1#b=q9W^qZNL z!Q4YxW^*B15F;-mQ0adKpgIseSx`Y`^B49I)=7#wlS_CnurLE9fb7jBd>5E`*nk`k zWR)dCR~R{XP((y7Nb`V9;zSWOxFaw*!G&w`WM_@ZO^$7o100PeTRBaEiEVOT%P1@h z)Byuafex2oV3^G4+yPcw<@!mG6XY2vPyw+w*Sa-xPI6f*tO^qb(rOSkicTH4yw(AG M5F4bEd66Fz06Ozq!2kdN diff --git a/Candles.js b/Candles.js index 5e8cb0d86..8c03872e7 100644 --- a/Candles.js +++ b/Candles.js @@ -23,7 +23,7 @@ container.initialize(); thisObject.container = container; - let plotArea = newPlotArea(); // Needed to be able to plot on the timeline, otherwise not. + let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. let timePeriod; // This will hold the current Time Period the user is at. let datetime; // This will hold the current Datetime the user is at. @@ -55,7 +55,6 @@ marketFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. recalculateScale(); - recalculate(); /* Now we set the right files according to current Period. */ @@ -67,6 +66,10 @@ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + /* Get ready for plotting. */ + + recalculate(); + callBackFunction(); } @@ -167,7 +170,7 @@ y: candles[i].open }; - targetPoint = plotArea.inverseTransform(targetPoint, thisObject.container.frame.height); + targetPoint = timeLineCoordinateSystem.inverseTransform(targetPoint, thisObject.container.frame.height); targetPoint = transformThisPoint(targetPoint, thisObject.container); let targetMax = { @@ -175,7 +178,7 @@ y: candles[i].max }; - targetMax = plotArea.inverseTransform(targetMax, thisObject.container.frame.height); + targetMax = timeLineCoordinateSystem.inverseTransform(targetMax, thisObject.container.frame.height); targetMax = transformThisPoint(targetMax, thisObject.container); let targetMin = { @@ -183,7 +186,7 @@ y: candles[i].min }; - targetMin = plotArea.inverseTransform(targetMin, thisObject.container.frame.height); + targetMin = timeLineCoordinateSystem.inverseTransform(targetMin, thisObject.container.frame.height); targetMin = transformThisPoint(targetMin, thisObject.container); let center = { @@ -254,8 +257,8 @@ let daysOnSides = getSideDays(timePeriod); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, plotArea); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, plotArea); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -342,8 +345,8 @@ let daysOnSides = getSideDays(timePeriod); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, plotArea); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, plotArea); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -397,7 +400,7 @@ if (marketFile === undefined) { return; } // We need the market file to be loaded to make the calculation. - if (plotArea.maxValue > 0) { return; } // Already calculated. + if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated. let minValue = { x: EARLIEST_DATE.valueOf(), @@ -410,7 +413,7 @@ }; - plotArea.initialize( + timeLineCoordinateSystem.initialize( minValue, maxValue, thisObject.container.frame.width, @@ -466,10 +469,10 @@ y: candle.close }; - candlePoint1 = plotArea.inverseTransform(candlePoint1, thisObject.container.frame.height); - candlePoint2 = plotArea.inverseTransform(candlePoint2, thisObject.container.frame.height); - candlePoint3 = plotArea.inverseTransform(candlePoint3, thisObject.container.frame.height); - candlePoint4 = plotArea.inverseTransform(candlePoint4, thisObject.container.frame.height); + candlePoint1 = timeLineCoordinateSystem.inverseTransform(candlePoint1, thisObject.container.frame.height); + candlePoint2 = timeLineCoordinateSystem.inverseTransform(candlePoint2, thisObject.container.frame.height); + candlePoint3 = timeLineCoordinateSystem.inverseTransform(candlePoint3, thisObject.container.frame.height); + candlePoint4 = timeLineCoordinateSystem.inverseTransform(candlePoint4, thisObject.container.frame.height); candlePoint1 = transformThisPoint(candlePoint1, thisObject.container); candlePoint2 = transformThisPoint(candlePoint2, thisObject.container); @@ -505,10 +508,10 @@ y: candle.min }; - stickPoint1 = plotArea.inverseTransform(stickPoint1, thisObject.container.frame.height); - stickPoint2 = plotArea.inverseTransform(stickPoint2, thisObject.container.frame.height); - stickPoint3 = plotArea.inverseTransform(stickPoint3, thisObject.container.frame.height); - stickPoint4 = plotArea.inverseTransform(stickPoint4, thisObject.container.frame.height); + stickPoint1 = timeLineCoordinateSystem.inverseTransform(stickPoint1, thisObject.container.frame.height); + stickPoint2 = timeLineCoordinateSystem.inverseTransform(stickPoint2, thisObject.container.frame.height); + stickPoint3 = timeLineCoordinateSystem.inverseTransform(stickPoint3, thisObject.container.frame.height); + stickPoint4 = timeLineCoordinateSystem.inverseTransform(stickPoint4, thisObject.container.frame.height); stickPoint1 = transformThisPoint(stickPoint1, thisObject.container); stickPoint2 = transformThisPoint(stickPoint2, thisObject.container); diff --git a/Volumes.js b/Volumes.js index ad1520b2c..4561bcda1 100644 --- a/Volumes.js +++ b/Volumes.js @@ -18,8 +18,8 @@ container.initialize(); thisObject.container = container; - let plotArea = newPlotArea(); // Needed to be able to plot on the timeline, otherwise not. - let plotAreaFrame = newPlotArea(); // This chart uses this extra object. + let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. + let plotAreaFrame = newTimeLineCoordinateSystem(); // This chart uses this extra object. let timePeriod; // This will hold the current Time Period the user is at. let datetime; // This will hold the current Datetime the user is at. @@ -52,10 +52,6 @@ scaleFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. - recalculateScaleX(); - recalculate(); - recalculateScaleY(); - /* Now we set the right files according to current Period. */ marketFile = fileCache.getFile(pTimePeriod); @@ -66,6 +62,12 @@ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + /* Get ready for plotting. */ + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + callBackFunction(); } @@ -193,8 +195,8 @@ let daysOnSides = getSideDays(timePeriod); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, plotArea); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, plotArea); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -270,8 +272,8 @@ let daysOnSides = getSideDays(timePeriod); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, plotArea); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, plotArea); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -321,7 +323,7 @@ x: MAX_PLOTABLE_DATE.valueOf() }; - plotArea.initializeX( + timeLineCoordinateSystem.initializeX( minValue, maxValue, thisObject.container.frame.width @@ -349,7 +351,7 @@ maxValue.y = getMaxVolume() / (timePeriodRatio / 10); - plotArea.initializeY( + timeLineCoordinateSystem.initializeY( minValue, maxValue, viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y @@ -466,13 +468,13 @@ if (volumePointA1.y > viewPort.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - if (calculateBuys(plotArea, visibleHeight) === false) { continue; } // We snap t to the view port. + if (calculateBuys(timeLineCoordinateSystem, visibleHeight) === false) { continue; } // We snap t to the view port. /* Now we set the real value of y. */ volumePointA1.y = viewPort.visibleArea.bottomRight.y; - volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * plotArea.scale.y; - volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * plotArea.scale.y; + volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; + volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; volumePointA4.y = viewPort.visibleArea.bottomRight.y; } @@ -520,13 +522,13 @@ if (volumePointB1.y < viewPort.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - calculateSells(plotArea, visibleHeight); // We snap it to the view port. + calculateSells(timeLineCoordinateSystem, visibleHeight); // We snap it to the view port. /* Now we set the real value of y. */ volumePointB1.y = viewPort.visibleArea.topLeft.y; - volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * plotArea.scale.y; - volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * plotArea.scale.y; + volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; + volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; volumePointB4.y = viewPort.visibleArea.topLeft.y; } From 976393bb945af959ed04ca4d345b4cb5c2723652 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 3 Mar 2018 12:53:57 +0100 Subject: [PATCH 091/176] Refactoring Coordinate System Completed --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 20480 -> 20480 bytes Candles.js | 22 +++++++++++----------- Volumes.js | 16 ++++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index e5084fecadc0b623c010c5c4a17aacc6c30883d9..252ef6abba5d28bd285760bab4858430b271b1dc 100644 GIT binary patch delta 149 zcmZozz}T>WaYGIh>w)TPZI3q>GW}*|ZP4u~d$PHZ?Y`CI1Q)K!lbtmtH#xRV4sbM@ zY~?fsCbr3WEu-*jMg}O5I`ALJc3@zb%;?+!R$JxzNpLkxnnCKoE+AWIbFJHD7MKy( Jj9ui*3;?I$G9v&0 delta 153 zcmZozz}T>WaYGIh>w{x07w>H@Wctm_DzGW?+WpOiZ1=4u%e!$+p6skKxyi9@a)6`J zWGkmBFtJU}YZ-;tFfzb_8Ia}5z%ZH7xdW<3b8@xoM?ts(AVU&}6*kwpU1ot9gU#qg GzRUoVSuYO& diff --git a/Candles.js b/Candles.js index 8c03872e7..d7b437bf3 100644 --- a/Candles.js +++ b/Candles.js @@ -170,7 +170,7 @@ y: candles[i].open }; - targetPoint = timeLineCoordinateSystem.inverseTransform(targetPoint, thisObject.container.frame.height); + targetPoint = timeLineCoordinateSystem.transformThisPoint(targetPoint); targetPoint = transformThisPoint(targetPoint, thisObject.container); let targetMax = { @@ -178,7 +178,7 @@ y: candles[i].max }; - targetMax = timeLineCoordinateSystem.inverseTransform(targetMax, thisObject.container.frame.height); + targetMax = timeLineCoordinateSystem.transformThisPoint(targetMax); targetMax = transformThisPoint(targetMax, thisObject.container); let targetMin = { @@ -186,7 +186,7 @@ y: candles[i].min }; - targetMin = timeLineCoordinateSystem.inverseTransform(targetMin, thisObject.container.frame.height); + targetMin = timeLineCoordinateSystem.transformThisPoint(targetMin); targetMin = transformThisPoint(targetMin, thisObject.container); let center = { @@ -469,10 +469,10 @@ y: candle.close }; - candlePoint1 = timeLineCoordinateSystem.inverseTransform(candlePoint1, thisObject.container.frame.height); - candlePoint2 = timeLineCoordinateSystem.inverseTransform(candlePoint2, thisObject.container.frame.height); - candlePoint3 = timeLineCoordinateSystem.inverseTransform(candlePoint3, thisObject.container.frame.height); - candlePoint4 = timeLineCoordinateSystem.inverseTransform(candlePoint4, thisObject.container.frame.height); + candlePoint1 = timeLineCoordinateSystem.transformThisPoint(candlePoint1); + candlePoint2 = timeLineCoordinateSystem.transformThisPoint(candlePoint2); + candlePoint3 = timeLineCoordinateSystem.transformThisPoint(candlePoint3); + candlePoint4 = timeLineCoordinateSystem.transformThisPoint(candlePoint4); candlePoint1 = transformThisPoint(candlePoint1, thisObject.container); candlePoint2 = transformThisPoint(candlePoint2, thisObject.container); @@ -508,10 +508,10 @@ y: candle.min }; - stickPoint1 = timeLineCoordinateSystem.inverseTransform(stickPoint1, thisObject.container.frame.height); - stickPoint2 = timeLineCoordinateSystem.inverseTransform(stickPoint2, thisObject.container.frame.height); - stickPoint3 = timeLineCoordinateSystem.inverseTransform(stickPoint3, thisObject.container.frame.height); - stickPoint4 = timeLineCoordinateSystem.inverseTransform(stickPoint4, thisObject.container.frame.height); + stickPoint1 = timeLineCoordinateSystem.transformThisPoint(stickPoint1); + stickPoint2 = timeLineCoordinateSystem.transformThisPoint(stickPoint2); + stickPoint3 = timeLineCoordinateSystem.transformThisPoint(stickPoint3); + stickPoint4 = timeLineCoordinateSystem.transformThisPoint(stickPoint4); stickPoint1 = transformThisPoint(stickPoint1, thisObject.container); stickPoint2 = transformThisPoint(stickPoint2, thisObject.container); diff --git a/Volumes.js b/Volumes.js index 4561bcda1..776cb6147 100644 --- a/Volumes.js +++ b/Volumes.js @@ -441,10 +441,10 @@ y: 0 }; - volumePointA1 = plot.inverseTransform(volumePointA1, height); - volumePointA2 = plot.inverseTransform(volumePointA2, height); - volumePointA3 = plot.inverseTransform(volumePointA3, height); - volumePointA4 = plot.inverseTransform(volumePointA4, height); + volumePointA1 = plot.transformThisPoint(volumePointA1); + volumePointA2 = plot.transformThisPoint(volumePointA2); + volumePointA3 = plot.transformThisPoint(volumePointA3); + volumePointA4 = plot.transformThisPoint(volumePointA4); volumePointA1 = transformThisPoint(volumePointA1, thisObject.container); volumePointA2 = transformThisPoint(volumePointA2, thisObject.container); @@ -506,10 +506,10 @@ y: height }; - volumePointB1 = plot.inverseTransform2(volumePointB1, height); - volumePointB2 = plot.inverseTransform2(volumePointB2, height); - volumePointB3 = plot.inverseTransform2(volumePointB3, height); - volumePointB4 = plot.inverseTransform2(volumePointB4, height); + volumePointB1 = plot.transformThisPoint2(volumePointB1); + volumePointB2 = plot.transformThisPoint2(volumePointB2); + volumePointB3 = plot.transformThisPoint2(volumePointB3); + volumePointB4 = plot.transformThisPoint2(volumePointB4); volumePointB1 = transformThisPoint(volumePointB1, thisObject.container); volumePointB2 = transformThisPoint(volumePointB2, thisObject.container); From 27628c93a0d07c71f831724f74b226c39f2ca3a4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 3 Mar 2018 18:29:39 +0100 Subject: [PATCH 092/176] Calculating after cursor fully loaded --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 20480 -> 22528 bytes Candles.js | 83 ++++++++++---------------- Volumes.js | 75 +++++++++-------------- 3 files changed, 58 insertions(+), 100 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 252ef6abba5d28bd285760bab4858430b271b1dc..fbe04c8380a0d85aee4adf1aeeae56bd84f79f37 100644 GIT binary patch delta 260 zcmZozz}T>Xae{#Y0}Kc-FmM6cj6nSF|Ns9WVGw&`;CjZ%{~2@H3Jzxd6yChKi0KzI z+XQK@FCaGCJ*&y`Zd{WmJ8MjCa%`I%;Ak}2%4rHrY?Jd^M&SsMNnoILAQr-y%;?+! sRiin%+V!L0Zm0?nbrFbFHrKjcW`P-l&FDqG%#&Q!l5Kc1^CCYc0IG^b)c^nh delta 191 zcmZqJz}T>Wae{#Y69W_oFfgzHnT$aE@Bjb*AW>!@-Wa%^aq@r0T($$%*V-O$+FZo+ zi?LF&LRAX{j2t=nZ5m=V~FUF6FQ0EJIGA^-pY diff --git a/Candles.js b/Candles.js index d7b437bf3..67896ffa2 100644 --- a/Candles.js +++ b/Candles.js @@ -11,6 +11,10 @@ setDatetime: setDatetime, draw: draw, + /* Events declared outside the plotter. */ + + onDailyFileLoaded: onDailyFileLoaded, + // Secondary functions and properties. currentCandle: undefined, @@ -95,64 +99,37 @@ function setTimePeriod(pTimePeriod) { - timePeriod = pTimePeriod; + if (timePeriod !== pTimePeriod) { - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + timePeriod = pTimePeriod; - let newMarketFile = fileCache.getFile(pTimePeriod); + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - if (newMarketFile !== undefined) { + let newMarketFile = fileCache.getFile(pTimePeriod); - marketFile = newMarketFile; + if (newMarketFile !== undefined) { - recalculate(); + marketFile = newMarketFile; + recalculate(); + } - } + } else { - } else { + let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); - fileCursorCache.setTimePeriod(pTimePeriod); - - fileCursorCache.setDatetime(datetime); - - let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); - - if (newFileCursor !== undefined) { - - fileCursor = newFileCursor; - - recalculate(); + if (newFileCursor !== undefined) { + fileCursor = newFileCursor; + recalculate(); + } } } - - if (timePeriod === _1_HOUR_IN_MILISECONDS) { - - fileCursorCache.setTimePeriod(pTimePeriod); - - fileCursorCache.setDatetime(datetime); - - } - } - function setDatetime(newDatetime) { + function setDatetime(pDatetime) { - /* If there is a change in the day, then we take some actions, otherwise, we dont. */ + datetime = pDatetime; - let currentDate = Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS); - let newDate = Math.trunc(newDatetime.valueOf() / ONE_DAY_IN_MILISECONDS); - - datetime = newDatetime; - - if (currentDate !== newDate) { - - if (timePeriod <= _1_HOUR_IN_MILISECONDS) { - - fileCursorCache.setDatetime(newDatetime); - - } - } } function positionAtDatetime(newDatetime) { @@ -217,19 +194,21 @@ } } + function onDailyFileLoaded(event) { + + if (event.currentValue === event.totalValue) { + + /* This happens only when all of the files in the cursor have been loaded. */ + + recalculate() + + } + } + function draw() { this.container.frame.draw(); - if (timePeriod < _1_HOUR_IN_MILISECONDS) { - - if (Math.random() * 1000 > 995) { - - recalculate(); - - } - } - plotChart(); } diff --git a/Volumes.js b/Volumes.js index 776cb6147..555dd9549 100644 --- a/Volumes.js +++ b/Volumes.js @@ -2,6 +2,10 @@ let thisObject = { + /* Events declared outside the plotter. */ + + onDailyFileLoaded: onDailyFileLoaded, + // Main functions and properties. initialize: initialize, @@ -93,63 +97,49 @@ function setTimePeriod(pTimePeriod) { - timePeriod = pTimePeriod; + if (timePeriod !== pTimePeriod) { - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + timePeriod = pTimePeriod; - let newMarketFile = fileCache.getFile(pTimePeriod); + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - if (newMarketFile !== undefined) { + let newMarketFile = fileCache.getFile(pTimePeriod); - marketFile = newMarketFile; + if (newMarketFile !== undefined) { - recalculate(); + marketFile = newMarketFile; + recalculate(); + } - } + } else { - } else { + let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); - fileCursorCache.setTimePeriod(pTimePeriod); - - fileCursorCache.setDatetime(datetime); - - let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); - - if (newFileCursor !== undefined) { - - fileCursor = newFileCursor; - - recalculate(); + if (newFileCursor !== undefined) { + fileCursor = newFileCursor; + recalculate(); + } } } + } - if (timePeriod === _1_HOUR_IN_MILISECONDS) { + function setDatetime(pDatetime) { - fileCursorCache.setTimePeriod(pTimePeriod); - - fileCursorCache.setDatetime(datetime); - - } + datetime = pDatetime; } - function setDatetime(newDatetime) { + function onDailyFileLoaded(event) { - /* If there is a change in the day, then we take some actions, otherwise, we dont. */ + if (event.currentValue === event.totalValue) { - let currentDate = Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS); - let newDate = Math.trunc(newDatetime.valueOf() / ONE_DAY_IN_MILISECONDS); + /* This happens only when all of the files in the cursor have been loaded. */ - datetime = newDatetime; + recalculateScaleX(); + recalculate(); + recalculateScaleY(); - if (currentDate !== newDate) { - - if (timePeriod <= _1_HOUR_IN_MILISECONDS) { - - fileCursorCache.setDatetime(newDatetime); - - } } } @@ -157,17 +147,6 @@ this.container.frame.draw(); - if (timePeriod < _1_HOUR_IN_MILISECONDS) { - - if (Math.random() * 1000 > 995) { - - recalculateScaleX(); - recalculate(); - recalculateScaleY(); - - } - } - plotChart(); } From 2e043b915112ba3469a2a017b539aa0c2a488e51 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 3 Mar 2018 19:07:04 +0100 Subject: [PATCH 093/176] Final Touches --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 22528 -> 22528 bytes Candles.js | 7 +------ Volumes.js | 11 +++-------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index fbe04c8380a0d85aee4adf1aeeae56bd84f79f37..fe2495318acc26b59f6d5be21a431ee66bb83679 100644 GIT binary patch delta 173 zcmZqJz}T>XaYGIhtH1=W^^%(lnSL{~1~69Y1DR|#cEa@x2rv=I6lGwT%;?-PIl$3q za+T{R!JPXaYGIhYr(;+pTe69nSL{~PLSsM0%Wq;*a=54z<}0)SO{}6qjSgP07s+A lRj!`|cf+KC^hF?6*<9;(nPqc;;|8WperuV?(I3>z3IM@jB#Hn4 diff --git a/Candles.js b/Candles.js index 67896ffa2..0e2f77d35 100644 --- a/Candles.js +++ b/Candles.js @@ -196,13 +196,8 @@ function onDailyFileLoaded(event) { - if (event.currentValue === event.totalValue) { + recalculate(); - /* This happens only when all of the files in the cursor have been loaded. */ - - recalculate() - - } } function draw() { diff --git a/Volumes.js b/Volumes.js index 555dd9549..ebf89b359 100644 --- a/Volumes.js +++ b/Volumes.js @@ -132,15 +132,10 @@ function onDailyFileLoaded(event) { - if (event.currentValue === event.totalValue) { + recalculateScaleX(); + recalculate(); + recalculateScaleY(); - /* This happens only when all of the files in the cursor have been loaded. */ - - recalculateScaleX(); - recalculate(); - recalculateScaleY(); - - } } function draw() { From c6e242ea00758621889c2517ef3c00e7a0fb534a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 12 Mar 2018 12:51:49 +0100 Subject: [PATCH 094/176] Roll back --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 22528 -> 22016 bytes Candles.js | 7 ++++++- Volumes.js | 11 ++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index fe2495318acc26b59f6d5be21a431ee66bb83679..e96c3c5353c49ce3a5d00b274a676c26f4dac3c7 100644 GIT binary patch delta 707 zcmaJ<%}X0W6wjNTd>A)%gQBU1c4NarA;m;Qr1TJp7Qqh^v86};;KPXM zFX@H#CDy||Sx1;wwH?5j%&~>qT(3^%|I~@=a!&S9Fza%n3nJ3VU=6OBsDd+IfLLol z9*T>!cl2``hBwU zV`Fh~db|Af=F55T?sS)OySMBNlaT)2YAnQF5%ybQKM|JE;J&VBTnd$MgI}@J7`^97 zS4-b3mNuvIbMvit4^8djud`h27e*ln{8g+}2F<~$osmwm0oV|^7}sATunCt&g8$05 rrzB~0UYC{;vbY!Cv0;)>QSB2XYxBt>LV@F86h z-=O?}t0R)!RjDXIqQgiCQ6MV*07V)aA8+iO5(`#(nw_`vX5Q}hcB!{d+t({by7Go$ zV^6>^NfM!Df6(3|PUvZN`|e&Tj-RP_)bChhVY9W-JQm;*|H z)N#jZWoM8K584kYQ0r4`v~jHzf2DbTt{(6QcZrYGU>tLm`Wcj3fCEecIY9cP>%wuq zh}ds?u%*wRD&ck8a~43z$dQH{)9?G8-N?S9tl49d+l4B3^%p%2qB21`esu98X_1Nr ziBg@Fxr+Zd_q5zRbun(_4jhtqnLj1q?iH{i&rGnjLDo=Ug4sHEulhl`rA?%A?Q~Y$ zE&CMB!LN)uVKvxVlP2`sbMtY&`kTVCB8qAG7kObJ+WP$M$InNP;~n+nlKjs2DbOl% zoAf`kGk#b#M>iKY6PAw_yf|OPgt{42T3S9?KIp{PqEBH_g)1g1q8o=+u8(6pHB<97 wuQir=^VX0)#T&Q3o7`#H%+1UEqVaNcw0iSx%0>4NGr2dAV*Mk1l?grd7wgOL>Hq)$ diff --git a/Candles.js b/Candles.js index 0e2f77d35..43fe7b6e5 100644 --- a/Candles.js +++ b/Candles.js @@ -196,8 +196,13 @@ function onDailyFileLoaded(event) { - recalculate(); + if (event.currentValue === event.totalValue) { + /* This happens only when all of the files in the cursor have been loaded. */ + + recalculate(); + + } } function draw() { diff --git a/Volumes.js b/Volumes.js index ebf89b359..555dd9549 100644 --- a/Volumes.js +++ b/Volumes.js @@ -132,10 +132,15 @@ function onDailyFileLoaded(event) { - recalculateScaleX(); - recalculate(); - recalculateScaleY(); + if (event.currentValue === event.totalValue) { + /* This happens only when all of the files in the cursor have been loaded. */ + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } } function draw() { From 8b67f239649472be530218b61f3a7c2b9a47e456 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Thu, 29 Mar 2018 19:49:59 +0200 Subject: [PATCH 095/176] Create LICENSE --- LICENSE | 661 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 661 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..dbbe35581 --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. From dc0a290219a765f28daee305a7fddea948708e60 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 18 Apr 2018 23:04:55 +0200 Subject: [PATCH 096/176] Candles Profile Picture --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 22016 -> 30720 bytes CandlePanel.js | 303 ++++++++++++++++++++++++++ Candles.png | Bin 0 -> 10842 bytes Project.njsproj | 5 + VolumePanel.js | 224 +++++++++++++++++++ this.plotter.config.json | 27 +++ 6 files changed, 559 insertions(+) create mode 100644 CandlePanel.js create mode 100644 Candles.png create mode 100644 VolumePanel.js create mode 100644 this.plotter.config.json diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index e96c3c5353c49ce3a5d00b274a676c26f4dac3c7..1408ec49f5e865da9fd52ea7ad9ee86a99962624 100644 GIT binary patch literal 30720 zcmeHPU5p!76&|+@ZPQW+EhV(2*`{eIQ2(vH-gT0u@vgH?$ZoUU-E0dO+KD~hc;mHQ z&p4ZHe)_{(pOAP!LIuRn14yk@B!onfkU)SCLMl=v=wpGWf|Tbrj~Ip^GS&b^+$zP0DwAO8HFe<+S{RJl?4VB=QhW482wEv|f0QEtWa z4S)|eHa3{Wd_?`QgGOLpDdT4-Bg%25gnLz4=Ty25cPqQ(lG zXzePnr5yl%c4ZHM?XYEajD8k5`^h*6rDKMenxmj@LFmgY?~iy8x_%eZ2>80N^a! z?)f2<`@B^)j{6q?G3&Wqd3)Lf%8daMfZG5M1CoG40Jg;sts}6N{Qt&3pS^ARZ*K?g z$9(ww&p{Xr|C2{Y0GwUidImfHON!Wqw>OCMCGu#IYAb=Qk1&)VE?S3sIn`<+}BJk?K zI|E%uhbFY3oHKPWL&=(&kuHjLyh{B?&PB(9wu}f zPqwG_N7;2lfHLq#fZP7BqO7HUnfflZ%qnz06?)(_@D}l`D^fGn&<;bHLffdHYv#2v zDu;ldGSy4}$>(^*3_kzMk-I+cKK~Df|EYtKf-JV`dfQI?e**F*hact20whlf5~z$j zQ>u_cy#nPQWf}D`xBa)vpGio)Ead+(u$3Y4OTavXn2LKES6boS!a=M*)Lm(3y2Vfb z1NBCR1+%xb!3&6$>T;H?DZ)Ch)N|U8MF{<;?n>MYW~DtYw2^5aGc-$iz20~FL!516 zYdBB#kN|%6hc=a4{IuQW`op!Gt_ZGQoEMHI?S00%M$*T}xE<&Nus<`-HAve0&OF-x zv?-*Gz_#uKi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`B=?JnqyHJ_KLMWDG-Ut) diff --git a/CandlePanel.js b/CandlePanel.js new file mode 100644 index 000000000..babd6f50d --- /dev/null +++ b/CandlePanel.js @@ -0,0 +1,303 @@ + +function newCandlePanel() { + + var currentCandlePanel = { + onCurrentCandleChanged: onCurrentCandleChanged, + container: undefined, + draw: draw, + getContainer: getContainer, + initialize: initialize + }; + + var container = newContainer(); + container.initialize(); + currentCandlePanel.container = container; + + container.displacement.containerName = "Current Candle Panel"; + container.zoom.containerName = "Current Candle Panel"; + container.frame.containerName = "Current Candle Panel"; + + let currentCandle; + + return currentCandlePanel; + + function initialize() { + + currentCandlePanel.container.frame.width = 250; + currentCandlePanel.container.frame.height = 300; + + currentCandlePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentCandlePanel.container.frame.width - 180; + currentCandlePanel.container.frame.position.y = 0; + + + } + + + + function getContainer(point) { + + var container; + + /* First we check if this point is inside this space. */ + + if (this.container.frame.isThisPointHere(point, true) === true) { + + return this.container; + + } else { + + /* This point does not belong to this space. */ + + return undefined; + } + + } + + + function onCurrentCandleChanged(lastCurrentCandle) { + + currentCandle = lastCurrentCandle; + + } + + + function draw() { + + this.container.frame.draw(false, false, true); + + plotCurrentCandleInfo(); + + } + + + function plotCurrentCandleInfo() { + + if (currentCandle === undefined) { return; } + if (currentCandle.innerCandle === undefined) { return; } + + const frameBodyHeight = currentCandlePanel.container.frame.getBodyHeight(); + const frameTitleHeight = currentCandlePanel.container.frame.height - frameBodyHeight; + + const X_AXIS = currentCandlePanel.container.frame.width / 2; + const Y_AXIS = frameTitleHeight + frameBodyHeight / 2; + + var candlePoint1 = { + x: X_AXIS - currentCandle.bodyWidth / 2, + y: Y_AXIS - currentCandle.bodyHeight / 2 + }; + + var candlePoint2 = { + x: X_AXIS + currentCandle.bodyWidth / 2, + y: Y_AXIS - currentCandle.bodyHeight / 2 + }; + + var candlePoint3 = { + x: X_AXIS + currentCandle.bodyWidth / 2, + y: Y_AXIS + currentCandle.bodyHeight / 2 + }; + + var candlePoint4 = { + x: X_AXIS - currentCandle.bodyWidth / 2, + y: Y_AXIS + currentCandle.bodyHeight / 2 + }; + + + var stickPoint1 = { + x: X_AXIS - currentCandle.stickWidth / 2, + y: candlePoint1.y - currentCandle.stickStart + }; + + var stickPoint2 = { + x: X_AXIS + currentCandle.stickWidth / 2, + y: candlePoint1.y - currentCandle.stickStart + }; + + var stickPoint3 = { + x: X_AXIS + currentCandle.stickWidth / 2, + y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight + }; + + var stickPoint4 = { + x: X_AXIS - currentCandle.stickWidth / 2, + y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight + }; + + + /* Extra bounderies due to constrained space */ + + const upperLimit = frameTitleHeight + frameBodyHeight * 0.15; + const downLimit = frameTitleHeight + frameBodyHeight * 0.85; + + if (candlePoint1.y < upperLimit) { + + candlePoint1.y = upperLimit; + candlePoint2.y = upperLimit; + + } + + if (stickPoint1.y < upperLimit) { + + stickPoint1.y = upperLimit; + stickPoint2.y = upperLimit; + + } + + if (candlePoint3.y < upperLimit) { + + candlePoint3.y = upperLimit; + candlePoint4.y = upperLimit; + + } + + if (stickPoint3.y < upperLimit) { + + stickPoint3.y = upperLimit; + stickPoint4.y = upperLimit; + + } + + if (candlePoint1.y > downLimit) { + + candlePoint1.y = downLimit; + candlePoint2.y = downLimit; + + } + + if (stickPoint1.y > downLimit) { + + stickPoint1.y = downLimit; + stickPoint2.y = downLimit; + + } + + if (candlePoint3.y > downLimit) { + + candlePoint3.y = downLimit; + candlePoint4.y = downLimit; + + } + + if (stickPoint3.y > downLimit) { + + stickPoint3.y = downLimit; + stickPoint4.y = downLimit; + + } + + + candlePoint1 = currentCandlePanel.container.frame.frameThisPoint(candlePoint1); + candlePoint2 = currentCandlePanel.container.frame.frameThisPoint(candlePoint2); + candlePoint3 = currentCandlePanel.container.frame.frameThisPoint(candlePoint3); + candlePoint4 = currentCandlePanel.container.frame.frameThisPoint(candlePoint4); + + stickPoint1 = currentCandlePanel.container.frame.frameThisPoint(stickPoint1); + stickPoint2 = currentCandlePanel.container.frame.frameThisPoint(stickPoint2); + stickPoint3 = currentCandlePanel.container.frame.frameThisPoint(stickPoint3); + stickPoint4 = currentCandlePanel.container.frame.frameThisPoint(stickPoint4); + + + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(stickPoint1.x, stickPoint1.y); + browserCanvasContext.lineTo(stickPoint2.x, stickPoint2.y); + browserCanvasContext.lineTo(stickPoint3.x, stickPoint3.y); + browserCanvasContext.lineTo(stickPoint4.x, stickPoint4.y); + + browserCanvasContext.closePath(); + browserCanvasContext.fillStyle = 'rgba(54, 54, 54, 1)'; + browserCanvasContext.fill(); + + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(candlePoint1.x, candlePoint1.y); + browserCanvasContext.lineTo(candlePoint2.x, candlePoint2.y); + browserCanvasContext.lineTo(candlePoint3.x, candlePoint3.y); + browserCanvasContext.lineTo(candlePoint4.x, candlePoint4.y); + + browserCanvasContext.closePath(); + + const OPACITY = '1'; + + if (currentCandle.innerCandle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(27, 7, 105, ' + OPACITY + ')'; } + + if (currentCandle.innerCandle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, ' + OPACITY + ')'; } + + browserCanvasContext.fill(); + + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + + + browserCanvasContext.beginPath(); + + /* put the labels with the candles values */ + + + + + let y; + + printLabel('High', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '1'); + printLabel(currentCandle.innerCandle.max, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '0.50'); + + printLabel('Low', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '1'); + printLabel(currentCandle.innerCandle.min, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '0.50'); + + + y = Y_AXIS - currentCandle.bodyHeight / 2; + + if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } + if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } + + printLabel('Open', X_AXIS * 1 / 2, y , '1'); + printLabel(currentCandle.innerCandle.open, X_AXIS * 1 / 2, y + frameBodyHeight * 0.05, '0.50'); + + y = Y_AXIS + currentCandle.bodyHeight / 2; + + if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } + if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } + + printLabel('Close', X_AXIS * 3 / 2, y , '1'); + printLabel(currentCandle.innerCandle.close, X_AXIS * 3 / 2, y + frameBodyHeight * 0.05, '0.50'); + + + + function printLabel(labelToPrint, x, y, opacity) { + + let labelPoint; + let fontSize = 10; + + browserCanvasContext.font = fontSize + 'px Courier New'; + + let label = '' + labelToPrint; + + let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO; + + labelPoint = { + x: x - xOffset, + y: y + }; + + labelPoint = currentCandlePanel.container.frame.frameThisPoint(labelPoint); + + browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + opacity + ')'; + browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); + + } + + browserCanvasContext.closePath(); + browserCanvasContext.fill(); + + } + + +} + diff --git a/Candles.png b/Candles.png new file mode 100644 index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xq(VRa{rxl)+c<1KQ$Tte`)fl4axBa=C;Kvw(tZnLgPQf@uAZ3@+Z8b z&%}#?`0$2=<3$PoSLak7{3#P5)%yqqDiR0*1Q~MmzgyQuUa$b)=j&t*kSkBVbAYKC zlTvY{GS)?obc+c7&$J?SYzkr|G@1xCk)_o6#cvio6yQK0Bmn`A8}3`XysZAp^uHyPO! zQ`H~-dyE@A*I14_;$?McHp(gJ^>sPwBa57XsWAD=iD&;PWXc%dIU@-)0}S+OBP>5% z>i$ol=)v%}5tA$JV+xqFa`4x%MO9#a6I(^~;Mc?LZl-Mtnr=K30d}_6-usjE|E!AL z+tUBPMZ1-)K6Pe` + + Code + + + diff --git a/VolumePanel.js b/VolumePanel.js new file mode 100644 index 000000000..4a2d08eb6 --- /dev/null +++ b/VolumePanel.js @@ -0,0 +1,224 @@ + +function newVolumePanel() { + + var currentVolumePanel = { + onCurrentVolumeChanged: onCurrentVolumeChanged, + container: undefined, + draw: draw, + getContainer: getContainer, + initialize: initialize + }; + + var container = newContainer(); + container.initialize(); + currentVolumePanel.container = container; + + container.displacement.containerName = "Current Volume Panel"; + container.zoom.containerName = "Current Volume Panel"; + container.frame.containerName = "Current Volume Panel"; + + let currentVolume; + + return currentVolumePanel; + + function initialize() { + + currentVolumePanel.container.frame.width = 250; + currentVolumePanel.container.frame.height = 300; + + currentVolumePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentVolumePanel.container.frame.width; + currentVolumePanel.container.frame.position.y = 0; + + + } + + + + function getContainer(point) { + + var container; + + /* First we check if this point is inside this space. */ + + if (this.container.frame.isThisPointHere(point, true) === true) { + + return this.container; + + } else { + + /* This point does not belong to this space. */ + + return undefined; + } + + } + + + function onCurrentVolumeChanged(lastCurrentVolume) { + + currentVolume = lastCurrentVolume; + + } + + + function draw() { + + this.container.frame.draw(false, false, true); + + plotCurrentVolumeInfo(); + + } + + + function plotCurrentVolumeInfo() { + + if (currentVolume === undefined) { return; } + if (currentVolume.innerVolumeBar === undefined) { return; } + + const frameBodyHeight = currentVolumePanel.container.frame.getBodyHeight(); + const frameTitleHeight = currentVolumePanel.container.frame.height - frameBodyHeight; + + const X_AXIS = currentVolumePanel.container.frame.width / 2; + const Y_AXIS_BUY = frameTitleHeight + frameBodyHeight * 0.85; + const Y_AXIS_SELL = frameTitleHeight + frameBodyHeight * 0.15; + + var buyVolumePoint1 = { + x: X_AXIS - currentVolume.buyInfo.baseWidth / 2, + y: Y_AXIS_BUY + }; + + var buyVolumePoint2 = { + x: X_AXIS - currentVolume.buyInfo.topWidth / 2, + y: Y_AXIS_BUY + currentVolume.buyInfo.height + }; + + var buyVolumePoint3 = { + x: X_AXIS + currentVolume.buyInfo.topWidth / 2, + y: Y_AXIS_BUY + currentVolume.buyInfo.height + }; + + var buyVolumePoint4 = { + x: X_AXIS + currentVolume.buyInfo.baseWidth / 2, + y: Y_AXIS_BUY + }; + + buyVolumePoint1 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint1); + buyVolumePoint2 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint2); + buyVolumePoint3 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint3); + buyVolumePoint4 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint4); + + buyVolumePoint1 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint1); + buyVolumePoint2 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint2); + buyVolumePoint3 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint3); + buyVolumePoint4 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint4); + + var sellVolumePoint1 = { + x: X_AXIS - currentVolume.buyInfo.baseWidth / 2, + y: Y_AXIS_SELL + }; + + var sellVolumePoint2 = { + x: X_AXIS - currentVolume.buyInfo.topWidth / 2, + y: Y_AXIS_SELL + currentVolume.sellInfo.height + }; + + var sellVolumePoint3 = { + x: X_AXIS + currentVolume.buyInfo.topWidth / 2, + y: Y_AXIS_SELL + currentVolume.sellInfo.height + }; + + var sellVolumePoint4 = { + x: X_AXIS + currentVolume.buyInfo.baseWidth / 2, + y: Y_AXIS_SELL + }; + + sellVolumePoint1 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint1); + sellVolumePoint2 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint2); + sellVolumePoint3 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint3); + sellVolumePoint4 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint4); + + sellVolumePoint1 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint1); + sellVolumePoint2 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint2); + sellVolumePoint3 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint3); + sellVolumePoint4 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint4); + + const OPACITY = '0.40'; + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(buyVolumePoint1.x, buyVolumePoint1.y); + browserCanvasContext.lineTo(buyVolumePoint2.x, buyVolumePoint2.y); + browserCanvasContext.lineTo(buyVolumePoint3.x, buyVolumePoint3.y); + browserCanvasContext.lineTo(buyVolumePoint4.x, buyVolumePoint4.y); + + browserCanvasContext.closePath(); + + browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, ' + OPACITY + ')'; + browserCanvasContext.fillStyle = 'rgba(64, 217, 26, ' + OPACITY + ')'; + + browserCanvasContext.fill(); + + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(sellVolumePoint1.x, sellVolumePoint1.y); + browserCanvasContext.lineTo(sellVolumePoint2.x, sellVolumePoint2.y); + browserCanvasContext.lineTo(sellVolumePoint3.x, sellVolumePoint3.y); + browserCanvasContext.lineTo(sellVolumePoint4.x, sellVolumePoint4.y); + + browserCanvasContext.closePath(); + + browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, ' + OPACITY + ')'; + browserCanvasContext.fillStyle = 'rgba(219, 18, 18, ' + OPACITY + ')'; + + browserCanvasContext.fill(); + + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + + + /* put the labels with the volumes values */ + + browserCanvasContext.beginPath(); + + printLabel('Buy Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '1'); + printLabel(currentVolume.innerVolumeBar.amountBuy, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '0.50'); + + printLabel('Sell Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '1'); + printLabel(currentVolume.innerVolumeBar.amountSell, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '0.50'); + + + function printLabel(labelToPrint, x, y, opacity) { + + let labelPoint; + let fontSize = 10; + + browserCanvasContext.font = fontSize + 'px Courier New'; + + let label = '' + labelToPrint; + + let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO; + + labelPoint = { + x: x - xOffset, + y: y + }; + + labelPoint = currentVolumePanel.container.frame.frameThisPoint(labelPoint); + + browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + opacity + ')'; + browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); + + } + + browserCanvasContext.closePath(); + browserCanvasContext.fill(); + + } + + +} + diff --git a/this.plotter.config.json b/this.plotter.config.json new file mode 100644 index 000000000..13724b2f2 --- /dev/null +++ b/this.plotter.config.json @@ -0,0 +1,27 @@ +{ + "modules": [ + { + "codeName": "Candles", + "moduleName": "Candles", + "description": "Plots traditional red and green candles.", + "profilePicture": "Candles.png", + "panels": [ + { + "codeName": "Current Candle", + "moduleName": "CandlePanel" + } + ] + }, + { + "codeName": "Volumes", + "description": "Plots volumes separated in buy and sell.", + "moduleName": "Volumes", + "panels": [ + { + "codeName": "Current Volume", + "moduleName": "VolumePanel" + } + ] + } + ] +} \ No newline at end of file From e5b57afba9abf6dcf302c10f5e468c663930bbe2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 19 Apr 2018 10:14:39 +0200 Subject: [PATCH 097/176] Profile Pictures Added --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 30720 -> 30720 bytes Volumes.png | Bin 0 -> 15665 bytes this.plotter.config.json | 4 ++++ 3 files changed, 4 insertions(+) create mode 100644 Volumes.png diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 1408ec49f5e865da9fd52ea7ad9ee86a99962624..95cb3d17c806527f257e1fd287e316b0816acdea 100644 GIT binary patch delta 676 zcmZqpz}WDCaYHT>Pvmu@ZPza|N-!`m9GG0mRL$77`70AMBU1qD=3mT3OuPZLrwl;~ z)Fq7ft61@OM7LYYymstPg6>>ClGIliAbvAS~)-^FOu+(+j{NM8( zyD+A>(PYEe=*b5n*e1X8e_v)yU1w!qU~!%*}B#U({@7bu79pEOe2S8Pu{e zxEz@*7}YxYf~Tws5$Yv?3MDqLi{ocx6$Lt6Ve-X9{mJM3`4=THF>-EZOcG^gJTTcl kxqtFqR|8;>f`VoZkUx9#rcw^Z$p_LJHf1m~4Got906G56C;$Ke delta 626 zcmZqpz}WDCaYHT>Pu-2hVb?D+N-zMyz>g z9PG#?|Tc=}D40o4@G$b8U9kYh*-- zSpVb|N;FF{PBhm|HcT|uH8C)-)J@#{-}4>2Fs8WCWW(6#$p<3XCcpFJ*qj+Oi=8{w zC@syxGS$*7Epann)NE#TEV?W#bdi)9)UqqJQ>Lq{*B{r{%<7Z^$ z2YSU}^2J2`$>;s~7bP$;a%^Ty5@lvwGub|Q_T-AR8*C;`b7#H&J^7-6!Q_VYhRF{M hQh+#SQwB2=z1_+TbSpnDw{EUT<6xX@z{G~^N&u7X$v6N2 diff --git a/Volumes.png b/Volumes.png new file mode 100644 index 0000000000000000000000000000000000000000..aaea183a67a84a47364d5f09445367a52c27eddf GIT binary patch literal 15665 zcmZ{LWmH>T6E0R<3&q_j?poZnK=GnMOL2F1El?;SNC{HBI7N#W3#Al-Ly!h5?gY5$ z`~A9W-MeyCw~$Ga z5SepS`A7^bj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}{%XsGBa*DKmY{~v{WCmsL* literal 0 HcmV?d00001 diff --git a/this.plotter.config.json b/this.plotter.config.json index 13724b2f2..54814ecfd 100644 --- a/this.plotter.config.json +++ b/this.plotter.config.json @@ -1,4 +1,7 @@ { + "displayName": "Plotters Candles & Volumes", + "codeName": "PlottersCandlesVolumes", + "devTeam": "AAMasters", "modules": [ { "codeName": "Candles", @@ -16,6 +19,7 @@ "codeName": "Volumes", "description": "Plots volumes separated in buy and sell.", "moduleName": "Volumes", + "profilePicture": "Volumes.png", "panels": [ { "codeName": "Current Volume", From d6e1739bdc1a5f9968d461a80ee0a19c37cf8207 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 20 Apr 2018 23:00:34 +0200 Subject: [PATCH 098/176] Panels Working --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 30720 -> 31744 bytes CandlePanel.js | 11 ++++------- Candles.js | 2 +- VolumePanel.js | 9 +++------ Volumes.js | 6 +++--- this.plotter.config.json | 10 ++++++---- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 95cb3d17c806527f257e1fd287e316b0816acdea..ab22d4d832e34b890e63946f4c163e1835043a7f 100644 GIT binary patch delta 1429 zcmchWO-NKx6vyAa^PZ#QbDSB+dZUh-PGxG&(?&5hKhmtQ#zY0vDf}QLf>tiluo;5P z%+TJUMJsipT@=o1(ZWnzrl_%V^}UcVk``U~aqhYIf9^f^yz>Gd zNFYMSD~M(Kkeiz4-UMH+yj~(sj^hH^FhB>$E%-tk#of4IMb>bD)!`Bx=)^$3!B1%n zd^2SEQnX#B(1%T1E7oibS`o2pewt==eH14WuIV?iOI*n9CJDxQQOv>lKBQ=UEi>)_ zS`T7|MSBK`svr5w#9Zx))-U55cH+ji-eBB#gE7UQj3Ih1@i^y^SR_GP-+?w4VR>#I ziQ2viZ4#2I`MM^3lb?a}Ok@|5g=8ap5Y!f}>&+X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ujQ2VoxZ_G=D5!WxM;a7wAQ*^y zLyDq!hXb)uMTs}YL!lV9L|$MxGKJaG^?c*%TUIC@juThLPikWi|7C%tu}z%5E^oP9 z8LtBahs)O(Ji^xD7EC(g{B`UVVA9@$AL4%Ob@?$o5}=#v#MXojO@r$dJ00Y$h{vnL WZdbo9`rb&f85f5Ra0Y diff --git a/CandlePanel.js b/CandlePanel.js index babd6f50d..13dfed4b8 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -1,8 +1,8 @@  -function newCandlePanel() { +function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { var currentCandlePanel = { - onCurrentCandleChanged: onCurrentCandleChanged, + onEventRaised: onEventRaised, container: undefined, draw: draw, getContainer: getContainer, @@ -26,14 +26,11 @@ function newCandlePanel() { currentCandlePanel.container.frame.width = 250; currentCandlePanel.container.frame.height = 300; - currentCandlePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentCandlePanel.container.frame.width - 180; + currentCandlePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentCandlePanel.container.frame.width * 2; currentCandlePanel.container.frame.position.y = 0; - } - - function getContainer(point) { var container; @@ -54,7 +51,7 @@ function newCandlePanel() { } - function onCurrentCandleChanged(lastCurrentCandle) { + function onEventRaised(lastCurrentCandle) { currentCandle = lastCurrentCandle; diff --git a/Candles.js b/Candles.js index 43fe7b6e5..52ebb6905 100644 --- a/Candles.js +++ b/Candles.js @@ -565,7 +565,7 @@ innerCandle: candle }; - thisObject.container.eventHandler.raiseEvent("Current Candle Info Changed", currentCandle); + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); } else { diff --git a/VolumePanel.js b/VolumePanel.js index 4a2d08eb6..0795dd57b 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -1,8 +1,8 @@  -function newVolumePanel() { +function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { var currentVolumePanel = { - onCurrentVolumeChanged: onCurrentVolumeChanged, + onEventRaised: onEventRaised, container: undefined, draw: draw, getContainer: getContainer, @@ -29,11 +29,8 @@ function newVolumePanel() { currentVolumePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentVolumePanel.container.frame.width; currentVolumePanel.container.frame.position.y = 0; - } - - function getContainer(point) { var container; @@ -54,7 +51,7 @@ function newVolumePanel() { } - function onCurrentVolumeChanged(lastCurrentVolume) { + function onEventRaised(lastCurrentVolume) { currentVolume = lastCurrentVolume; diff --git a/Volumes.js b/Volumes.js index 555dd9549..413dd2708 100644 --- a/Volumes.js +++ b/Volumes.js @@ -215,7 +215,7 @@ if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); + thisObject.container.eventHandler.raiseEvent("Current Volume Changed", thisObject.currentCandle); } } @@ -610,7 +610,7 @@ if (dateValue >= volume.begin && dateValue <= volume.end) { - browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current candle accroding to time + browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current volume accroding to time } else { @@ -656,7 +656,7 @@ innerVolumeBar: volume }; - thisObject.container.eventHandler.raiseEvent("Current Volume Info Changed", currentVolume); + thisObject.container.eventHandler.raiseEvent("Current Volume Changed", currentVolume); } } diff --git a/this.plotter.config.json b/this.plotter.config.json index 54814ecfd..11e87aa45 100644 --- a/this.plotter.config.json +++ b/this.plotter.config.json @@ -10,8 +10,9 @@ "profilePicture": "Candles.png", "panels": [ { - "codeName": "Current Candle", - "moduleName": "CandlePanel" + "codeName": "CandlePanel", + "moduleName": "CandlePanel", + "event": "Current Candle Changed" } ] }, @@ -22,8 +23,9 @@ "profilePicture": "Volumes.png", "panels": [ { - "codeName": "Current Volume", - "moduleName": "VolumePanel" + "codeName": "VolumePanel", + "moduleName": "VolumePanel", + "event": "Current Volume Changed" } ] } From e21b20b73f3e49edd6170f05bed65d52ccdab582 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 22 Apr 2018 13:23:56 +0200 Subject: [PATCH 099/176] Zoom Removed --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 31744 -> 31744 bytes CandlePanel.js | 1 - VolumePanel.js | 1 - 3 files changed, 2 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index ab22d4d832e34b890e63946f4c163e1835043a7f..0f9b4c4df247e8a98763311db8db75f98c9b9ddf 100644 GIT binary patch delta 949 zcmd^7O=}ZT6rJ~GCYi)Erb$`@rpY9hkj7M!s#q6oCr0cjQj&$5wh=}WyReECT99rG zD1Oj|wg+67;8GMb#YJ(^Qg9<^#g)4(+$p$eCAw(56O!V8@WGk;?z!i@d*|^g4OVHe zXQ@6ew3kN^9JICay=Jp%u_E$i-y7qH%%X_!uzT*;`uA&Jzpy^4Riaqr=aKDAvodyV zP1`h)evUu(Q5M6d;=@HHe)Z?LGV#c6yBnHW(hy z1KHO{SNV0{5>NNEEHi zP-aAcpc2ul)s$76t;f}RdcGJh@nARENxkqXan89 zcq~caIX<*^1IUMS)=K=BJ<~v-Vg7RIt@)diMk)#z@xiI_Tf8y3tp~>i3%vD5>(b;R zxkRoZlqqtVTqS87lVlnmoU>5_G$qzV9VWg2XCgp1AZTCtN5&CLV5fh!>7ck^O8M5; z#+K*cyS=rl8VeXuXfS6#T{T0daZHjcBn`V~nnke?q3*!Fv%QdZ$02KyY*Ab+CXupt zET>W+Q6TwOKIY$yYs;$57RePFU?0d_dac*7zwy}z|IBP Date: Mon, 30 Apr 2018 10:09:31 +0200 Subject: [PATCH 100/176] Any Number of DataSets per Plotter --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 31744 -> 31744 bytes Candles.js | 4 ++-- Volumes.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 0f9b4c4df247e8a98763311db8db75f98c9b9ddf..0313fa06217e092966ff594768cb5f100acb3eaa 100644 GIT binary patch delta 1215 zcmcIiO-vI}5Z<@lUDmS2LQAQ-v<0g{Em#l@D#j8jtqExhCQU(&!T%rp!x9r?LPNw5 z;Q*bpMtbI;eThF8K+}VXF>p39X*hY+NJ0<(%+#(xj7KN=cIJI=zc(}QO=^{;R@qcL zlb;{iEJC;9QJ#9o?#A>l4bK_kW$h`k6uq75Z_b~1>e`eYG2MoM+>yC@aUqW0) zTtQq#Ttf^Zt|M+BZbD;4C}S71T99c}gK>q_2qY~r$%SOv?bE0R42zc5lI%PTYa{F& ztZ31{gzPK~TP89NFtVGPw~SOgsZX*E zA{rQDw#){h#Si|F7@AonrwQCrSOsgR9j;=7vV5XP|8Giukj&0|&p~ox}P~djN2d_?r zY;Hq?ejj2#&R<8@I4pH4kcz6sbRQxv2BR()bq+IU4%%YEfRI?E8Kx1tgI@+S{$@zU z15AcD@p%|H?u3t>4Ls0w-}H|h%_s@*KxBczGYaAhCg^oP0&~Ivx%d>_3nrAHHt{;s L$H3E<|DX5;TU?W= delta 1471 zcmchXUu;uV9LMiDyOzx(Z{AKBxIqAYKxCBBcYdlT$qy2mTN zIRtqN9uODUC_H00A5CwzgCcDP9ndsq8$5$1w8K0pAa?ayidS;Ouf)8z3tMhUBXg%vw^G0N?PS};|i>3R0VaimOv zm%%hR0ZxKbAPZ)|E8sLmbYu5xu;#%6u)rdC9lQa~fH%PsI1BRNEpQH;2g|f!jJlaz zPxCy&HeVtvrXOW{?f%A186dUbNxQcAoyso6=T7G=YkEFDm76`0JsF=_$j#>SXLp&Yfv5XYgRyiX)fd}on!94DUScs6 z%#!*6 z-|QT6_tMpl0nE!NHF4P~7f_3OriW-|vcy^uCo-qEurjg-=`(YN!c%MiJDL80zX2i@ B#^eA1 diff --git a/Candles.js b/Candles.js index 52ebb6905..af40ef873 100644 --- a/Candles.js +++ b/Candles.js @@ -48,8 +48,8 @@ /* Store the information received. */ - fileCache = pStorage.fileCache; - fileCursorCache = pStorage.fileCursorCache; + fileCache = pStorage.fileCache[0]; + fileCursorCache = pStorage.fileCursorCache[0]; datetime = pDatetime; timePeriod = pTimePeriod; diff --git a/Volumes.js b/Volumes.js index 413dd2708..7fa151653 100644 --- a/Volumes.js +++ b/Volumes.js @@ -46,8 +46,8 @@ /* Store the information received. */ - fileCache = pStorage.fileCache; - fileCursorCache = pStorage.fileCursorCache; + fileCache = pStorage.fileCache[0]; + fileCursorCache = pStorage.fileCursorCache[0]; datetime = pDatetime; timePeriod = pTimePeriod; From d880b21bf5bbc95fb17159362d5b914c05adbeba Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Apr 2018 10:21:19 +0200 Subject: [PATCH 101/176] Refactoring --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 31744 -> 31744 bytes Candles.js | 10 +++++----- Volumes.js | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 0313fa06217e092966ff594768cb5f100acb3eaa..40ebb8cacb6c7dd49f4d9f1269d3bfbe42d407be 100644 GIT binary patch delta 383 zcmZqp!PxMFae{#?0}Kc-Ft7pHOhEka|Ns9WVaCY^S>!h+OkteFl*8Ka%lvHg=0dh` z#!2!ztf@fheUpDOD>F(06$wu^U=dLj0*XliF;Mq^kP*m01Srk}#1fM;S;7U4p{hVC zOn_`Fpc&$uUvNk;Zeok!oE*cuWRgJ1<`SU*Mi!7ppoN>i2!?QM_7K^@xJl*&JBJ+9 zfXRaLDwDs6hj0iZ32ZJ=>0{i?q`}9uSwQ0h<02ELMLKMg^jvtDfr{jj6izPDyTYM> zBB0;1NQP;WhQMY4g%6CIEbfXt+Y%15A?(<8(Ibgk53YcCzEld!i#>cAoLQxPQBG@P_YoqwM z2dpeKHWn6|u}W>P{s3X?Ekz+ViD%rv=D;^+zHh!W-^_jn_A_wmuaTvE>5`<;R`6^t zmlLXjFKYSy`~_I@hIZ-wy)%wm@-JAz5BbSKo}7nFqNA(Mt4$Lz@Kb4k5}I?PUo{#l zNOR;(RrxLkL>a_IQYEgb6VM~F&gPl3m*fDUkI>KS?QTffW{T14&~d|A;anhjksv0s zXQP{zo`5Ob*7sl%KWL5PwkxXElEbQN}=hZr7C zAjcexCiuO+zx Q$yI}UR{p^Ef_DM)3zCSgH~;_u diff --git a/Candles.js b/Candles.js index af40ef873..8dac50c49 100644 --- a/Candles.js +++ b/Candles.js @@ -35,7 +35,7 @@ let marketFile; // This is the current Market File being plotted. let fileCursor; // This is the current File Cursor being used to retrieve Daily Files. - let fileCache; // This object will provide the different Market Files at different Time Periods. + let marketFiles; // This object will provide the different Market Files at different Time Periods. let fileCursorCache; // This object will provide the different File Cursors at different Time Periods. /* these are module specific variables: */ @@ -48,7 +48,7 @@ /* Store the information received. */ - fileCache = pStorage.fileCache[0]; + marketFiles = pStorage.marketFiles[0]; fileCursorCache = pStorage.fileCursorCache[0]; datetime = pDatetime; @@ -56,13 +56,13 @@ /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ - marketFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. + marketFile = marketFiles.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. recalculateScale(); /* Now we set the right files according to current Period. */ - marketFile = fileCache.getFile(pTimePeriod); + marketFile = marketFiles.getFile(pTimePeriod); fileCursor = fileCursorCache.getFileCursor(pTimePeriod); /* Listen to the necesary events. */ @@ -105,7 +105,7 @@ if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - let newMarketFile = fileCache.getFile(pTimePeriod); + let newMarketFile = marketFiles.getFile(pTimePeriod); if (newMarketFile !== undefined) { diff --git a/Volumes.js b/Volumes.js index 7fa151653..3ffbd6399 100644 --- a/Volumes.js +++ b/Volumes.js @@ -31,7 +31,7 @@ let marketFile; // This is the current Market File being plotted. let fileCursor; // This is the current File Cursor being used to retrieve Daily Files. - let fileCache; // This object will provide the different Market Files at different Time Periods. + let marketFiles; // This object will provide the different Market Files at different Time Periods. let fileCursorCache; // This object will provide the different File Cursors at different Time Periods. let scaleFile; // This file is used to calculate the scale. @@ -46,7 +46,7 @@ /* Store the information received. */ - fileCache = pStorage.fileCache[0]; + marketFiles = pStorage.marketFiles[0]; fileCursorCache = pStorage.fileCursorCache[0]; datetime = pDatetime; @@ -54,11 +54,11 @@ /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ - scaleFile = fileCache.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. + scaleFile = marketFiles.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. /* Now we set the right files according to current Period. */ - marketFile = fileCache.getFile(pTimePeriod); + marketFile = marketFiles.getFile(pTimePeriod); fileCursor = fileCursorCache.getFileCursor(pTimePeriod); /* Listen to the necesary events. */ @@ -103,7 +103,7 @@ if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - let newMarketFile = fileCache.getFile(pTimePeriod); + let newMarketFile = marketFiles.getFile(pTimePeriod); if (newMarketFile !== undefined) { From 041d453baabebe9e6ad81841bd32cef9b733d517 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Apr 2018 10:29:47 +0200 Subject: [PATCH 102/176] Refactoring --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 31744 -> 31744 bytes Candles.js | 8 ++++---- Volumes.js | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 40ebb8cacb6c7dd49f4d9f1269d3bfbe42d407be..ef6152596acc2c44abda78838f76b6f3c4a9112d 100644 GIT binary patch delta 222 zcmZqp!PxMFae{#?69W_oFfgzJnIQhZ|NsAkM42aFWD(z(Fo$syQw|Gjz#Bu+*v*AZ z{fv`16eLA~@?1d74aB@a4Ak;p3`na@R^$?%?8Cvq$_eBNZ;s^1=AV2-xrKurs%WyH zyvpVhi9Y7dOltoa7s)X#(qdYq#J0!?#MoqVgn9B2K?7C~plXiIKlRs0h{*z(FrWlv h2m!InuE~yW-J9J!ZF$+WVf@y~{{C#6MZ({x008c0I2`~0 delta 273 zcmZqp!PxMFae{#?0}Kc-Ft7pHOhEka|Ns9WVaCZ9S;RLc%wgQbl*7V$L3Gmgu+4=` z;fx##KuMsQ|C0k1R3?96*HPdF3UC22HxLU$B{_k#8W4*C@ni=M5mu0~qMIW*viW&L zfMRk$j4(tzghK*JU~`E?AM<7=oqvprj&9wX-8^l1H#aBLGB1i!0stc^R4f1h diff --git a/Candles.js b/Candles.js index 8dac50c49..fea47bd56 100644 --- a/Candles.js +++ b/Candles.js @@ -36,7 +36,7 @@ let fileCursor; // This is the current File Cursor being used to retrieve Daily Files. let marketFiles; // This object will provide the different Market Files at different Time Periods. - let fileCursorCache; // This object will provide the different File Cursors at different Time Periods. + let dailyFiles; // This object will provide the different File Cursors at different Time Periods. /* these are module specific variables: */ @@ -49,7 +49,7 @@ /* Store the information received. */ marketFiles = pStorage.marketFiles[0]; - fileCursorCache = pStorage.fileCursorCache[0]; + dailyFiles = pStorage.dailyFiles[0]; datetime = pDatetime; timePeriod = pTimePeriod; @@ -63,7 +63,7 @@ /* Now we set the right files according to current Period. */ marketFile = marketFiles.getFile(pTimePeriod); - fileCursor = fileCursorCache.getFileCursor(pTimePeriod); + fileCursor = dailyFiles.getFileCursor(pTimePeriod); /* Listen to the necesary events. */ @@ -115,7 +115,7 @@ } else { - let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); + let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); if (newFileCursor !== undefined) { diff --git a/Volumes.js b/Volumes.js index 3ffbd6399..02f70b472 100644 --- a/Volumes.js +++ b/Volumes.js @@ -32,7 +32,7 @@ let fileCursor; // This is the current File Cursor being used to retrieve Daily Files. let marketFiles; // This object will provide the different Market Files at different Time Periods. - let fileCursorCache; // This object will provide the different File Cursors at different Time Periods. + let dailyFiles; // This object will provide the different File Cursors at different Time Periods. let scaleFile; // This file is used to calculate the scale. @@ -47,7 +47,7 @@ /* Store the information received. */ marketFiles = pStorage.marketFiles[0]; - fileCursorCache = pStorage.fileCursorCache[0]; + dailyFiles = pStorage.dailyFiles[0]; datetime = pDatetime; timePeriod = pTimePeriod; @@ -59,7 +59,7 @@ /* Now we set the right files according to current Period. */ marketFile = marketFiles.getFile(pTimePeriod); - fileCursor = fileCursorCache.getFileCursor(pTimePeriod); + fileCursor = dailyFiles.getFileCursor(pTimePeriod); /* Listen to the necesary events. */ @@ -113,7 +113,7 @@ } else { - let newFileCursor = fileCursorCache.getFileCursor(pTimePeriod); + let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); if (newFileCursor !== undefined) { From 6dfe4adf33f6374e060562345879af6f1fe1a8a2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 9 May 2018 08:54:06 +0200 Subject: [PATCH 103/176] Scale Adjusted --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 31744 -> 31744 bytes Candles.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index ef6152596acc2c44abda78838f76b6f3c4a9112d..638d63e55c1829ae143304b48ce96af3ca6bb16d 100644 GIT binary patch delta 1170 zcmb7DPe>F|7@zO$>^9XXyE*Eb>+TAY3tFz*#X@Y&Wm)>;B9&1@SO=jfFdd?9TU2zA z(D{fi9b%{sMThov@(`919SS$P1Y)-!$b-ZR+QIGnY(^F=mfrAVzV~~-_r2fu=9}CK z1!1jJDlrZCNv(f5^bjoHWv@DXJ@5@j#Z54AS$x)Zk$`k19Ei4H z(GxpG3DybTty8>%u$8di;aObc#P#&vUdHpycv58^9US>CF(W$<^99(6&(MruWv-M8(zCtY(zaXvVUD(j#$WRR^g1uFWMiRFx)=M*6?tv8T zYfx4}qScDDmlcs}?zVz`n>V8woU2m!`*I_>=p8#Q>@HzNk}}yp4f&o0z(Tl|9RMK{ zSNO5JMaApNA6oG6R{8V5R}W^h2^6V2Sm;a0sZ<*B$pVvcEB%hw31HS=){-a9( delta 999 zcmah|O=uHQ5YD{p#@KFaVmE1RQ`6R>)ueTs#8`^p)@vsN+BIv$bMTkEX4+=SYDGGY%p$LLP^pH5y?xv|fIPft)Z@!stUtaQM$d_SW z>tr6s0v?ZyA?1~7wMtbleM}CFfgv;W)uMtcs!lxzmFcLjT zs17(jh<+=g-N|WMy{TAN5N*zRFZu{>>frN|+8=kS#OTMk8L=0kA(9ApQVQc?WVMQA z=@$5MD}$jk>*`{#ErbmXh(<&cf{0=CJ9&3Q%lR!%Wi$E~M2C~R^ZX&pCOWec4>4pef`FR zPxlw)FE3}XyQbJufj>%R%^^R38%psfweY`7Nn+j7IS?#1Lh4HV#CThfB{ zRKO0u0vX&3Pz+?#SCLsMX0{vt-v-jI8jn7nu4*GM&5&vxVD|75@KRD0Uo#)PTtDXH zb4Hvq;|?z!O^Ah@!rY=Lk3Ray;FJw*#$l_c2}rpSC~1rxM5|O{voc>!|Fq<_TT3EL=kuDLZ3{sKj!Xp c`&Q>l))eF8$yqUb;Tl*|LHsFmHE1mG3o7wWq5uE@ diff --git a/Candles.js b/Candles.js index fea47bd56..54f25b770 100644 --- a/Candles.js +++ b/Candles.js @@ -388,7 +388,7 @@ let maxValue = { x: MAX_PLOTABLE_DATE.valueOf(), - y: nextPorwerOf10(getMaxRate()) + y: nextPorwerOf10(getMaxRate()) / 4 // TODO: This 4 is temporary }; From ac20c6fd997fcd8f6c64f4a5a091b3e9cdb776c4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 11 May 2018 16:24:25 +0200 Subject: [PATCH 104/176] Code Cleaning --- .vs/Plotters-Candles-Volumes/v15/.suo | Bin 31744 -> 31744 bytes Volumes.js | 4 ---- .../Project.njsproj.CoreCompileInputs.cache | 1 + .../Project.njsproj.FileListAbsolute.txt | 3 +++ ...ject.njsprojResolveAssemblyReference.cache | Bin 0 -> 2216 bytes 5 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 obj/Debug/Project.njsproj.CoreCompileInputs.cache create mode 100644 obj/Debug/Project.njsproj.FileListAbsolute.txt create mode 100644 obj/Debug/Project.njsprojResolveAssemblyReference.cache diff --git a/.vs/Plotters-Candles-Volumes/v15/.suo b/.vs/Plotters-Candles-Volumes/v15/.suo index 638d63e55c1829ae143304b48ce96af3ca6bb16d..2501df1e83ca7d26e53537c9861936c37473df16 100644 GIT binary patch delta 1016 zcmaJYBA9rvzQ5h2i%&3=e|C0u$a_G3&?4`y6?jS9bydH={&BLdmR#$+r1?EPh(l(M5gBR?B)j10 zw!FPq4*^Gj4!{TW0e)ZrI0_6Qd$%lV?a5YH#{oMZt)rGbhIQhf*lF6S>e>_TD!yz> zoTpp8<;gb4+(6utd$6J^)&g__hXE?h9$usgUk<=ao*>o`FbIT!VZc^K9h`hI*mUWH zXas% zff)~{lk7HAOy!616oYAZ5E?3o1iOL30RCh#)g1l8wFoGku2U-(R5SdH zM;6#^cAw3$n{0{Yz;i4Qeve(poCY4UBpYKf84|rbDyMqRm4Yb`r+d=l?Hw7!k;kZ> z*k)-UYf#JVpv)(>4SM!H$7s#GwbQBc@oix^3zYf3g4vaR?6u#;*_F_YZoZA#(Y#f( z&Z&Xqa+{^Ypi!RC%G08JR+Q5MyfR(W<>W<|T+c=;nHslvT#D?ftX&va8`%smWuNcz zIk&I{sxkkD`_Ay)tTbo9>8GSOEjO0%E#*Uv*wzs0G)lJh-qq+A83Pi0Eh tROi)2{@?gwvBmp4_t^h_Ez_-}^b={AhHc(S>H=m=u~O zNiuSR_|fn8MHtwMGVyA&2{zf1YxKrF{VTsiu7Wa!Nv!EJ-I!#Z$n-UA_5-3*MLvue zLM#MvQJe_)D6WV1#6|89`eTTrhzw#DF^Nc{f-%;l+VMPkDTJsF?M&boaE%MCPc|w4 zMjwE@m|pY6$}eFx)OG}`gs!k#54g}JbpMww>|q{F{gbrpZ)wUGh3zJa&Mj5MsqGM-6l+>*bf!2(sj!6fGr@@J5!2F3eF23PUzs~lm&LSOeZj5 zkDlUY)&eI*1{7y3aHsL4rI8&sDc1ZBYh*O8^A%@*yH6~1K3-w5RKywb>16^ z5$7y*>cm-~2b{(|@5R{im3c<051F?#&s)_BxD_vg!Gc|TCvv=7Q^2l1`jx+^k|6j3 z3~{lc<&cQaQf{$xwa2V-xn*B^zE1_m3gTYBOAPTDL#rYY-`bzDjXTLaxxN7h)@(F~ O20q$n7?iqQ)PDkA5>n6r diff --git a/Volumes.js b/Volumes.js index 02f70b472..690a33f0a 100644 --- a/Volumes.js +++ b/Volumes.js @@ -172,8 +172,6 @@ if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let daysOnSides = getSideDays(timePeriod); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); @@ -249,8 +247,6 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. - let daysOnSides = getSideDays(timePeriod); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); diff --git a/obj/Debug/Project.njsproj.CoreCompileInputs.cache b/obj/Debug/Project.njsproj.CoreCompileInputs.cache new file mode 100644 index 000000000..7051628d8 --- /dev/null +++ b/obj/Debug/Project.njsproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +b2d1f68f52ed4f8e597893c5baf038976a006d3a diff --git a/obj/Debug/Project.njsproj.FileListAbsolute.txt b/obj/Debug/Project.njsproj.FileListAbsolute.txt new file mode 100644 index 000000000..9681407f7 --- /dev/null +++ b/obj/Debug/Project.njsproj.FileListAbsolute.txt @@ -0,0 +1,3 @@ +C:\Users\Luis\source\repos\Plotters\AAMasters\Plotters-Candles-Volumes\obj\Debug\Project.njsprojResolveAssemblyReference.cache +C:\Users\Luis\source\repos\Plotters\AAMasters\Plotters-Candles-Volumes\obj\Debug\Project.njsproj.CoreCompileInputs.cache +C:\Users\Luis\source\repos\Plotters\AAMasters\Plotters-Candles-Volumes\bin\Microsoft.NodejsTools.WebRole.dll diff --git a/obj/Debug/Project.njsprojResolveAssemblyReference.cache b/obj/Debug/Project.njsprojResolveAssemblyReference.cache new file mode 100644 index 0000000000000000000000000000000000000000..67d5be9b7a12b38e6fe524eedeba2ea6a1a31246 GIT binary patch literal 2216 zcmb_d+iu%N5T)*RdTpA)&tW2&Cd7K4^8EmeX{a^_^}K>O{gp42hO3tnZvAqmX;w!0b$% zLwqo5wu4Tv8?;(}r^(u^M8-b7-o{|2G(-cA|0w}SaS=4l}-Sv+P}L{la~Zj;ik@ZnU73+{t7>BoTo2t|xY zl^?M%0c9A4f>A1MnAh3r&vo6t#^?SO{ja{i_ay~et&;Orkwgi_HqB_ETt;!w-5);g zpM3S*tN7z& z1%zec5=J+x+udE(@j9Qk_S$!$d2g>ow%*8Fg005XY9uC811)(xwz(ScXc_`RaeKlP z)|&@P33({J3D;QT*i`+vmr&fa$>LFzq~&f)h}d)reou<1Kxr+0lEwNEf~-B(0L2ySaRO}Wl?GcxSQfv{Ynk^4-6>1GX3bE*3e!?BQDPoj_3KYK!UMXaR= zKXkE3L_8*Q$U3Kt%Ug3DDYmgjSoijga%qms{?wJh_Q7o9~R z!~q{Ck`bHE%LQ9_KAo*O`*x>3yIPl5Li^&T{$&2IA#ja>)qYFi$(J`Vdm9Tg6092K z{U;RVEfhy|&+IoEjqZLUBiY8XvXNvP3zBUtS*Ed~kVw|rMpebX@H%}vtf-MI7j(b4 zu3;8`M#g@P%19xuV441jvv&e(-9kznuTbYrFkC Date: Sat, 12 May 2018 18:25:33 +0200 Subject: [PATCH 105/176] Cleaning --- .gitignore | 10 ++++++++++ .vs/AAOlivia-Plotter/v15/.suo | Bin 19968 -> 0 bytes .vs/Plotters-Candles-Volumes/v15/.suo | Bin 31744 -> 0 bytes bin/Microsoft.NodejsTools.WebRole.dll | Bin 32992 -> 0 bytes ...ivia-Plotter.njsproj.CoreCompileInputs.cache | 1 - ...AOlivia-Plotter.njsproj.FileListAbsolute.txt | 3 --- ...lotter.njsprojResolveAssemblyReference.cache | Bin 2216 -> 0 bytes .../Project.njsproj.CoreCompileInputs.cache | 1 - obj/Debug/Project.njsproj.FileListAbsolute.txt | 3 --- ...roject.njsprojResolveAssemblyReference.cache | Bin 2216 -> 0 bytes 10 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 .gitignore delete mode 100644 .vs/AAOlivia-Plotter/v15/.suo delete mode 100644 .vs/Plotters-Candles-Volumes/v15/.suo delete mode 100644 bin/Microsoft.NodejsTools.WebRole.dll delete mode 100644 obj/Debug/AAOlivia-Plotter.njsproj.CoreCompileInputs.cache delete mode 100644 obj/Debug/AAOlivia-Plotter.njsproj.FileListAbsolute.txt delete mode 100644 obj/Debug/AAOlivia-Plotter.njsprojResolveAssemblyReference.cache delete mode 100644 obj/Debug/Project.njsproj.CoreCompileInputs.cache delete mode 100644 obj/Debug/Project.njsproj.FileListAbsolute.txt delete mode 100644 obj/Debug/Project.njsprojResolveAssemblyReference.cache diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..ee165f325 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ + +.vs/* +.obj/* + +.bin/* + +*.config +*.log +*.cache +node_modules/* \ No newline at end of file diff --git a/.vs/AAOlivia-Plotter/v15/.suo b/.vs/AAOlivia-Plotter/v15/.suo deleted file mode 100644 index 75a627a985faa7bb108280eb66de60f896171704..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19968 zcmeHOZ)_Y#6`ymPkOWEzg|w8Ax@ib$@Llfg^Vw^ssn2&YZRIFdV!H^A4;SCrv2*cR zcea}lTYx}_4}9ylB7`axwWz8@QTPxckl+I#z7#1RkccV;P(hVYq(~rv1Tnwg%+B51 z`gU*cPvR8soMv}+c4pq}oA=(ldGFot-`RWf)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T|MiV)x{)yoT6#n^3KtA5J(MfxE0)$T>3qXf@J1-D7SvQ8 z71UHg%mA@)q&qyCN$GhbKUWA%XN;nnoh%g7nS3a5y{K!U3C+kC^^`WM=G1vj4~?s- zD@bf=YU%GY+ZXQdJD*!tF<<2h<9dEMlh*WS)kO{Y;o3dIq5oPsxzC*D#^#>UR;JZ# zQ5%~x3VJ3tujW>!R+h9nbXY8P_g2lHbp^JnV5{vHdc;lZlyy@12`j}0F(qPWIrDgu z`!c?<;F%&tIb(il!0$1*3z{&?GuY+OFaylN@5UPUn7i3!&&Vq3iJgXxw4!wRhnf#7WC; zl*Exr;2JmcBFG&y?>q2J95s@->rvLQQ=7&~iAucIsUas;YRJkuqHWeZZS|Ud)a`8B zX|&Ppjkk(_T_;YAC{JBuNQU>kr@lGu3EqHkPpe%CmKOhHsoIKVhZF{Y;72SCia4926;XmBu=7>-7h-N|^|AOD>_{)x5b z;9HxIrTI3o_Uk5+w{bP6Wm~T8q`5!-+o5k;cl@)O*S6C_r+LnhdAd2Yhu2vzv9?=D zwrbPc%DsJV+pUJ}f8$A2JJqdr%|?P+N31g#JJr(@jCZByf}NT=*Ab6tT1Qtrgq_5$ zSl6n>R^{sBg zXA9|B9RM_mGY?%<5Dldr|0=~@tSC-*@Y*Qw|FeG7WTzKvZTnfLpI&RSmOB5f zilfQ@TF8Rx)@YK0nvJ&378|9O@)T^d(bmZY8)+*f#g~6y{_ots^*N?{fIO z;Ta}5`EP|I%kLX69)A7nk3IOGZ(RTKtDzW=kyd>3x)uNB^XGnlB=Gv92R8fvmuyQb w2Y>u`_V~9l@A_@`Dd1DUr+`lZp8`Gwd`93e})Fu;{X5v diff --git a/bin/Microsoft.NodejsTools.WebRole.dll b/bin/Microsoft.NodejsTools.WebRole.dll deleted file mode 100644 index 03b93f4a1c5dfb1659630bf8ea0ad76d2a599ed4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32992 zcmeIb2Ut@}(>T5-2}uY=I*1?v6p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cP!z#yK@3$I<6MTeuk%N>@~w zRnIkq*K9|C#g$nE+<8fFb~)6p8u|Em&}mPK?Wr! zG9vCQGPK(Ebkd0-S|x!KjhJG!4c@!gt?am|&*LVOl3m9)8mC3%W-q%s{{5luF*c`e zsoGfW+PWpB^XT=d58ss)AFxt6*)Ukgpx@I)`9nirUf+Lz{s7-TWv;0Xv$~j#)0M={@N9B8Hsjmjx5JDQuRf_bx;cE&yJg=l+V^rL x+q|;yb^kiO>i#YDI~A&BCPQ=|G1sr4)edTm$samLW9)U+@hk6`)(u~e{vQLgHC+Gz diff --git a/obj/Debug/AAOlivia-Plotter.njsproj.CoreCompileInputs.cache b/obj/Debug/AAOlivia-Plotter.njsproj.CoreCompileInputs.cache deleted file mode 100644 index 78474ee71..000000000 --- a/obj/Debug/AAOlivia-Plotter.njsproj.CoreCompileInputs.cache +++ /dev/null @@ -1 +0,0 @@ -573924208ee1de43c28a684e3ad9af2dcef5974d diff --git a/obj/Debug/AAOlivia-Plotter.njsproj.FileListAbsolute.txt b/obj/Debug/AAOlivia-Plotter.njsproj.FileListAbsolute.txt deleted file mode 100644 index 4c3907976..000000000 --- a/obj/Debug/AAOlivia-Plotter.njsproj.FileListAbsolute.txt +++ /dev/null @@ -1,3 +0,0 @@ -C:\Users\Luis\source\repos\AAOlivia-Plotter\obj\Debug\AAOlivia-Plotter.njsprojResolveAssemblyReference.cache -C:\Users\Luis\source\repos\AAOlivia-Plotter\obj\Debug\AAOlivia-Plotter.njsproj.CoreCompileInputs.cache -C:\Users\Luis\source\repos\AAOlivia-Plotter\bin\Microsoft.NodejsTools.WebRole.dll diff --git a/obj/Debug/AAOlivia-Plotter.njsprojResolveAssemblyReference.cache b/obj/Debug/AAOlivia-Plotter.njsprojResolveAssemblyReference.cache deleted file mode 100644 index 67d5be9b7a12b38e6fe524eedeba2ea6a1a31246..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2216 zcmb_d+iu%N5T)*RdTpA)&tW2&Cd7K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ms{?wJh_Q7o9~R z!~q{Ck`bHE%LQ9_KAo*O`*x>3yIPl5Li^&T{$&2IA#ja>)qYFi$(J`Vdm9Tg6092K z{U;RVEfhy|&+IoEjqZLUBiY8XvXNvP3zBUtS*Ed~kVw|rMpebX@H%}vtf-MI7j(b4 zu3;8`M#g@P%19xuV441jvv&e(-9kznuTbYrFkC Date: Tue, 15 May 2018 08:47:02 +0200 Subject: [PATCH 106/176] gitignore updated --- .gitignore | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ee165f325..82c487bdd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,11 @@ .vs/* -.obj/* +obj/* -.bin/* +bin/* *.config *.log *.cache -node_modules/* \ No newline at end of file +node_modules/* + From 40d5fab228ec324afb1267911e7a8c25c4616f46 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 15 May 2018 21:50:40 +0200 Subject: [PATCH 107/176] Automatic Updates when files changes --- Candles.js | 13 +++++++++++++ Volumes.js | 17 +++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Candles.js b/Candles.js index 54f25b770..dce82fef6 100644 --- a/Candles.js +++ b/Candles.js @@ -69,6 +69,7 @@ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); /* Get ready for plotting. */ @@ -97,6 +98,18 @@ } + function onFilesUpdated() { + + let newMarketFile = marketFiles.getFile(timePeriod); + + if (newMarketFile !== undefined) { + + marketFile = newMarketFile; + recalculate(); + } + + } + function setTimePeriod(pTimePeriod) { if (timePeriod !== pTimePeriod) { diff --git a/Volumes.js b/Volumes.js index 690a33f0a..d5e0da85b 100644 --- a/Volumes.js +++ b/Volumes.js @@ -65,6 +65,7 @@ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); /* Get ready for plotting. */ @@ -95,6 +96,22 @@ } + function onFilesUpdated() { + + let newMarketFile = marketFiles.getFile(timePeriod); + + if (newMarketFile !== undefined) { + + marketFile = newMarketFile; + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } + + } + function setTimePeriod(pTimePeriod) { if (timePeriod !== pTimePeriod) { From e98c06b56925a7c783772e470aacbd3b6b01ea62 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 16 May 2018 17:09:52 +0200 Subject: [PATCH 108/176] Volume Scale corrected --- Volumes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Volumes.js b/Volumes.js index d5e0da85b..a8705e57d 100644 --- a/Volumes.js +++ b/Volumes.js @@ -341,7 +341,7 @@ let timePeriodRatio = ONE_DAY_IN_MILISECONDS / timePeriod; - maxValue.y = getMaxVolume() / (timePeriodRatio / 10); + maxValue.y = getMaxVolume() / (timePeriodRatio / 2.5); timeLineCoordinateSystem.initializeY( minValue, From 7a12764c300924eb7d76ce529649bb24fb47a92c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 19 May 2018 19:58:25 +0200 Subject: [PATCH 109/176] Cleaning --- Candles.js | 2 +- Volumes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Candles.js b/Candles.js index dce82fef6..e42629027 100644 --- a/Candles.js +++ b/Candles.js @@ -68,8 +68,8 @@ /* Listen to the necesary events. */ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); /* Get ready for plotting. */ diff --git a/Volumes.js b/Volumes.js index a8705e57d..9b6faf512 100644 --- a/Volumes.js +++ b/Volumes.js @@ -64,8 +64,8 @@ /* Listen to the necesary events. */ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); /* Get ready for plotting. */ From baf670fc497dfb2d92ef547186a093d3ed797773 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 19 May 2018 20:31:06 +0200 Subject: [PATCH 110/176] Fast Forward Bug Fix --- Candles.js | 10 ++++++++++ Volumes.js | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Candles.js b/Candles.js index e42629027..020bd3faf 100644 --- a/Candles.js +++ b/Candles.js @@ -68,6 +68,7 @@ /* Listen to the necesary events. */ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); @@ -621,6 +622,15 @@ } + function onOffsetChanged() { + + if (Math.random() * 100 > 95) { + + recalculate() + }; + + } + function onDragFinished() { recalculate(); diff --git a/Volumes.js b/Volumes.js index 9b6faf512..0fb840edd 100644 --- a/Volumes.js +++ b/Volumes.js @@ -64,6 +64,7 @@ /* Listen to the necesary events. */ viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); @@ -686,6 +687,17 @@ } + function onOffsetChanged() { + + if (Math.random() * 100 > 95) { + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + }; + } + function onDragFinished() { recalculateScaleX(); From 217a673ff91201cf84331142f40b68287879bf63 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 May 2018 13:29:10 +0200 Subject: [PATCH 111/176] Error Handling and Logging improved --- Candles.js | 835 +++++++++++++++++++++++++++-------------------- Volumes.js | 924 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 1016 insertions(+), 743 deletions(-) diff --git a/Candles.js b/Candles.js index 020bd3faf..0b9393412 100644 --- a/Candles.js +++ b/Candles.js @@ -1,5 +1,12 @@ function newAAMastersPlottersCandlesVolumesCandles() { + const MODULE_NAME = "Candles Plotter"; + const INFO_LOG = false; + const ERROR_LOG = true; + const INTENSIVE_LOG = false; + const logger = newWebDebugLog(); + logger.fileName = MODULE_NAME; + let thisObject = { // Main functions and properties. @@ -46,595 +53,725 @@ function initialize(pStorage, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { - /* Store the information received. */ + try { - marketFiles = pStorage.marketFiles[0]; - dailyFiles = pStorage.dailyFiles[0]; + if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } - datetime = pDatetime; - timePeriod = pTimePeriod; + /* Store the information received. */ - /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ + marketFiles = pStorage.marketFiles[0]; + dailyFiles = pStorage.dailyFiles[0]; - marketFile = marketFiles.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. + datetime = pDatetime; + timePeriod = pTimePeriod; - recalculateScale(); + /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ - /* Now we set the right files according to current Period. */ + marketFile = marketFiles.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. - marketFile = marketFiles.getFile(pTimePeriod); - fileCursor = dailyFiles.getFileCursor(pTimePeriod); + recalculateScale(); - /* Listen to the necesary events. */ + /* Now we set the right files according to current Period. */ - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); - marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + marketFile = marketFiles.getFile(pTimePeriod); + fileCursor = dailyFiles.getFileCursor(pTimePeriod); - /* Get ready for plotting. */ + /* Listen to the necesary events. */ - recalculate(); + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); + marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - callBackFunction(); + /* Get ready for plotting. */ + recalculate(); + + callBackFunction(); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> err.message = " + err.message); } + } } function getContainer(point) { - let container; + try { - /* First we check if this point is inside this space. */ + if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); } - if (this.container.frame.isThisPointHere(point) === true) { + let container; - return this.container; + /* First we check if this point is inside this space. */ - } else { + if (this.container.frame.isThisPointHere(point) === true) { - /* This point does not belong to this space. */ + return this.container; - return undefined; + } else { + + /* This point does not belong to this space. */ + + return undefined; + } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] getContainer -> err.message = " + err.message); } } - } function onFilesUpdated() { - let newMarketFile = marketFiles.getFile(timePeriod); + try { - if (newMarketFile !== undefined) { + if (INFO_LOG === true) { logger.write("[INFO] onFilesUpdated -> Entering function."); } - marketFile = newMarketFile; - recalculate(); + let newMarketFile = marketFiles.getFile(timePeriod); + + if (newMarketFile !== undefined) { + + marketFile = newMarketFile; + recalculate(); + } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onFilesUpdated -> err.message = " + err.message); } } - } function setTimePeriod(pTimePeriod) { - if (timePeriod !== pTimePeriod) { + try { - timePeriod = pTimePeriod; + if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); } - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + if (timePeriod !== pTimePeriod) { - let newMarketFile = marketFiles.getFile(pTimePeriod); + timePeriod = pTimePeriod; - if (newMarketFile !== undefined) { + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - marketFile = newMarketFile; - recalculate(); - } + let newMarketFile = marketFiles.getFile(pTimePeriod); - } else { + if (newMarketFile !== undefined) { - let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); + marketFile = newMarketFile; + recalculate(); + } - if (newFileCursor !== undefined) { + } else { - fileCursor = newFileCursor; - recalculate(); + let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); + + if (newFileCursor !== undefined) { + + fileCursor = newFileCursor; + recalculate(); + } } } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] setTimePeriod -> err.message = " + err.message); } } } function setDatetime(pDatetime) { + if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); } + datetime = pDatetime; } function positionAtDatetime(newDatetime) { - value = newDatetime.valueOf(); + try { - /* Now we calculate which candle has this new time, because it will give us the y coordinate. */ + if (INFO_LOG === true) { logger.write("[INFO] positionAtDatetime -> Entering function."); } - for (let i = 0; i < candles.length; i++) { + value = newDatetime.valueOf(); - if (value >= candles[i].begin && value <= candles[i].end) { + /* Now we calculate which candle has this new time, because it will give us the y coordinate. */ - let targetPoint = { - x: value, - y: candles[i].open - }; + for (let i = 0; i < candles.length; i++) { - targetPoint = timeLineCoordinateSystem.transformThisPoint(targetPoint); - targetPoint = transformThisPoint(targetPoint, thisObject.container); + if (value >= candles[i].begin && value <= candles[i].end) { - let targetMax = { - x: value, - y: candles[i].max - }; - - targetMax = timeLineCoordinateSystem.transformThisPoint(targetMax); - targetMax = transformThisPoint(targetMax, thisObject.container); - - let targetMin = { - x: value, - y: candles[i].min - }; - - targetMin = timeLineCoordinateSystem.transformThisPoint(targetMin); - targetMin = transformThisPoint(targetMin, thisObject.container); - - let center = { - x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2, - y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) / 2 - }; - - if (targetMax.y < viewPort.visibleArea.topLeft.y || targetMin.y > viewPort.visibleArea.bottomRight.y) { - - let displaceVector = { - x: 0, - y: center.y - targetPoint.y + let targetPoint = { + x: value, + y: candles[i].open }; - viewPort.displaceTarget(displaceVector); + targetPoint = timeLineCoordinateSystem.transformThisPoint(targetPoint); + targetPoint = transformThisPoint(targetPoint, thisObject.container); + let targetMax = { + x: value, + y: candles[i].max + }; + + targetMax = timeLineCoordinateSystem.transformThisPoint(targetMax); + targetMax = transformThisPoint(targetMax, thisObject.container); + + let targetMin = { + x: value, + y: candles[i].min + }; + + targetMin = timeLineCoordinateSystem.transformThisPoint(targetMin); + targetMin = transformThisPoint(targetMin, thisObject.container); + + let center = { + x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2, + y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) / 2 + }; + + if (targetMax.y < viewPort.visibleArea.topLeft.y || targetMin.y > viewPort.visibleArea.bottomRight.y) { + + let displaceVector = { + x: 0, + y: center.y - targetPoint.y + }; + + viewPort.displaceTarget(displaceVector); + + } + + let displaceVector = { + x: center.x - targetPoint.x, + y: 0 + }; + + viewPort.displace(displaceVector); + + return; } - - let displaceVector = { - x: center.x - targetPoint.x, - y: 0 - }; - - viewPort.displace(displaceVector); - - return; } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] positionAtDatetime -> err.message = " + err.message); } } } function onDailyFileLoaded(event) { - if (event.currentValue === event.totalValue) { + try { - /* This happens only when all of the files in the cursor have been loaded. */ + if (INFO_LOG === true) { logger.write("[INFO] onDailyFileLoaded -> Entering function."); } - recalculate(); + if (event.currentValue === event.totalValue) { + /* This happens only when all of the files in the cursor have been loaded. */ + + recalculate(); + + } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFileLoaded -> err.message = " + err.message); } } } function draw() { - this.container.frame.draw(); + try { - plotChart(); + if (INTENSIVE_LOG === true) { logger.write("[INFO] draw -> Entering function."); } + this.container.frame.draw(); + + plotChart(); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] draw -> err.message = " + err.message); } + } } function recalculate() { - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + try { - recalculateUsingMarketFiles(); + if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); } - } else { + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - recalculateUsingDailyFiles(); + recalculateUsingMarketFiles(); + } else { + + recalculateUsingDailyFiles(); + + } + + thisObject.container.eventHandler.raiseEvent("Candles Changed", candles); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] recalculate -> err.message = " + err.message); } } - - thisObject.container.eventHandler.raiseEvent("Candles Changed", candles); } function recalculateUsingDailyFiles() { - if (fileCursor === undefined) { return; } // We need to wait + try { - if (fileCursor.files.size === 0) { return;} // We need to wait until there are files in the cursor + if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingDailyFiles -> Entering function."); } - let daysOnSides = getSideDays(timePeriod); + if (fileCursor === undefined) { return; } // We need to wait - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); + if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let dateDiff = rightDate.valueOf() - leftDate.valueOf(); + let daysOnSides = getSideDays(timePeriod); - let farLeftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); - let farRightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); - let currentDate = new Date(farLeftDate.valueOf()); + let dateDiff = rightDate.valueOf() - leftDate.valueOf(); - candles = []; + let farLeftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); + let farRightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); - while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { + let currentDate = new Date(farLeftDate.valueOf()); - let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); + candles = []; - let dailyFile = fileCursor.files.get(stringDate); + while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { - if (dailyFile !== undefined) { + let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); - for (let i = 0; i < dailyFile.length; i++) { + let dailyFile = fileCursor.files.get(stringDate); - let candle = { - open: undefined, - close: undefined, - min: 10000000000000, - max: 0, - begin: undefined, - end: undefined, - direction: undefined - }; + if (dailyFile !== undefined) { - candle.min = dailyFile[i][0]; - candle.max = dailyFile[i][1]; + for (let i = 0; i < dailyFile.length; i++) { - candle.open = dailyFile[i][2]; - candle.close = dailyFile[i][3]; + let candle = { + open: undefined, + close: undefined, + min: 10000000000000, + max: 0, + begin: undefined, + end: undefined, + direction: undefined + }; - candle.begin = dailyFile[i][4]; - candle.end = dailyFile[i][5]; + candle.min = dailyFile[i][0]; + candle.max = dailyFile[i][1]; - if (candle.open > candle.close) { candle.direction = 'down'; } - if (candle.open < candle.close) { candle.direction = 'up'; } - if (candle.open === candle.close) { candle.direction = 'side'; } + candle.open = dailyFile[i][2]; + candle.close = dailyFile[i][3]; - if (candle.begin >= farLeftDate.valueOf() && candle.end <= farRightDate.valueOf()) { + candle.begin = dailyFile[i][4]; + candle.end = dailyFile[i][5]; - candles.push(candle); + if (candle.open > candle.close) { candle.direction = 'down'; } + if (candle.open < candle.close) { candle.direction = 'up'; } + if (candle.open === candle.close) { candle.direction = 'side'; } - if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { + if (candle.begin >= farLeftDate.valueOf() && candle.end <= farRightDate.valueOf()) { - thisObject.currentCandle = candle; - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); + candles.push(candle); + if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { + + thisObject.currentCandle = candle; + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); + + } } } } - } - - currentDate = new Date(currentDate.valueOf() + ONE_DAY_IN_MILISECONDS); - } - - /* Lests check if all the visible screen is going to be covered by candles. */ - - let lowerEnd = leftDate.valueOf(); - let upperEnd = rightDate.valueOf(); - - if (candles.length > 0) { - - if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { - - setTimeout(recalculate, 2000); - - //console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); + currentDate = new Date(currentDate.valueOf() + ONE_DAY_IN_MILISECONDS); } + + /* Lests check if all the visible screen is going to be covered by candles. */ + + let lowerEnd = leftDate.valueOf(); + let upperEnd = rightDate.valueOf(); + + if (candles.length > 0) { + + if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { + + setTimeout(recalculate, 2000); + + //console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); + + } + } + + //console.log("Olivia > recalculateUsingDailyFiles > total candles generated : " + candles.length); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingDailyFiles -> err.message = " + err.message); } } - - //console.log("Olivia > recalculateUsingDailyFiles > total candles generated : " + candles.length); - } function recalculateUsingMarketFiles() { - if (marketFile === undefined) { return; } // Initialization not complete yet. + try { - let daysOnSides = getSideDays(timePeriod); + if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingMarketFiles -> Entering function."); } - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); + if (marketFile === undefined) { return; } // Initialization not complete yet. - let dateDiff = rightDate.valueOf() - leftDate.valueOf(); + let daysOnSides = getSideDays(timePeriod); - leftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); - rightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); - candles = []; + let dateDiff = rightDate.valueOf() - leftDate.valueOf(); - for (let i = 0; i < marketFile.length; i++) { + leftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); + rightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); - let candle = { - open: undefined, - close: undefined, - min: 10000000000000, - max: 0, - begin: undefined, - end: undefined, - direction: undefined - }; + candles = []; - candle.min = marketFile[i][0]; - candle.max = marketFile[i][1]; + for (let i = 0; i < marketFile.length; i++) { - candle.open = marketFile[i][2]; - candle.close = marketFile[i][3]; + let candle = { + open: undefined, + close: undefined, + min: 10000000000000, + max: 0, + begin: undefined, + end: undefined, + direction: undefined + }; - candle.begin = marketFile[i][4]; - candle.end = marketFile[i][5]; + candle.min = marketFile[i][0]; + candle.max = marketFile[i][1]; - if (candle.open > candle.close) { candle.direction = 'down'; } - if (candle.open < candle.close) { candle.direction = 'up'; } - if (candle.open === candle.close) { candle.direction = 'side'; } + candle.open = marketFile[i][2]; + candle.close = marketFile[i][3]; - if (candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) { + candle.begin = marketFile[i][4]; + candle.end = marketFile[i][5]; - candles.push(candle); + if (candle.open > candle.close) { candle.direction = 'down'; } + if (candle.open < candle.close) { candle.direction = 'up'; } + if (candle.open === candle.close) { candle.direction = 'side'; } - if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { + if (candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) { - thisObject.currentCandle = candle; - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); + candles.push(candle); + if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { + + thisObject.currentCandle = candle; + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); + + } } - } - } + } - //console.log("Olivia > recalculateUsingMarketFiles > total candles generated : " + candles.length); + //console.log("Olivia > recalculateUsingMarketFiles > total candles generated : " + candles.length); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingMarketFiles -> err.message = " + err.message); } + } } function recalculateScale() { - if (marketFile === undefined) { return; } // We need the market file to be loaded to make the calculation. + try { - if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated. + if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); } - let minValue = { - x: EARLIEST_DATE.valueOf(), - y: 0 - }; + if (marketFile === undefined) { return; } // We need the market file to be loaded to make the calculation. - let maxValue = { - x: MAX_PLOTABLE_DATE.valueOf(), - y: nextPorwerOf10(getMaxRate()) / 4 // TODO: This 4 is temporary - }; + if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated. + + let minValue = { + x: EARLIEST_DATE.valueOf(), + y: 0 + }; + + let maxValue = { + x: MAX_PLOTABLE_DATE.valueOf(), + y: nextPorwerOf10(getMaxRate()) / 4 // TODO: This 4 is temporary + }; - timeLineCoordinateSystem.initialize( - minValue, - maxValue, - thisObject.container.frame.width, - thisObject.container.frame.height - ); + timeLineCoordinateSystem.initialize( + minValue, + maxValue, + thisObject.container.frame.width, + thisObject.container.frame.height + ); - function getMaxRate() { + function getMaxRate() { - let maxValue = 0; + if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> getMaxRate -> Entering function."); } - for (let i = 0; i < marketFile.length; i++) { + let maxValue = 0; - let currentMax = marketFile[i][1]; // 1 = rates. + for (let i = 0; i < marketFile.length; i++) { - if (maxValue < currentMax) { - maxValue = currentMax; + let currentMax = marketFile[i][1]; // 1 = rates. + + if (maxValue < currentMax) { + maxValue = currentMax; + } } + + return maxValue; + } - return maxValue; + } catch (err) { + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> err.message = " + err.message); } } - } function plotChart() { - if (candles.length > 0) { + try { - /* Now we calculate and plot the candles */ + if (INTENSIVE_LOG === true) { logger.write("[INFO] plotChart -> Entering function."); } - for (let i = 0; i < candles.length; i++) { + if (candles.length > 0) { - candle = candles[i]; + /* Now we calculate and plot the candles */ - let candlePoint1 = { - x: candle.begin + timePeriod / 7 * 1.5, - y: candle.open - }; + for (let i = 0; i < candles.length; i++) { - let candlePoint2 = { - x: candle.begin + timePeriod / 7 * 5.5, - y: candle.open - }; + candle = candles[i]; - let candlePoint3 = { - x: candle.begin + timePeriod / 7 * 5.5, - y: candle.close - }; + let candlePoint1 = { + x: candle.begin + timePeriod / 7 * 1.5, + y: candle.open + }; - let candlePoint4 = { - x: candle.begin + timePeriod / 7 * 1.5, - y: candle.close - }; + let candlePoint2 = { + x: candle.begin + timePeriod / 7 * 5.5, + y: candle.open + }; - candlePoint1 = timeLineCoordinateSystem.transformThisPoint(candlePoint1); - candlePoint2 = timeLineCoordinateSystem.transformThisPoint(candlePoint2); - candlePoint3 = timeLineCoordinateSystem.transformThisPoint(candlePoint3); - candlePoint4 = timeLineCoordinateSystem.transformThisPoint(candlePoint4); + let candlePoint3 = { + x: candle.begin + timePeriod / 7 * 5.5, + y: candle.close + }; - candlePoint1 = transformThisPoint(candlePoint1, thisObject.container); - candlePoint2 = transformThisPoint(candlePoint2, thisObject.container); - candlePoint3 = transformThisPoint(candlePoint3, thisObject.container); - candlePoint4 = transformThisPoint(candlePoint4, thisObject.container); + let candlePoint4 = { + x: candle.begin + timePeriod / 7 * 1.5, + y: candle.close + }; - if (candlePoint2.x < viewPort.visibleArea.bottomLeft.x || candlePoint1.x > viewPort.visibleArea.bottomRight.x) { - continue; - } + candlePoint1 = timeLineCoordinateSystem.transformThisPoint(candlePoint1); + candlePoint2 = timeLineCoordinateSystem.transformThisPoint(candlePoint2); + candlePoint3 = timeLineCoordinateSystem.transformThisPoint(candlePoint3); + candlePoint4 = timeLineCoordinateSystem.transformThisPoint(candlePoint4); - candlePoint1 = viewPort.fitIntoVisibleArea(candlePoint1); - candlePoint2 = viewPort.fitIntoVisibleArea(candlePoint2); - candlePoint3 = viewPort.fitIntoVisibleArea(candlePoint3); - candlePoint4 = viewPort.fitIntoVisibleArea(candlePoint4); + candlePoint1 = transformThisPoint(candlePoint1, thisObject.container); + candlePoint2 = transformThisPoint(candlePoint2, thisObject.container); + candlePoint3 = transformThisPoint(candlePoint3, thisObject.container); + candlePoint4 = transformThisPoint(candlePoint4, thisObject.container); - let stickPoint1 = { - x: candle.begin + timePeriod / 7 * 3.2, - y: candle.max - }; + if (candlePoint2.x < viewPort.visibleArea.bottomLeft.x || candlePoint1.x > viewPort.visibleArea.bottomRight.x) { + continue; + } - let stickPoint2 = { - x: candle.begin + timePeriod / 7 * 3.8, - y: candle.max - }; + candlePoint1 = viewPort.fitIntoVisibleArea(candlePoint1); + candlePoint2 = viewPort.fitIntoVisibleArea(candlePoint2); + candlePoint3 = viewPort.fitIntoVisibleArea(candlePoint3); + candlePoint4 = viewPort.fitIntoVisibleArea(candlePoint4); - let stickPoint3 = { - x: candle.begin + timePeriod / 7 * 3.8, - y: candle.min - }; + let stickPoint1 = { + x: candle.begin + timePeriod / 7 * 3.2, + y: candle.max + }; - let stickPoint4 = { - x: candle.begin + timePeriod / 7 * 3.2, - y: candle.min - }; + let stickPoint2 = { + x: candle.begin + timePeriod / 7 * 3.8, + y: candle.max + }; - stickPoint1 = timeLineCoordinateSystem.transformThisPoint(stickPoint1); - stickPoint2 = timeLineCoordinateSystem.transformThisPoint(stickPoint2); - stickPoint3 = timeLineCoordinateSystem.transformThisPoint(stickPoint3); - stickPoint4 = timeLineCoordinateSystem.transformThisPoint(stickPoint4); + let stickPoint3 = { + x: candle.begin + timePeriod / 7 * 3.8, + y: candle.min + }; - stickPoint1 = transformThisPoint(stickPoint1, thisObject.container); - stickPoint2 = transformThisPoint(stickPoint2, thisObject.container); - stickPoint3 = transformThisPoint(stickPoint3, thisObject.container); - stickPoint4 = transformThisPoint(stickPoint4, thisObject.container); + let stickPoint4 = { + x: candle.begin + timePeriod / 7 * 3.2, + y: candle.min + }; - stickPoint1 = viewPort.fitIntoVisibleArea(stickPoint1); - stickPoint2 = viewPort.fitIntoVisibleArea(stickPoint2); - stickPoint3 = viewPort.fitIntoVisibleArea(stickPoint3); - stickPoint4 = viewPort.fitIntoVisibleArea(stickPoint4); + stickPoint1 = timeLineCoordinateSystem.transformThisPoint(stickPoint1); + stickPoint2 = timeLineCoordinateSystem.transformThisPoint(stickPoint2); + stickPoint3 = timeLineCoordinateSystem.transformThisPoint(stickPoint3); + stickPoint4 = timeLineCoordinateSystem.transformThisPoint(stickPoint4); - browserCanvasContext.beginPath(); + stickPoint1 = transformThisPoint(stickPoint1, thisObject.container); + stickPoint2 = transformThisPoint(stickPoint2, thisObject.container); + stickPoint3 = transformThisPoint(stickPoint3, thisObject.container); + stickPoint4 = transformThisPoint(stickPoint4, thisObject.container); - browserCanvasContext.moveTo(stickPoint1.x, stickPoint1.y); - browserCanvasContext.lineTo(stickPoint2.x, stickPoint2.y); - browserCanvasContext.lineTo(stickPoint3.x, stickPoint3.y); - browserCanvasContext.lineTo(stickPoint4.x, stickPoint4.y); + stickPoint1 = viewPort.fitIntoVisibleArea(stickPoint1); + stickPoint2 = viewPort.fitIntoVisibleArea(stickPoint2); + stickPoint3 = viewPort.fitIntoVisibleArea(stickPoint3); + stickPoint4 = viewPort.fitIntoVisibleArea(stickPoint4); - browserCanvasContext.closePath(); - browserCanvasContext.fillStyle = 'rgba(54, 54, 54, 1)'; - browserCanvasContext.fill(); + browserCanvasContext.beginPath(); - if (datetime !== undefined) { + browserCanvasContext.moveTo(stickPoint1.x, stickPoint1.y); + browserCanvasContext.lineTo(stickPoint2.x, stickPoint2.y); + browserCanvasContext.lineTo(stickPoint3.x, stickPoint3.y); + browserCanvasContext.lineTo(stickPoint4.x, stickPoint4.y); - let dateValue = datetime.valueOf(); + browserCanvasContext.closePath(); + browserCanvasContext.fillStyle = 'rgba(54, 54, 54, 1)'; + browserCanvasContext.fill(); - if (dateValue >= candle.begin && dateValue <= candle.end) { + if (datetime !== undefined) { - browserCanvasContext.strokeStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time + let dateValue = datetime.valueOf(); + + if (dateValue >= candle.begin && dateValue <= candle.end) { + + browserCanvasContext.strokeStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time + + } else { + browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)'; + } } else { browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)'; } - } else { - browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)'; - } + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); - browserCanvasContext.lineWidth = 1; - browserCanvasContext.stroke(); + browserCanvasContext.beginPath(); - browserCanvasContext.beginPath(); + browserCanvasContext.moveTo(candlePoint1.x, candlePoint1.y); + browserCanvasContext.lineTo(candlePoint2.x, candlePoint2.y); + browserCanvasContext.lineTo(candlePoint3.x, candlePoint3.y); + browserCanvasContext.lineTo(candlePoint4.x, candlePoint4.y); - browserCanvasContext.moveTo(candlePoint1.x, candlePoint1.y); - browserCanvasContext.lineTo(candlePoint2.x, candlePoint2.y); - browserCanvasContext.lineTo(candlePoint3.x, candlePoint3.y); - browserCanvasContext.lineTo(candlePoint4.x, candlePoint4.y); + browserCanvasContext.closePath(); - browserCanvasContext.closePath(); + if (candle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 1)'; } + if (candle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 1)'; } + if (candle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(27, 7, 105, 1)'; } - if (candle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 1)'; } - if (candle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 1)'; } - if (candle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(27, 7, 105, 1)'; } + if (datetime !== undefined) { - if (datetime !== undefined) { + let dateValue = datetime.valueOf(); - let dateValue = datetime.valueOf(); + if (dateValue >= candle.begin && dateValue <= candle.end) { - if (dateValue >= candle.begin && dateValue <= candle.end) { + /* highlight the current candle */ - /* highlight the current candle */ + browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time - browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time + let currentCandle = { + bodyWidth: candlePoint2.x - candlePoint1.x, + bodyHeight: candlePoint3.y - candlePoint2.y, + stickHeight: stickPoint4.y - stickPoint2.y, + stickWidth: stickPoint2.x - stickPoint1.x, + stickStart: candlePoint2.y - stickPoint2.y, + period: timePeriod, + innerCandle: candle + }; - let currentCandle = { - bodyWidth: candlePoint2.x - candlePoint1.x, - bodyHeight: candlePoint3.y - candlePoint2.y, - stickHeight: stickPoint4.y - stickPoint2.y, - stickWidth: stickPoint2.x - stickPoint1.x, - stickStart: candlePoint2.y - stickPoint2.y, - period: timePeriod, - innerCandle: candle - }; + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); + } else { + + if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; } + if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; } + if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; } + } } else { if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; } if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; } if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; } + } - } else { - if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; } - if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; } - if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; } + + if ( + candlePoint1.x < viewPort.visibleArea.topLeft.x + 50 + || + candlePoint1.x > viewPort.visibleArea.bottomRight.x - 50 + ) { + // we leave this candles without fill. + } else { + browserCanvasContext.fill(); + } + + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); + } - - - - if ( - candlePoint1.x < viewPort.visibleArea.topLeft.x + 50 - || - candlePoint1.x > viewPort.visibleArea.bottomRight.x - 50 - ) { - // we leave this candles without fill. - } else { - browserCanvasContext.fill(); - } - - browserCanvasContext.lineWidth = 1; - browserCanvasContext.stroke(); - - } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] plotChart -> err.message = " + err.message); } } } function onZoomChanged(event) { - recalculate(); + try { + if (INFO_LOG === true) { logger.write("[INFO] onZoomChanged -> Entering function."); } + + recalculate(); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onZoomChanged -> err.message = " + err.message); } + } } function onOffsetChanged() { - if (Math.random() * 100 > 95) { + try { - recalculate() - }; + if (INFO_LOG === true) { logger.write("[INFO] onOffsetChanged -> Entering function."); } + if (Math.random() * 100 > 95) { + + recalculate() + }; + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onOffsetChanged -> err.message = " + err.message); } + } } function onDragFinished() { - recalculate(); + try { + if (INFO_LOG === true) { logger.write("[INFO] onDragFinished -> Entering function."); } + + recalculate(); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onDragFinished -> err.message = " + err.message); } + } } } diff --git a/Volumes.js b/Volumes.js index 0fb840edd..83de73609 100644 --- a/Volumes.js +++ b/Volumes.js @@ -1,5 +1,12 @@ function newAAMastersPlottersCandlesVolumesVolumes() { + const MODULE_NAME = "Volumes Plotter"; + const INFO_LOG = false; + const ERROR_LOG = true; + const INTENSIVE_LOG = false; + const logger = newWebDebugLog(); + logger.fileName = MODULE_NAME; + let thisObject = { /* Events declared outside the plotter. */ @@ -44,666 +51,795 @@ function initialize(pStorage, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { - /* Store the information received. */ + try { - marketFiles = pStorage.marketFiles[0]; - dailyFiles = pStorage.dailyFiles[0]; + if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } - datetime = pDatetime; - timePeriod = pTimePeriod; + /* Store the information received. */ - /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ + marketFiles = pStorage.marketFiles[0]; + dailyFiles = pStorage.dailyFiles[0]; - scaleFile = marketFiles.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. + datetime = pDatetime; + timePeriod = pTimePeriod; - /* Now we set the right files according to current Period. */ + /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ - marketFile = marketFiles.getFile(pTimePeriod); - fileCursor = dailyFiles.getFileCursor(pTimePeriod); + scaleFile = marketFiles.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. - /* Listen to the necesary events. */ + /* Now we set the right files according to current Period. */ - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); - marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + marketFile = marketFiles.getFile(pTimePeriod); + fileCursor = dailyFiles.getFileCursor(pTimePeriod); - /* Get ready for plotting. */ + /* Listen to the necesary events. */ - recalculateScaleX(); - recalculate(); - recalculateScaleY(); + viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); + marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); + canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - callBackFunction(); - - } - - function getContainer(point) { - - let container; - - /* First we check if this point is inside this space. */ - - if (this.container.frame.isThisPointHere(point) === true) { - - return this.container; - - } else { - - /* This point does not belong to this space. */ - - return undefined; - } - - } - - function onFilesUpdated() { - - let newMarketFile = marketFiles.getFile(timePeriod); - - if (newMarketFile !== undefined) { - - marketFile = newMarketFile; + /* Get ready for plotting. */ recalculateScaleX(); recalculate(); recalculateScaleY(); - } + callBackFunction(); + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> err.message = " + err.message); } + } + } + + function getContainer(point) { + + try { + + if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); } + + let container; + + /* First we check if this point is inside this space. */ + + if (this.container.frame.isThisPointHere(point) === true) { + + return this.container; + + } else { + + /* This point does not belong to this space. */ + + return undefined; + } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] getContainer -> err.message = " + err.message); } + } + } + + function onFilesUpdated() { + + try { + + if (INFO_LOG === true) { logger.write("[INFO] onFilesUpdated -> Entering function."); } + + let newMarketFile = marketFiles.getFile(timePeriod); + + if (newMarketFile !== undefined) { + + marketFile = newMarketFile; + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onFilesUpdated -> err.message = " + err.message); } + } } function setTimePeriod(pTimePeriod) { - if (timePeriod !== pTimePeriod) { + try { - timePeriod = pTimePeriod; + if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); } - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + if (timePeriod !== pTimePeriod) { - let newMarketFile = marketFiles.getFile(pTimePeriod); + timePeriod = pTimePeriod; - if (newMarketFile !== undefined) { + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - marketFile = newMarketFile; - recalculate(); - } + let newMarketFile = marketFiles.getFile(pTimePeriod); - } else { + if (newMarketFile !== undefined) { - let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); + marketFile = newMarketFile; + recalculate(); + } - if (newFileCursor !== undefined) { + } else { - fileCursor = newFileCursor; - recalculate(); + let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); + + if (newFileCursor !== undefined) { + + fileCursor = newFileCursor; + recalculate(); + } } } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] setTimePeriod -> err.message = " + err.message); } } } function setDatetime(pDatetime) { + if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); } + datetime = pDatetime; } function onDailyFileLoaded(event) { - if (event.currentValue === event.totalValue) { + try { - /* This happens only when all of the files in the cursor have been loaded. */ + if (INFO_LOG === true) { logger.write("[INFO] onDailyFileLoaded -> Entering function."); } - recalculateScaleX(); - recalculate(); - recalculateScaleY(); + if (event.currentValue === event.totalValue) { + /* This happens only when all of the files in the cursor have been loaded. */ + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFileLoaded -> err.message = " + err.message); } } } function draw() { - this.container.frame.draw(); + try { - plotChart(); + if (INTENSIVE_LOG === true) { logger.write("[INFO] draw -> Entering function."); } + this.container.frame.draw(); + + plotChart(); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] draw -> err.message = " + err.message); } + } } function recalculate() { - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + try { - recalculateUsingMarketFiles(); + if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); } - } else { + if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - recalculateUsingDailyFiles(); + recalculateUsingMarketFiles(); + } else { + + recalculateUsingDailyFiles(); + + } + + thisObject.container.eventHandler.raiseEvent("Volumes Changed", volumes); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] recalculate -> err.message = " + err.message); } } - - thisObject.container.eventHandler.raiseEvent("Volumes Changed", volumes); } function recalculateUsingDailyFiles() { - if (fileCursor === undefined) { return; } // We need to wait + try { - if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor + if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingDailyFiles -> Entering function."); } - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); + if (fileCursor === undefined) { return; } // We need to wait - let dateDiff = rightDate.valueOf() - leftDate.valueOf(); + if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let farLeftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); - let farRightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); - let currentDate = new Date(farLeftDate.valueOf()); + let dateDiff = rightDate.valueOf() - leftDate.valueOf(); - volumes = []; + let farLeftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); + let farRightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); - while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { + let currentDate = new Date(farLeftDate.valueOf()); - let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); + volumes = []; - let dailyFile = fileCursor.files.get(stringDate); + while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { - if (dailyFile !== undefined) { + let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); - for (let i = 0; i < dailyFile.length; i++) { + let dailyFile = fileCursor.files.get(stringDate); - let volume = { - amountBuy: 0, - amountSell: 0, - begin: undefined, - end: undefined - }; + if (dailyFile !== undefined) { - volume.amountBuy = dailyFile[i][0]; - volume.amountSell = dailyFile[i][1]; + for (let i = 0; i < dailyFile.length; i++) { - volume.begin = dailyFile[i][2]; - volume.end = dailyFile[i][3]; + let volume = { + amountBuy: 0, + amountSell: 0, + begin: undefined, + end: undefined + }; - if (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) { + volume.amountBuy = dailyFile[i][0]; + volume.amountSell = dailyFile[i][1]; - volumes.push(volume); + volume.begin = dailyFile[i][2]; + volume.end = dailyFile[i][3]; - if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { + if (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) { - thisObject.container.eventHandler.raiseEvent("Current Volume Changed", thisObject.currentCandle); + volumes.push(volume); + if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { + + thisObject.container.eventHandler.raiseEvent("Current Volume Changed", thisObject.currentCandle); + + } } } } + + currentDate = new Date(currentDate.valueOf() + ONE_DAY_IN_MILISECONDS); } - currentDate = new Date(currentDate.valueOf() + ONE_DAY_IN_MILISECONDS); - } + /* Lests check if all the visible screen is going to be covered by volumes. */ - /* Lests check if all the visible screen is going to be covered by volumes. */ + let lowerEnd = leftDate.valueOf(); + let upperEnd = rightDate.valueOf(); - let lowerEnd = leftDate.valueOf(); - let upperEnd = rightDate.valueOf(); + if (volumes.length > 0) { - if (volumes.length > 0) { + if (volumes[0].begin > lowerEnd || volumes[volumes.length - 1].end < upperEnd) { - if (volumes[0].begin > lowerEnd || volumes[volumes.length - 1].end < upperEnd) { + setTimeout(recalculate, 2000); - setTimeout(recalculate, 2000); - - //console.log("File missing while calculating volumes, scheduling a recalculation in 2 seconds."); + //console.log("File missing while calculating volumes, scheduling a recalculation in 2 seconds."); + } } + + //console.log("Olivia > recalculateUsingDailyFiles > total volumes generated : " + volumes.length); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingDailyFiles -> err.message = " + err.message); } } - - //console.log("Olivia > recalculateUsingDailyFiles > total volumes generated : " + volumes.length); - } function recalculateUsingMarketFiles() { - if (marketFile === undefined) { return; } // Initialization not complete yet. + try { - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); + if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingMarketFiles -> Entering function."); } - let dateDiff = rightDate.valueOf() - leftDate.valueOf(); + if (marketFile === undefined) { return; } // Initialization not complete yet. - leftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); - rightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); - volumes = []; + let dateDiff = rightDate.valueOf() - leftDate.valueOf(); - for (let i = 0; i < marketFile.length; i++) { + leftDate = new Date(leftDate.valueOf() - dateDiff * 1.5); + rightDate = new Date(rightDate.valueOf() + dateDiff * 1.5); - let volume = { - amountBuy: 0, - amountSell: 0, - begin: undefined, - end: undefined - }; + volumes = []; - volume.amountBuy = marketFile[i][0]; - volume.amountSell = marketFile[i][1]; + for (let i = 0; i < marketFile.length; i++) { - volume.begin = marketFile[i][2]; - volume.end = marketFile[i][3]; + let volume = { + amountBuy: 0, + amountSell: 0, + begin: undefined, + end: undefined + }; - if (volume.begin >= leftDate.valueOf() && volume.end <= rightDate.valueOf()) { + volume.amountBuy = marketFile[i][0]; + volume.amountSell = marketFile[i][1]; - volumes.push(volume); + volume.begin = marketFile[i][2]; + volume.end = marketFile[i][3]; - if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { + if (volume.begin >= leftDate.valueOf() && volume.end <= rightDate.valueOf()) { - thisObject.container.eventHandler.raiseEvent("Current Volume Changed", thisObject.currentCandle); + volumes.push(volume); + if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { + + thisObject.container.eventHandler.raiseEvent("Current Volume Changed", thisObject.currentCandle); + + } } } - } - //console.log("Olivia > recalculateUsingMarketFiles > total volumes generated : " + volumes.length); + //console.log("Olivia > recalculateUsingMarketFiles > total volumes generated : " + volumes.length); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingMarketFiles -> err.message = " + err.message); } + } } function recalculateScaleX() { + try { - var minValue = { - x: EARLIEST_DATE.valueOf() - }; + if (INFO_LOG === true) { logger.write("[INFO] recalculateScaleX -> Entering function."); } - var maxValue = { - x: MAX_PLOTABLE_DATE.valueOf() - }; + var minValue = { + x: EARLIEST_DATE.valueOf() + }; - timeLineCoordinateSystem.initializeX( - minValue, - maxValue, - thisObject.container.frame.width - ); + var maxValue = { + x: MAX_PLOTABLE_DATE.valueOf() + }; - plotAreaFrame.initializeX( - minValue, - maxValue, - thisObject.container.frame.width - ); + timeLineCoordinateSystem.initializeX( + minValue, + maxValue, + thisObject.container.frame.width + ); + plotAreaFrame.initializeX( + minValue, + maxValue, + thisObject.container.frame.width + ); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScaleX -> err.message = " + err.message); } + } } function recalculateScaleY() { - var minValue = { - y: 0 - }; + try { - var maxValue = { - y: 0 - }; + if (INFO_LOG === true) { logger.write("[INFO] recalculateScaleY -> Entering function."); } - let timePeriodRatio = ONE_DAY_IN_MILISECONDS / timePeriod; + var minValue = { + y: 0 + }; - maxValue.y = getMaxVolume() / (timePeriodRatio / 2.5); + var maxValue = { + y: 0 + }; - timeLineCoordinateSystem.initializeY( - minValue, - maxValue, - viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y - ); + let timePeriodRatio = ONE_DAY_IN_MILISECONDS / timePeriod; - plotAreaFrame.initializeY( - minValue, - maxValue, - thisObject.container.frame.height - ); + maxValue.y = getMaxVolume() / (timePeriodRatio / 2.5); - function getMaxVolume() { + timeLineCoordinateSystem.initializeY( + minValue, + maxValue, + viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y + ); - let maxValue = 0; + plotAreaFrame.initializeY( + minValue, + maxValue, + thisObject.container.frame.height + ); - for (var i = 0; i < scaleFile.length; i++) { + function getMaxVolume() { - let currentMax = (scaleFile[i][0] + scaleFile[i][1]) * 4; + if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } - if (maxValue < currentMax) { - maxValue = currentMax; + let maxValue = 0; + + for (var i = 0; i < scaleFile.length; i++) { + + let currentMax = (scaleFile[i][0] + scaleFile[i][1]) * 4; + + if (maxValue < currentMax) { + maxValue = currentMax; + } } + + return maxValue; + } - return maxValue; + } catch (err) { + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScaleY -> err.message = " + err.message); } } - } function plotChart() { - if (volumes.length > 0) { + try { - /* Now we calculate and plot the volumes */ - - let visibleHeight = viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y; - - let frameCorner1 = { - x: 0, - y: 0 - }; - - let frameCorner2 = { - x: thisObject.container.frame.width, - y: thisObject.container.frame.height - }; - - - /* Now the transformations. */ - - frameCorner1 = transformThisPoint(frameCorner1, thisObject.container.frame.container); - frameCorner2 = transformThisPoint(frameCorner2, thisObject.container.frame.container); - - let frameHeightInViewPort = frameCorner2.y - frameCorner1.y; + if (INTENSIVE_LOG === true) { logger.write("[INFO] plotChart -> Entering function."); } if (volumes.length > 0) { - for (var i = 0; i < volumes.length; i++) { + /* Now we calculate and plot the volumes */ - volume = volumes[i]; + let visibleHeight = viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y; - let volumePointA1; - let volumePointA2; - let volumePointA3; - let volumePointA4; + let frameCorner1 = { + x: 0, + y: 0 + }; - function calculateBuys(plot, height) { + let frameCorner2 = { + x: thisObject.container.frame.width, + y: thisObject.container.frame.height + }; - volumePointA1 = { - x: volume.begin + timePeriod / 7 * 2, - y: 0 - }; - volumePointA2 = { - x: volume.begin + timePeriod / 7 * 2, - y: volume.amountBuy - }; + /* Now the transformations. */ - volumePointA3 = { - x: volume.begin + timePeriod / 7 * 5, - y: volume.amountBuy - }; + frameCorner1 = transformThisPoint(frameCorner1, thisObject.container.frame.container); + frameCorner2 = transformThisPoint(frameCorner2, thisObject.container.frame.container); - volumePointA4 = { - x: volume.begin + timePeriod / 7 * 5, - y: 0 - }; + let frameHeightInViewPort = frameCorner2.y - frameCorner1.y; - volumePointA1 = plot.transformThisPoint(volumePointA1); - volumePointA2 = plot.transformThisPoint(volumePointA2); - volumePointA3 = plot.transformThisPoint(volumePointA3); - volumePointA4 = plot.transformThisPoint(volumePointA4); + if (volumes.length > 0) { - volumePointA1 = transformThisPoint(volumePointA1, thisObject.container); - volumePointA2 = transformThisPoint(volumePointA2, thisObject.container); - volumePointA3 = transformThisPoint(volumePointA3, thisObject.container); - volumePointA4 = transformThisPoint(volumePointA4, thisObject.container); + for (var i = 0; i < volumes.length; i++) { - let baseIncrement = (volumePointA3.x - volumePointA1.x) * WIDHTER_VOLUME_BAR_BASE_FACTOR; + volume = volumes[i]; - volumePointA1.x = volumePointA1.x - baseIncrement; - volumePointA4.x = volumePointA4.x + baseIncrement; + let volumePointA1; + let volumePointA2; + let volumePointA3; + let volumePointA4; + + function calculateBuys(plot, height) { + + volumePointA1 = { + x: volume.begin + timePeriod / 7 * 2, + y: 0 + }; + + volumePointA2 = { + x: volume.begin + timePeriod / 7 * 2, + y: volume.amountBuy + }; + + volumePointA3 = { + x: volume.begin + timePeriod / 7 * 5, + y: volume.amountBuy + }; + + volumePointA4 = { + x: volume.begin + timePeriod / 7 * 5, + y: 0 + }; + + volumePointA1 = plot.transformThisPoint(volumePointA1); + volumePointA2 = plot.transformThisPoint(volumePointA2); + volumePointA3 = plot.transformThisPoint(volumePointA3); + volumePointA4 = plot.transformThisPoint(volumePointA4); + + volumePointA1 = transformThisPoint(volumePointA1, thisObject.container); + volumePointA2 = transformThisPoint(volumePointA2, thisObject.container); + volumePointA3 = transformThisPoint(volumePointA3, thisObject.container); + volumePointA4 = transformThisPoint(volumePointA4, thisObject.container); + + let baseIncrement = (volumePointA3.x - volumePointA1.x) * WIDHTER_VOLUME_BAR_BASE_FACTOR; + + volumePointA1.x = volumePointA1.x - baseIncrement; + volumePointA4.x = volumePointA4.x + baseIncrement; + + if (volumePointA4.x < viewPort.visibleArea.bottomLeft.x || volumePointA1.x > viewPort.visibleArea.bottomRight.x) { + return false; + } + + return true; - if (volumePointA4.x < viewPort.visibleArea.bottomLeft.x || volumePointA1.x > viewPort.visibleArea.bottomRight.x) { - return false; } - return true; + if (calculateBuys(plotAreaFrame, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. - } + if (volumePointA1.y > viewPort.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - if (calculateBuys(plotAreaFrame, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. + if (calculateBuys(timeLineCoordinateSystem, visibleHeight) === false) { continue; } // We snap t to the view port. - if (volumePointA1.y > viewPort.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { + /* Now we set the real value of y. */ - if (calculateBuys(timeLineCoordinateSystem, visibleHeight) === false) { continue; } // We snap t to the view port. + volumePointA1.y = viewPort.visibleArea.bottomRight.y; + volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; + volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; + volumePointA4.y = viewPort.visibleArea.bottomRight.y; - /* Now we set the real value of y. */ + } - volumePointA1.y = viewPort.visibleArea.bottomRight.y; - volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; - volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; - volumePointA4.y = viewPort.visibleArea.bottomRight.y; + let volumePointB1; + let volumePointB2; + let volumePointB3; + let volumePointB4; - } + function calculateSells(plot, height) { - let volumePointB1; - let volumePointB2; - let volumePointB3; - let volumePointB4; + volumePointB1 = { + x: volume.begin + timePeriod / 7 * 2, + y: height + }; - function calculateSells(plot, height) { + volumePointB2 = { + x: volume.begin + timePeriod / 7 * 2, + y: height - volume.amountSell + }; - volumePointB1 = { - x: volume.begin + timePeriod / 7 * 2, - y: height - }; + volumePointB3 = { + x: volume.begin + timePeriod / 7 * 5, + y: height - volume.amountSell + }; - volumePointB2 = { - x: volume.begin + timePeriod / 7 * 2, - y: height - volume.amountSell - }; + volumePointB4 = { + x: volume.begin + timePeriod / 7 * 5, + y: height + }; - volumePointB3 = { - x: volume.begin + timePeriod / 7 * 5, - y: height - volume.amountSell - }; + volumePointB1 = plot.transformThisPoint2(volumePointB1); + volumePointB2 = plot.transformThisPoint2(volumePointB2); + volumePointB3 = plot.transformThisPoint2(volumePointB3); + volumePointB4 = plot.transformThisPoint2(volumePointB4); - volumePointB4 = { - x: volume.begin + timePeriod / 7 * 5, - y: height - }; + volumePointB1 = transformThisPoint(volumePointB1, thisObject.container); + volumePointB2 = transformThisPoint(volumePointB2, thisObject.container); + volumePointB3 = transformThisPoint(volumePointB3, thisObject.container); + volumePointB4 = transformThisPoint(volumePointB4, thisObject.container); - volumePointB1 = plot.transformThisPoint2(volumePointB1); - volumePointB2 = plot.transformThisPoint2(volumePointB2); - volumePointB3 = plot.transformThisPoint2(volumePointB3); - volumePointB4 = plot.transformThisPoint2(volumePointB4); + } - volumePointB1 = transformThisPoint(volumePointB1, thisObject.container); - volumePointB2 = transformThisPoint(volumePointB2, thisObject.container); - volumePointB3 = transformThisPoint(volumePointB3, thisObject.container); - volumePointB4 = transformThisPoint(volumePointB4, thisObject.container); + calculateSells(plotAreaFrame, thisObject.container.frame.height); // We try to see if it fits in the visible area. - } + if (volumePointB1.y < viewPort.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - calculateSells(plotAreaFrame, thisObject.container.frame.height); // We try to see if it fits in the visible area. + calculateSells(timeLineCoordinateSystem, visibleHeight); // We snap it to the view port. - if (volumePointB1.y < viewPort.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { + /* Now we set the real value of y. */ - calculateSells(timeLineCoordinateSystem, visibleHeight); // We snap it to the view port. + volumePointB1.y = viewPort.visibleArea.topLeft.y; + volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; + volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; + volumePointB4.y = viewPort.visibleArea.topLeft.y; - /* Now we set the real value of y. */ + } - volumePointB1.y = viewPort.visibleArea.topLeft.y; - volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; - volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; - volumePointB4.y = viewPort.visibleArea.topLeft.y; + /* We put a wider base */ - } + let baseIncrement = (volumePointB3.x - volumePointB1.x) * WIDHTER_VOLUME_BAR_BASE_FACTOR; - /* We put a wider base */ + volumePointB1.x = volumePointB1.x - baseIncrement; + volumePointB4.x = volumePointB4.x + baseIncrement; - let baseIncrement = (volumePointB3.x - volumePointB1.x) * WIDHTER_VOLUME_BAR_BASE_FACTOR; + /* We put a less wider top */ - volumePointB1.x = volumePointB1.x - baseIncrement; - volumePointB4.x = volumePointB4.x + baseIncrement; + let baseDencrement = (volumePointA3.x - volumePointA2.x) * LESS_WIDHTER_VOLUME_BAR_TOP_FACTOR; - /* We put a less wider top */ + volumePointA2.x = volumePointA2.x + baseDencrement; + volumePointA3.x = volumePointA3.x - baseDencrement; - let baseDencrement = (volumePointA3.x - volumePointA2.x) * LESS_WIDHTER_VOLUME_BAR_TOP_FACTOR; - - volumePointA2.x = volumePointA2.x + baseDencrement; - volumePointA3.x = volumePointA3.x - baseDencrement; - - volumePointB2.x = volumePointB2.x + baseDencrement; - volumePointB3.x = volumePointB3.x - baseDencrement; + volumePointB2.x = volumePointB2.x + baseDencrement; + volumePointB3.x = volumePointB3.x - baseDencrement; - /* Everything must fit within the visible area */ + /* Everything must fit within the visible area */ - volumePointA1 = viewPort.fitIntoVisibleArea(volumePointA1); - volumePointA2 = viewPort.fitIntoVisibleArea(volumePointA2); - volumePointA3 = viewPort.fitIntoVisibleArea(volumePointA3); - volumePointA4 = viewPort.fitIntoVisibleArea(volumePointA4); + volumePointA1 = viewPort.fitIntoVisibleArea(volumePointA1); + volumePointA2 = viewPort.fitIntoVisibleArea(volumePointA2); + volumePointA3 = viewPort.fitIntoVisibleArea(volumePointA3); + volumePointA4 = viewPort.fitIntoVisibleArea(volumePointA4); - volumePointB1 = viewPort.fitIntoVisibleArea(volumePointB1); - volumePointB2 = viewPort.fitIntoVisibleArea(volumePointB2); - volumePointB3 = viewPort.fitIntoVisibleArea(volumePointB3); - volumePointB4 = viewPort.fitIntoVisibleArea(volumePointB4); + volumePointB1 = viewPort.fitIntoVisibleArea(volumePointB1); + volumePointB2 = viewPort.fitIntoVisibleArea(volumePointB2); + volumePointB3 = viewPort.fitIntoVisibleArea(volumePointB3); + volumePointB4 = viewPort.fitIntoVisibleArea(volumePointB4); - /* Everything must fit within the Frame. We know that that is equivalent to say that each bar con not be higher than the base of the opposite . */ + /* Everything must fit within the Frame. We know that that is equivalent to say that each bar con not be higher than the base of the opposite . */ - if (volumePointA2.y < volumePointB1.y) { + if (volumePointA2.y < volumePointB1.y) { - volumePointA2.y = volumePointB1.y; - volumePointA3.y = volumePointB1.y; + volumePointA2.y = volumePointB1.y; + volumePointA3.y = volumePointB1.y; - } + } - if (volumePointB2.y > volumePointA1.y) { + if (volumePointB2.y > volumePointA1.y) { - volumePointB2.y = volumePointA1.y; - volumePointB3.y = volumePointA1.y; + volumePointB2.y = volumePointA1.y; + volumePointB3.y = volumePointA1.y; - } + } - /* Now the drawing of the volume bars*/ + /* Now the drawing of the volume bars*/ - browserCanvasContext.beginPath(); + browserCanvasContext.beginPath(); - browserCanvasContext.moveTo(volumePointA1.x, volumePointA1.y); - browserCanvasContext.lineTo(volumePointA2.x, volumePointA2.y); - browserCanvasContext.lineTo(volumePointA3.x, volumePointA3.y); - browserCanvasContext.lineTo(volumePointA4.x, volumePointA4.y); + browserCanvasContext.moveTo(volumePointA1.x, volumePointA1.y); + browserCanvasContext.lineTo(volumePointA2.x, volumePointA2.y); + browserCanvasContext.lineTo(volumePointA3.x, volumePointA3.y); + browserCanvasContext.lineTo(volumePointA4.x, volumePointA4.y); - browserCanvasContext.closePath(); + browserCanvasContext.closePath(); - if (datetime !== undefined) { + if (datetime !== undefined) { - let dateValue = datetime.valueOf(); + let dateValue = datetime.valueOf(); - if (dateValue >= volume.begin && dateValue <= volume.end) { + if (dateValue >= volume.begin && dateValue <= volume.end) { - browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current bar accroding to time + browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current bar accroding to time + + } else { + + browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 0.40)'; + } } else { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 0.40)'; + } - } else { - - browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 0.40)'; - - } - - browserCanvasContext.fill(); - browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 0.40)'; - browserCanvasContext.lineWidth = 1; - browserCanvasContext.stroke(); + browserCanvasContext.fill(); + browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 0.40)'; + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); - browserCanvasContext.beginPath(); + browserCanvasContext.beginPath(); - browserCanvasContext.moveTo(volumePointB1.x, volumePointB1.y); - browserCanvasContext.lineTo(volumePointB2.x, volumePointB2.y); - browserCanvasContext.lineTo(volumePointB3.x, volumePointB3.y); - browserCanvasContext.lineTo(volumePointB4.x, volumePointB4.y); + browserCanvasContext.moveTo(volumePointB1.x, volumePointB1.y); + browserCanvasContext.lineTo(volumePointB2.x, volumePointB2.y); + browserCanvasContext.lineTo(volumePointB3.x, volumePointB3.y); + browserCanvasContext.lineTo(volumePointB4.x, volumePointB4.y); - browserCanvasContext.closePath(); + browserCanvasContext.closePath(); - if (datetime !== undefined) { + if (datetime !== undefined) { - let dateValue = datetime.valueOf(); + let dateValue = datetime.valueOf(); - if (dateValue >= volume.begin && dateValue <= volume.end) { + if (dateValue >= volume.begin && dateValue <= volume.end) { - browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current volume accroding to time + browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current volume accroding to time + + } else { + + browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 0.40)'; + } } else { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 0.40)'; + } - } else { + browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 0.40)'; - browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 0.40)'; - - } - - browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 0.40)'; - - browserCanvasContext.fill(); - browserCanvasContext.lineWidth = 1; - browserCanvasContext.stroke(); + browserCanvasContext.fill(); + browserCanvasContext.lineWidth = 1; + browserCanvasContext.stroke(); - if (datetime !== undefined) { + if (datetime !== undefined) { - let dateValue = datetime.valueOf(); + let dateValue = datetime.valueOf(); - if (dateValue >= volume.begin && dateValue <= volume.end) { + if (dateValue >= volume.begin && dateValue <= volume.end) { - let buyInfo = { - baseWidth: volumePointA4.x - volumePointA1.x, - topWidth: volumePointA3.x - volumePointA2.x, - height: volumePointA2.y - volumePointA1.y - }; + let buyInfo = { + baseWidth: volumePointA4.x - volumePointA1.x, + topWidth: volumePointA3.x - volumePointA2.x, + height: volumePointA2.y - volumePointA1.y + }; - let sellInfo = { - baseWidth: volumePointB4.x - volumePointB1.x, - topWidth: volumePointB3.x - volumePointB2.x, - height: volumePointB2.y - volumePointB1.y - }; + let sellInfo = { + baseWidth: volumePointB4.x - volumePointB1.x, + topWidth: volumePointB3.x - volumePointB2.x, + height: volumePointB2.y - volumePointB1.y + }; - let currentVolume = { - buyInfo: buyInfo, - sellInfo: sellInfo, - period: timePeriod, - innerVolumeBar: volume - }; + let currentVolume = { + buyInfo: buyInfo, + sellInfo: sellInfo, + period: timePeriod, + innerVolumeBar: volume + }; - thisObject.container.eventHandler.raiseEvent("Current Volume Changed", currentVolume); + thisObject.container.eventHandler.raiseEvent("Current Volume Changed", currentVolume); + } } } } } + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] plotChart -> err.message = " + err.message); } } } function onZoomChanged(event) { - recalculateScaleX(); - recalculate(); - recalculateScaleY(); + try { - } - - function onOffsetChanged() { - - if (Math.random() * 100 > 95) { + if (INFO_LOG === true) { logger.write("[INFO] onZoomChanged -> Entering function."); } recalculateScaleX(); recalculate(); recalculateScaleY(); - }; + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onZoomChanged -> err.message = " + err.message); } + } + } + + function onOffsetChanged() { + + try { + + if (INFO_LOG === true) { logger.write("[INFO] onOffsetChanged -> Entering function."); } + + if (Math.random() * 100 > 95) { + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + }; + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onOffsetChanged -> err.message = " + err.message); } + } } function onDragFinished() { - recalculateScaleX(); - recalculate(); - recalculateScaleY(); + try { + if (INFO_LOG === true) { logger.write("[INFO] onDragFinished -> Entering function."); } + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] onDragFinished -> err.message = " + err.message); } + } } } From cca1b2f038250d29cc83b8186c40c2c0e8ff2dab Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 May 2018 16:01:19 +0200 Subject: [PATCH 112/176] Initial position of pannel correceted --- CandlePanel.js | 2 +- VolumePanel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 4081a981a..de316b91e 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -26,7 +26,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { currentCandlePanel.container.frame.height = 300; currentCandlePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentCandlePanel.container.frame.width * 2; - currentCandlePanel.container.frame.position.y = 0; + currentCandlePanel.container.frame.position.y = viewPort.visibleArea.topLeft.y; } diff --git a/VolumePanel.js b/VolumePanel.js index 5a3dd911f..02af8f852 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -26,7 +26,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { currentVolumePanel.container.frame.height = 300; currentVolumePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentVolumePanel.container.frame.width; - currentVolumePanel.container.frame.position.y = 0; + currentVolumePanel.container.frame.position.y = viewPort.visibleArea.topLeft.y; } From c96cb3cf6c025e9fa07d674c018889c06b4c6a6d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 May 2018 21:39:43 +0200 Subject: [PATCH 113/176] Reposition --- CandlePanel.js | 2 +- VolumePanel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index de316b91e..a4af40149 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -26,7 +26,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { currentCandlePanel.container.frame.height = 300; currentCandlePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentCandlePanel.container.frame.width * 2; - currentCandlePanel.container.frame.position.y = viewPort.visibleArea.topLeft.y; + currentCandlePanel.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - currentCandlePanel.container.frame.height; } diff --git a/VolumePanel.js b/VolumePanel.js index 02af8f852..918f76f9f 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -26,7 +26,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { currentVolumePanel.container.frame.height = 300; currentVolumePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentVolumePanel.container.frame.width; - currentVolumePanel.container.frame.position.y = viewPort.visibleArea.topLeft.y; + currentVolumePanel.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - currentVolumePanel.container.frame.height; } From 37a9285873c16971e5e85f70faff574842bb99f2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 May 2018 18:40:27 +0200 Subject: [PATCH 114/176] When there is no candle it still positions browser --- Candles.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Candles.js b/Candles.js index 0b9393412..0c2a4e70e 100644 --- a/Candles.js +++ b/Candles.js @@ -198,10 +198,17 @@ /* Now we calculate which candle has this new time, because it will give us the y coordinate. */ + let candleFound = false; + let lastClose; + for (let i = 0; i < candles.length; i++) { + lastClose = candles[i].close; + if (value >= candles[i].begin && value <= candles[i].end) { + candleFound = true; + let targetPoint = { x: value, y: candles[i].open @@ -253,6 +260,31 @@ } } + if (candleFound === false) { + + let targetPoint = { + x: value, + y: lastClose + }; + + targetPoint = timeLineCoordinateSystem.transformThisPoint(targetPoint); + targetPoint = transformThisPoint(targetPoint, thisObject.container); + + let center = { + x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2, + y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) / 2 + }; + + let displaceVector = { + x: center.x - targetPoint.x, + y: center.y - targetPoint.y + }; + + viewPort.displace(displaceVector); + + return; + } + } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] positionAtDatetime -> err.message = " + err.message); } From 0254926aca189758a90a7d5938feec37b731e520 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Jun 2018 13:04:41 +0200 Subject: [PATCH 115/176] Standarizing Sized --- CandlePanel.js | 38 +++++++++++++++++------------------ VolumePanel.js | 54 +++++++++++++++++++++++++------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index a4af40149..6c013cebd 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -1,7 +1,7 @@  function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { - var currentCandlePanel = { + var thisObject = { onEventRaised: onEventRaised, container: undefined, draw: draw, @@ -11,22 +11,22 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { var container = newContainer(); container.initialize(); - currentCandlePanel.container = container; + thisObject.container = container; container.displacement.containerName = "Current Candle Panel"; container.frame.containerName = "Current Candle Panel"; let currentCandle; - return currentCandlePanel; + return thisObject; function initialize() { - currentCandlePanel.container.frame.width = 250; - currentCandlePanel.container.frame.height = 300; + thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - currentCandlePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentCandlePanel.container.frame.width * 2; - currentCandlePanel.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - currentCandlePanel.container.frame.height; + thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 2; + thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height; } @@ -71,10 +71,10 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { if (currentCandle === undefined) { return; } if (currentCandle.innerCandle === undefined) { return; } - const frameBodyHeight = currentCandlePanel.container.frame.getBodyHeight(); - const frameTitleHeight = currentCandlePanel.container.frame.height - frameBodyHeight; + const frameBodyHeight = thisObject.container.frame.getBodyHeight(); + const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight; - const X_AXIS = currentCandlePanel.container.frame.width / 2; + const X_AXIS = thisObject.container.frame.width / 2; const Y_AXIS = frameTitleHeight + frameBodyHeight / 2; var candlePoint1 = { @@ -181,15 +181,15 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { } - candlePoint1 = currentCandlePanel.container.frame.frameThisPoint(candlePoint1); - candlePoint2 = currentCandlePanel.container.frame.frameThisPoint(candlePoint2); - candlePoint3 = currentCandlePanel.container.frame.frameThisPoint(candlePoint3); - candlePoint4 = currentCandlePanel.container.frame.frameThisPoint(candlePoint4); + candlePoint1 = thisObject.container.frame.frameThisPoint(candlePoint1); + candlePoint2 = thisObject.container.frame.frameThisPoint(candlePoint2); + candlePoint3 = thisObject.container.frame.frameThisPoint(candlePoint3); + candlePoint4 = thisObject.container.frame.frameThisPoint(candlePoint4); - stickPoint1 = currentCandlePanel.container.frame.frameThisPoint(stickPoint1); - stickPoint2 = currentCandlePanel.container.frame.frameThisPoint(stickPoint2); - stickPoint3 = currentCandlePanel.container.frame.frameThisPoint(stickPoint3); - stickPoint4 = currentCandlePanel.container.frame.frameThisPoint(stickPoint4); + stickPoint1 = thisObject.container.frame.frameThisPoint(stickPoint1); + stickPoint2 = thisObject.container.frame.frameThisPoint(stickPoint2); + stickPoint3 = thisObject.container.frame.frameThisPoint(stickPoint3); + stickPoint4 = thisObject.container.frame.frameThisPoint(stickPoint4); @@ -282,7 +282,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { y: y }; - labelPoint = currentCandlePanel.container.frame.frameThisPoint(labelPoint); + labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + opacity + ')'; browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); diff --git a/VolumePanel.js b/VolumePanel.js index 918f76f9f..0f92c7205 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -1,7 +1,7 @@  function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { - var currentVolumePanel = { + var thisObject = { onEventRaised: onEventRaised, container: undefined, draw: draw, @@ -11,22 +11,22 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { var container = newContainer(); container.initialize(); - currentVolumePanel.container = container; + thisObject.container = container; container.displacement.containerName = "Current Volume Panel"; container.frame.containerName = "Current Volume Panel"; let currentVolume; - return currentVolumePanel; + return thisObject; function initialize() { - currentVolumePanel.container.frame.width = 250; - currentVolumePanel.container.frame.height = 300; + thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - currentVolumePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentVolumePanel.container.frame.width; - currentVolumePanel.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - currentVolumePanel.container.frame.height; + thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width; + thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height; } @@ -71,10 +71,10 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { if (currentVolume === undefined) { return; } if (currentVolume.innerVolumeBar === undefined) { return; } - const frameBodyHeight = currentVolumePanel.container.frame.getBodyHeight(); - const frameTitleHeight = currentVolumePanel.container.frame.height - frameBodyHeight; + const frameBodyHeight = thisObject.container.frame.getBodyHeight(); + const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight; - const X_AXIS = currentVolumePanel.container.frame.width / 2; + const X_AXIS = thisObject.container.frame.width / 2; const Y_AXIS_BUY = frameTitleHeight + frameBodyHeight * 0.85; const Y_AXIS_SELL = frameTitleHeight + frameBodyHeight * 0.15; @@ -98,15 +98,15 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { y: Y_AXIS_BUY }; - buyVolumePoint1 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint1); - buyVolumePoint2 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint2); - buyVolumePoint3 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint3); - buyVolumePoint4 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint4); + buyVolumePoint1 = thisObject.container.frame.fitIntoFrame(buyVolumePoint1); + buyVolumePoint2 = thisObject.container.frame.fitIntoFrame(buyVolumePoint2); + buyVolumePoint3 = thisObject.container.frame.fitIntoFrame(buyVolumePoint3); + buyVolumePoint4 = thisObject.container.frame.fitIntoFrame(buyVolumePoint4); - buyVolumePoint1 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint1); - buyVolumePoint2 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint2); - buyVolumePoint3 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint3); - buyVolumePoint4 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint4); + buyVolumePoint1 = thisObject.container.frame.frameThisPoint(buyVolumePoint1); + buyVolumePoint2 = thisObject.container.frame.frameThisPoint(buyVolumePoint2); + buyVolumePoint3 = thisObject.container.frame.frameThisPoint(buyVolumePoint3); + buyVolumePoint4 = thisObject.container.frame.frameThisPoint(buyVolumePoint4); var sellVolumePoint1 = { x: X_AXIS - currentVolume.buyInfo.baseWidth / 2, @@ -128,15 +128,15 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { y: Y_AXIS_SELL }; - sellVolumePoint1 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint1); - sellVolumePoint2 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint2); - sellVolumePoint3 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint3); - sellVolumePoint4 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint4); + sellVolumePoint1 = thisObject.container.frame.fitIntoFrame(sellVolumePoint1); + sellVolumePoint2 = thisObject.container.frame.fitIntoFrame(sellVolumePoint2); + sellVolumePoint3 = thisObject.container.frame.fitIntoFrame(sellVolumePoint3); + sellVolumePoint4 = thisObject.container.frame.fitIntoFrame(sellVolumePoint4); - sellVolumePoint1 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint1); - sellVolumePoint2 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint2); - sellVolumePoint3 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint3); - sellVolumePoint4 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint4); + sellVolumePoint1 = thisObject.container.frame.frameThisPoint(sellVolumePoint1); + sellVolumePoint2 = thisObject.container.frame.frameThisPoint(sellVolumePoint2); + sellVolumePoint3 = thisObject.container.frame.frameThisPoint(sellVolumePoint3); + sellVolumePoint4 = thisObject.container.frame.frameThisPoint(sellVolumePoint4); const OPACITY = '0.40'; @@ -203,7 +203,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { y: y }; - labelPoint = currentVolumePanel.container.frame.frameThisPoint(labelPoint); + labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + opacity + ')'; browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); From 31b5ec2689c84bbf96f2a2f9edce0c119fcce81c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Jun 2018 18:51:40 +0200 Subject: [PATCH 116/176] Asthetics works, comma on thoursands --- CandlePanel.js | 6 ++++-- VolumePanel.js | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 6c013cebd..c4c8ce19c 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -271,10 +271,12 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { let labelPoint; let fontSize = 10; - browserCanvasContext.font = fontSize + 'px Courier New'; + browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY; let label = '' + labelToPrint; - + if (isNaN(label) === false) { + label = Number(label).toLocaleString(); + } let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO; labelPoint = { diff --git a/VolumePanel.js b/VolumePanel.js index 0f92c7205..aae9ecb46 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -192,9 +192,12 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { let labelPoint; let fontSize = 10; - browserCanvasContext.font = fontSize + 'px Courier New'; + browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY; let label = '' + labelToPrint; + if (isNaN(label) === false) { + label = Number(label).toLocaleString(); + } let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO; From bdf647f5066740ea67ca5ff2afe4aa38ee87765a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 8 Jun 2018 00:39:36 +0200 Subject: [PATCH 117/176] Brand Colors Used --- CandlePanel.js | 16 ++++++++-------- Candles.js | 28 ++++++++++++++-------------- VolumePanel.js | 10 +++++----- Volumes.js | 16 ++++++++-------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index c4c8ce19c..ad2a09c78 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -201,7 +201,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { browserCanvasContext.lineTo(stickPoint4.x, stickPoint4.y); browserCanvasContext.closePath(); - browserCanvasContext.fillStyle = 'rgba(54, 54, 54, 1)'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; browserCanvasContext.fill(); browserCanvasContext.lineWidth = 1; @@ -218,13 +218,13 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { const OPACITY = '1'; - if (currentCandle.innerCandle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, ' + OPACITY + ')'; } - if (currentCandle.innerCandle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, ' + OPACITY + ')'; } - if (currentCandle.innerCandle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(27, 7, 105, ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK + ', ' + OPACITY + ')'; } - if (currentCandle.innerCandle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, ' + OPACITY + ')'; } - if (currentCandle.innerCandle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, ' + OPACITY + ')'; } - if (currentCandle.innerCandle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + OPACITY + ')'; } + if (currentCandle.innerCandle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + OPACITY + ')'; } browserCanvasContext.fill(); @@ -286,7 +286,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); - browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + opacity + ')'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'; browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); } diff --git a/Candles.js b/Candles.js index 0c2a4e70e..2529815fc 100644 --- a/Candles.js +++ b/Candles.js @@ -664,7 +664,7 @@ browserCanvasContext.lineTo(stickPoint4.x, stickPoint4.y); browserCanvasContext.closePath(); - browserCanvasContext.fillStyle = 'rgba(54, 54, 54, 1)'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; browserCanvasContext.fill(); if (datetime !== undefined) { @@ -673,14 +673,14 @@ if (dateValue >= candle.begin && dateValue <= candle.end) { - browserCanvasContext.strokeStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time } else { - browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)'; + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; } } else { - browserCanvasContext.strokeStyle = 'rgba(212, 206, 201, 1)'; + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; } browserCanvasContext.lineWidth = 1; @@ -695,9 +695,9 @@ browserCanvasContext.closePath(); - if (candle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 1)'; } - if (candle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 1)'; } - if (candle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(27, 7, 105, 1)'; } + if (candle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 1)'; } + if (candle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 1)'; } + if (candle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } if (datetime !== undefined) { @@ -707,7 +707,7 @@ /* highlight the current candle */ - browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 1)'; // Current candle accroding to time + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time let currentCandle = { bodyWidth: candlePoint2.x - candlePoint1.x, @@ -723,16 +723,16 @@ } else { - if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; } - if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; } - if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; } + if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } + if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } + if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } } } else { - if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 1)'; } - if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 1)'; } - if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(64, 26, 217, 1)'; } + if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } + if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } + if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } } diff --git a/VolumePanel.js b/VolumePanel.js index aae9ecb46..ad2c266e1 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -149,8 +149,8 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { browserCanvasContext.closePath(); - browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, ' + OPACITY + ')'; - browserCanvasContext.fillStyle = 'rgba(64, 217, 26, ' + OPACITY + ')'; + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', ' + OPACITY + ')'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', ' + OPACITY + ')'; browserCanvasContext.fill(); @@ -167,8 +167,8 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { browserCanvasContext.closePath(); - browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, ' + OPACITY + ')'; - browserCanvasContext.fillStyle = 'rgba(219, 18, 18, ' + OPACITY + ')'; + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', ' + OPACITY + ')'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + OPACITY + ')'; browserCanvasContext.fill(); @@ -208,7 +208,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); - browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + opacity + ')'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'; browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); } diff --git a/Volumes.js b/Volumes.js index 83de73609..dc57d7438 100644 --- a/Volumes.js +++ b/Volumes.js @@ -696,21 +696,21 @@ if (dateValue >= volume.begin && dateValue <= volume.end) { - browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current bar accroding to time + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current bar accroding to time } else { - browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 0.40)'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 0.40)'; } } else { - browserCanvasContext.fillStyle = 'rgba(64, 217, 26, 0.40)'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 0.40)'; } browserCanvasContext.fill(); - browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, 0.40)'; + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 0.40)'; browserCanvasContext.lineWidth = 1; browserCanvasContext.stroke(); @@ -730,20 +730,20 @@ if (dateValue >= volume.begin && dateValue <= volume.end) { - browserCanvasContext.fillStyle = 'rgba(255, 233, 31, 0.40)'; // Current volume accroding to time + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current volume accroding to time } else { - browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 0.40)'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 0.40)'; } } else { - browserCanvasContext.fillStyle = 'rgba(219, 18, 18, 0.40)'; + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 0.40)'; } - browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, 0.40)'; + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 0.40)'; browserCanvasContext.fill(); browserCanvasContext.lineWidth = 1; From 764cf4eaae7b000e2fab47474e7e2a97a8c66fac Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 2 Jul 2018 07:02:53 +0200 Subject: [PATCH 118/176] Recalculate Scale function added --- Candles.js | 1 + Volumes.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/Candles.js b/Candles.js index 2529815fc..610ff6e6a 100644 --- a/Candles.js +++ b/Candles.js @@ -17,6 +17,7 @@ setTimePeriod: setTimePeriod, setDatetime: setDatetime, draw: draw, + recalculateScale: recalculateScale, /* Events declared outside the plotter. */ diff --git a/Volumes.js b/Volumes.js index dc57d7438..a2569c9f8 100644 --- a/Volumes.js +++ b/Volumes.js @@ -20,6 +20,7 @@ getContainer: getContainer, setTimePeriod: setTimePeriod, setDatetime: setDatetime, + recalculateScale: recalculateScale, draw: draw }; @@ -93,6 +94,14 @@ } } + function recalculateScale() { + + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + + } + function getContainer(point) { try { From 2b7ae47f066513879eb054aa6f830c33b2dfb585 Mon Sep 17 00:00:00 2001 From: Julian Molina Date: Wed, 5 Dec 2018 14:23:41 +0100 Subject: [PATCH 119/176] Update LICENSE --- LICENSE | 685 ++------------------------------------------------------ 1 file changed, 24 insertions(+), 661 deletions(-) diff --git a/LICENSE b/LICENSE index dbbe35581..10e295746 100644 --- a/LICENSE +++ b/LICENSE @@ -1,661 +1,24 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. +Financial Beings License + +Collective Copyright by the Advanced Algos Community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software including without limitation the rights to use, copy, modify, +merge, publish, distribute and sublicense copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following +conditions: + + 1. Using, copying, modifying, publishing, distributing and sublicensing rights + are restricted to the Advanced Algos Platform, meaning the rights granted can + only be exercised through the Advanced Algos Service. + + 2. The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 2c67c83a09c57aa3a66d35265612e9a321ccb18c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 20 Mar 2019 22:45:27 +0100 Subject: [PATCH 120/176] Tab Button --- CandlePanel.js | 9 +++++++++ VolumePanel.js | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/CandlePanel.js b/CandlePanel.js index ad2a09c78..6434a6bc9 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -17,6 +17,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { container.frame.containerName = "Current Candle Panel"; let currentCandle; + let panelTabButton return thisObject; @@ -28,12 +29,19 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 2; thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height; + panelTabButton = newPanelTabButton() + panelTabButton.parentContainer = thisObject.container + panelTabButton.container.frame.parentFrame = thisObject.container.frame + panelTabButton.initialize() } function getContainer(point) { var container; + container = panelTabButton.getContainer(point) + if (container !== undefined) { return container } + /* First we check if this point is inside this space. */ if (this.container.frame.isThisPointHere(point, true) === true) { @@ -63,6 +71,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { plotCurrentCandleInfo(); + panelTabButton.draw() } diff --git a/VolumePanel.js b/VolumePanel.js index ad2c266e1..d17080c3c 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -17,6 +17,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { container.frame.containerName = "Current Volume Panel"; let currentVolume; + let panelTabButton return thisObject; @@ -28,12 +29,19 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width; thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height; + panelTabButton = newPanelTabButton() + panelTabButton.parentContainer = thisObject.container + panelTabButton.container.frame.parentFrame = thisObject.container.frame + panelTabButton.initialize() } function getContainer(point) { var container; + container = panelTabButton.getContainer(point) + if (container !== undefined) { return container } + /* First we check if this point is inside this space. */ if (this.container.frame.isThisPointHere(point, true) === true) { @@ -63,6 +71,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { plotCurrentVolumeInfo(); + panelTabButton.draw() } From 0af3abbaea507f2fc53a855c1e8a414e35b8c9d5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 22 Mar 2019 17:24:08 +0100 Subject: [PATCH 121/176] Saira Font --- CandlePanel.js | 2 +- VolumePanel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 6434a6bc9..17e04819a 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -280,7 +280,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { let labelPoint; let fontSize = 10; - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY; + browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY + ' Saira'; let label = '' + labelToPrint; if (isNaN(label) === false) { diff --git a/VolumePanel.js b/VolumePanel.js index d17080c3c..1e7214bee 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -201,7 +201,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { let labelPoint; let fontSize = 10; - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY; + browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY + ' Saira'; let label = '' + labelToPrint; if (isNaN(label) === false) { From ef20b075183ac56f1fd580beb2a371b60a65c709 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 26 Mar 2019 10:02:26 +0100 Subject: [PATCH 122/176] Finalize() function implemented --- Candles.js | 30 ++++++++++++++++++++++++++++++ Volumes.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/Candles.js b/Candles.js index 610ff6e6a..90bc96554 100644 --- a/Candles.js +++ b/Candles.js @@ -12,6 +12,7 @@ // Main functions and properties. initialize: initialize, + finalize: finalize, container: undefined, getContainer: getContainer, setTimePeriod: setTimePeriod, @@ -52,6 +53,35 @@ return thisObject; + function finalize() { + try { + + if (INFO_LOG === true) { logger.write("[INFO] finalize -> Entering function."); } + + /* Stop listening to the necesary events. */ + + viewPort.eventHandler.stopListening("Zoom Changed", onZoomChanged); + viewPort.eventHandler.stopListening("Offset Changed", onOffsetChanged); + marketFiles.eventHandler.stopListening("Files Updated", onFilesUpdated); + canvas.eventHandler.stopListening("Drag Finished", onDragFinished); + + /* Destroyd References */ + + marketFiles = undefined; + dailyFiles = undefined; + + datetime = undefined; + timePeriod = undefined; + + marketFile = undefined; + fileCursor = undefined; + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err.message = " + err.message); } + } + } + function initialize(pStorage, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { try { diff --git a/Volumes.js b/Volumes.js index a2569c9f8..512c3d4c7 100644 --- a/Volumes.js +++ b/Volumes.js @@ -16,6 +16,7 @@ // Main functions and properties. initialize: initialize, + finalize: finalize, container: undefined, getContainer: getContainer, setTimePeriod: setTimePeriod, @@ -50,6 +51,35 @@ return thisObject; + function finalize() { + try { + + if (INFO_LOG === true) { logger.write("[INFO] finalize -> Entering function."); } + + /* Stop listening to the necesary events. */ + + viewPort.eventHandler.stopListening("Zoom Changed", onZoomChanged); + viewPort.eventHandler.stopListening("Offset Changed", onOffsetChanged); + marketFiles.eventHandler.stopListening("Files Updated", onFilesUpdated); + canvas.eventHandler.stopListening("Drag Finished", onDragFinished); + + /* Destroyd References */ + + marketFiles = undefined; + dailyFiles = undefined; + + datetime = undefined; + timePeriod = undefined; + + marketFile = undefined; + fileCursor = undefined; + + } catch (err) { + + if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err.message = " + err.message); } + } + } + function initialize(pStorage, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { try { From 01f5bf62ce57b3a093029d4fde2d338a0ceaa389 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 6 Apr 2019 09:49:08 +0200 Subject: [PATCH 123/176] Fixing the scale --- Candles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Candles.js b/Candles.js index 90bc96554..27241b7aa 100644 --- a/Candles.js +++ b/Candles.js @@ -563,7 +563,7 @@ let maxValue = { x: MAX_PLOTABLE_DATE.valueOf(), - y: nextPorwerOf10(getMaxRate()) / 4 // TODO: This 4 is temporary + y: nextPorwerOf10(USDT_BTC_HTH) / 4 // TODO: This 4 is temporary }; From 5753d9465f0ac1d7e9e7ae4086b090ca3e101df6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 11 Apr 2019 00:43:28 +0200 Subject: [PATCH 124/176] User Position Highlight --- CandlePanel.js | 6 ++-- Candles.js | 91 ++++++++++++++++++++------------------------------ VolumePanel.js | 6 ++-- Volumes.js | 68 ++++++++++++++----------------------- 4 files changed, 68 insertions(+), 103 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 17e04819a..c160b95aa 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -44,9 +44,9 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { /* First we check if this point is inside this space. */ - if (this.container.frame.isThisPointHere(point, true) === true) { + if (thisObject.container.frame.isThisPointHere(point, true) === true) { - return this.container; + return thisObject.container; } else { @@ -67,7 +67,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { function draw() { - this.container.frame.draw(false, false, true); + thisObject.container.frame.draw(false, false, true); plotCurrentCandleInfo(); diff --git a/Candles.js b/Candles.js index 27241b7aa..933c184a0 100644 --- a/Candles.js +++ b/Candles.js @@ -32,9 +32,8 @@ /* this is part of the module template */ - let container = newContainer(); // Do not touch this 3 lines, they are just needed. - container.initialize(); - thisObject.container = container; + thisObject.container = newContainer() + thisObject.container.initialize(MODULE_NAME) let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. @@ -64,6 +63,7 @@ viewPort.eventHandler.stopListening("Offset Changed", onOffsetChanged); marketFiles.eventHandler.stopListening("Files Updated", onFilesUpdated); canvas.eventHandler.stopListening("Drag Finished", onDragFinished); + thisObject.container.eventHandler.stopListening('Dimmensions Changed', onContainerDimmensionsChanged) /* Destroyd References */ @@ -118,6 +118,13 @@ recalculate(); + thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', onContainerDimmensionsChanged) + + function onContainerDimmensionsChanged() { + recalculateScale() + recalculate(); + } + callBackFunction(); } catch (err) { @@ -136,9 +143,9 @@ /* First we check if this point is inside this space. */ - if (this.container.frame.isThisPointHere(point) === true) { + if (thisObject.container.frame.isThisPointHere(point) === true) { - return this.container; + return thisObject.container; } else { @@ -348,7 +355,7 @@ if (INTENSIVE_LOG === true) { logger.write("[INFO] draw -> Entering function."); } - this.container.frame.draw(); + thisObject.container.frame.draw(); plotChart(); @@ -605,6 +612,9 @@ if (INTENSIVE_LOG === true) { logger.write("[INFO] plotChart -> Entering function."); } + let userPosition = getUserPosition() + userPositionDate = userPosition.point.x + if (candles.length > 0) { /* Now we calculate and plot the candles */ @@ -698,21 +708,11 @@ browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; browserCanvasContext.fill(); - if (datetime !== undefined) { + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; - let dateValue = datetime.valueOf(); - - if (dateValue >= candle.begin && dateValue <= candle.end) { - - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time - - } else { - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; - } - - } else { - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; - } + if (userPositionDate >= candle.begin && userPositionDate <= candle.end) { + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time + } browserCanvasContext.lineWidth = 1; browserCanvasContext.stroke(); @@ -730,45 +730,28 @@ if (candle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 1)'; } if (candle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } - if (datetime !== undefined) { + if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } + if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } + if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } - let dateValue = datetime.valueOf(); + if (userPositionDate >= candle.begin && userPositionDate <= candle.end) { - if (dateValue >= candle.begin && dateValue <= candle.end) { + /* highlight the current candle */ - /* highlight the current candle */ - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time - - let currentCandle = { - bodyWidth: candlePoint2.x - candlePoint1.x, - bodyHeight: candlePoint3.y - candlePoint2.y, - stickHeight: stickPoint4.y - stickPoint2.y, - stickWidth: stickPoint2.x - stickPoint1.x, - stickStart: candlePoint2.y - stickPoint2.y, - period: timePeriod, - innerCandle: candle - }; - - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); - - } else { - - if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } - if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } - if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } - } - - } else { - - if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } - if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } - if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time + let currentCandle = { + bodyWidth: candlePoint2.x - candlePoint1.x, + bodyHeight: candlePoint3.y - candlePoint2.y, + stickHeight: stickPoint4.y - stickPoint2.y, + stickWidth: stickPoint2.x - stickPoint1.x, + stickStart: candlePoint2.y - stickPoint2.y, + period: timePeriod, + innerCandle: candle + }; + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); } - - - + if ( candlePoint1.x < viewPort.visibleArea.topLeft.x + 50 || diff --git a/VolumePanel.js b/VolumePanel.js index 1e7214bee..e09f06871 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -44,9 +44,9 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { /* First we check if this point is inside this space. */ - if (this.container.frame.isThisPointHere(point, true) === true) { + if (thisObject.container.frame.isThisPointHere(point, true) === true) { - return this.container; + return thisObject.container; } else { @@ -67,7 +67,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { function draw() { - this.container.frame.draw(false, false, true); + thisObject.container.frame.draw(false, false, true); plotCurrentVolumeInfo(); diff --git a/Volumes.js b/Volumes.js index 512c3d4c7..810a2b154 100644 --- a/Volumes.js +++ b/Volumes.js @@ -27,9 +27,8 @@ /* this is part of the module template */ - let container = newContainer(); // Do not touch this 3 lines, they are just needed. - container.initialize(); - thisObject.container = container; + thisObject.container = newContainer() + thisObject.container.initialize(MODULE_NAME) let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. let plotAreaFrame = newTimeLineCoordinateSystem(); // This chart uses this extra object. @@ -62,6 +61,7 @@ viewPort.eventHandler.stopListening("Offset Changed", onOffsetChanged); marketFiles.eventHandler.stopListening("Files Updated", onFilesUpdated); canvas.eventHandler.stopListening("Drag Finished", onDragFinished); + thisObject.container.eventHandler.stopListening('Dimmensions Changed', onContainerDimmensionsChanged) /* Destroyd References */ @@ -116,6 +116,14 @@ recalculate(); recalculateScaleY(); + thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', onContainerDimmensionsChanged) + + function onContainerDimmensionsChanged() { + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + } + callBackFunction(); } catch (err) { @@ -142,9 +150,9 @@ /* First we check if this point is inside this space. */ - if (this.container.frame.isThisPointHere(point) === true) { + if (thisObject.container.frame.isThisPointHere(point) === true) { - return this.container; + return thisObject.container; } else { @@ -257,7 +265,7 @@ if (INTENSIVE_LOG === true) { logger.write("[INFO] draw -> Entering function."); } - this.container.frame.draw(); + thisObject.container.frame.draw(); plotChart(); @@ -522,6 +530,9 @@ if (INTENSIVE_LOG === true) { logger.write("[INFO] plotChart -> Entering function."); } + let userPosition = getUserPosition() + userPositionDate = userPosition.point.x + if (volumes.length > 0) { /* Now we calculate and plot the volumes */ @@ -728,25 +739,11 @@ browserCanvasContext.closePath(); + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 0.40)'; - if (datetime !== undefined) { - - let dateValue = datetime.valueOf(); - - if (dateValue >= volume.begin && dateValue <= volume.end) { - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current bar accroding to time - - } else { - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 0.40)'; - } - - } else { - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 0.40)'; - - } + if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current bar accroding to time + } browserCanvasContext.fill(); browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 0.40)'; @@ -763,24 +760,11 @@ browserCanvasContext.closePath(); - if (datetime !== undefined) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 0.40)'; - let dateValue = datetime.valueOf(); - - if (dateValue >= volume.begin && dateValue <= volume.end) { - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current volume accroding to time - - } else { - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 0.40)'; - } - - } else { - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 0.40)'; - - } + if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current volume accroding to time + } browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 0.40)'; @@ -788,8 +772,6 @@ browserCanvasContext.lineWidth = 1; browserCanvasContext.stroke(); - - if (datetime !== undefined) { let dateValue = datetime.valueOf(); From b49d11ba543c26b19c30fa2093f8cbf2b8e1f24e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 11 Apr 2019 13:56:21 +0200 Subject: [PATCH 125/176] Adapted to new version of Canvas App --- Candles.js | 44 +++++++++++++--------------- Volumes.js | 86 +++++++++++++++++++++++++----------------------------- 2 files changed, 59 insertions(+), 71 deletions(-) diff --git a/Candles.js b/Candles.js index 933c184a0..314adac59 100644 --- a/Candles.js +++ b/Candles.js @@ -63,7 +63,7 @@ viewPort.eventHandler.stopListening("Offset Changed", onOffsetChanged); marketFiles.eventHandler.stopListening("Files Updated", onFilesUpdated); canvas.eventHandler.stopListening("Drag Finished", onDragFinished); - thisObject.container.eventHandler.stopListening('Dimmensions Changed', onContainerDimmensionsChanged) + thisObject.container.eventHandler.stopListening('Dimmensions Changed') /* Destroyd References */ @@ -78,7 +78,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err = " + err.stack); } } } @@ -118,18 +118,16 @@ recalculate(); - thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', onContainerDimmensionsChanged) - - function onContainerDimmensionsChanged() { + thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { recalculateScale() recalculate(); - } + }) callBackFunction(); } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> err = " + err.stack); } } } @@ -156,7 +154,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] getContainer -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] getContainer -> err = " + err.stack); } } } @@ -176,7 +174,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onFilesUpdated -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onFilesUpdated -> err = " + err.stack); } } } @@ -214,7 +212,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] setTimePeriod -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] setTimePeriod -> err = " + err.stack); } } } @@ -325,7 +323,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] positionAtDatetime -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] positionAtDatetime -> err = " + err.stack); } } } @@ -345,7 +343,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFileLoaded -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFileLoaded -> err = " + err.stack); } } } @@ -361,7 +359,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] draw -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] draw -> err = " + err.stack); } } } @@ -385,7 +383,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculate -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculate -> err = " + err.stack); } } } @@ -483,7 +481,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingDailyFiles -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingDailyFiles -> err = " + err.stack); } } } @@ -549,7 +547,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingMarketFiles -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingMarketFiles -> err = " + err.stack); } } } @@ -602,7 +600,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> err = " + err.stack); } } } @@ -610,10 +608,8 @@ try { - if (INTENSIVE_LOG === true) { logger.write("[INFO] plotChart -> Entering function."); } - let userPosition = getUserPosition() - userPositionDate = userPosition.point.x + let userPositionDate = userPosition.point.x if (candles.length > 0) { @@ -771,7 +767,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] plotChart -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] plotChart -> err = " + err.stack); } } } @@ -785,7 +781,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onZoomChanged -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onZoomChanged -> err = " + err.stack); } } } @@ -802,7 +798,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onOffsetChanged -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onOffsetChanged -> err = " + err.stack); } } } @@ -816,7 +812,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onDragFinished -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onDragFinished -> err = " + err.stack); } } } } diff --git a/Volumes.js b/Volumes.js index 810a2b154..059afac29 100644 --- a/Volumes.js +++ b/Volumes.js @@ -61,7 +61,7 @@ viewPort.eventHandler.stopListening("Offset Changed", onOffsetChanged); marketFiles.eventHandler.stopListening("Files Updated", onFilesUpdated); canvas.eventHandler.stopListening("Drag Finished", onDragFinished); - thisObject.container.eventHandler.stopListening('Dimmensions Changed', onContainerDimmensionsChanged) + thisObject.container.eventHandler.stopListening('Dimmensions Changed') /* Destroyd References */ @@ -76,7 +76,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err = " + err.stack); } } } @@ -116,19 +116,17 @@ recalculate(); recalculateScaleY(); - thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', onContainerDimmensionsChanged) - - function onContainerDimmensionsChanged() { + thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { recalculateScaleX(); recalculate(); recalculateScaleY(); - } + }) callBackFunction(); } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] initialize -> err = " + err.stack); } } } @@ -163,7 +161,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] getContainer -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] getContainer -> err = " + err.stack); } } } @@ -187,7 +185,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onFilesUpdated -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onFilesUpdated -> err = " + err.stack); } } } @@ -225,7 +223,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] setTimePeriod -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] setTimePeriod -> err = " + err.stack); } } } @@ -255,7 +253,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFileLoaded -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFileLoaded -> err = " + err.stack); } } } @@ -271,7 +269,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] draw -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] draw -> err = " + err.stack); } } } @@ -295,7 +293,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculate -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculate -> err = " + err.stack); } } } @@ -380,7 +378,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingDailyFiles -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingDailyFiles -> err = " + err.stack); } } } @@ -433,7 +431,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingMarketFiles -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingMarketFiles -> err = " + err.stack); } } } @@ -465,7 +463,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScaleX -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScaleX -> err = " + err.stack); } } } @@ -520,7 +518,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScaleY -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScaleY -> err = " + err.stack); } } } @@ -528,10 +526,8 @@ try { - if (INTENSIVE_LOG === true) { logger.write("[INFO] plotChart -> Entering function."); } - let userPosition = getUserPosition() - userPositionDate = userPosition.point.x + let userPositionDate = userPosition.point.x if (volumes.length > 0) { @@ -772,42 +768,38 @@ browserCanvasContext.lineWidth = 1; browserCanvasContext.stroke(); - if (datetime !== undefined) { + if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { - let dateValue = datetime.valueOf(); + let buyInfo = { + baseWidth: volumePointA4.x - volumePointA1.x, + topWidth: volumePointA3.x - volumePointA2.x, + height: volumePointA2.y - volumePointA1.y + }; - if (dateValue >= volume.begin && dateValue <= volume.end) { + let sellInfo = { + baseWidth: volumePointB4.x - volumePointB1.x, + topWidth: volumePointB3.x - volumePointB2.x, + height: volumePointB2.y - volumePointB1.y + }; - let buyInfo = { - baseWidth: volumePointA4.x - volumePointA1.x, - topWidth: volumePointA3.x - volumePointA2.x, - height: volumePointA2.y - volumePointA1.y - }; + let currentVolume = { + buyInfo: buyInfo, + sellInfo: sellInfo, + period: timePeriod, + innerVolumeBar: volume + }; - let sellInfo = { - baseWidth: volumePointB4.x - volumePointB1.x, - topWidth: volumePointB3.x - volumePointB2.x, - height: volumePointB2.y - volumePointB1.y - }; + thisObject.container.eventHandler.raiseEvent("Current Volume Changed", currentVolume); - let currentVolume = { - buyInfo: buyInfo, - sellInfo: sellInfo, - period: timePeriod, - innerVolumeBar: volume - }; - - thisObject.container.eventHandler.raiseEvent("Current Volume Changed", currentVolume); - - } } + } } } } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] plotChart -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] plotChart -> err = " + err.stack); } } } @@ -823,7 +815,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onZoomChanged -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onZoomChanged -> err = " + err.stack); } } } @@ -843,7 +835,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onOffsetChanged -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onOffsetChanged -> err = " + err.stack); } } } @@ -859,7 +851,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onDragFinished -> err.message = " + err.message); } + if (ERROR_LOG === true) { logger.write("[ERROR] onDragFinished -> err = " + err.stack); } } } } From 807131d5a3367d5745b631549e1466e6dbd8f109 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 17 Apr 2019 20:40:26 +0200 Subject: [PATCH 126/176] Variable Name Standarization --- Candles.js | 2 +- Volumes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Candles.js b/Candles.js index 314adac59..04611d98b 100644 --- a/Candles.js +++ b/Candles.js @@ -562,7 +562,7 @@ if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated. let minValue = { - x: EARLIEST_DATE.valueOf(), + x: MIN_PLOTABLE_DATE.valueOf(), y: 0 }; diff --git a/Volumes.js b/Volumes.js index 059afac29..b78c8bf67 100644 --- a/Volumes.js +++ b/Volumes.js @@ -442,7 +442,7 @@ if (INFO_LOG === true) { logger.write("[INFO] recalculateScaleX -> Entering function."); } var minValue = { - x: EARLIEST_DATE.valueOf() + x: MIN_PLOTABLE_DATE.valueOf() }; var maxValue = { From cdf44c135a6c1f200a304f9096cf6b492da07a12 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 24 Apr 2019 20:37:30 +0200 Subject: [PATCH 127/176] EventHandling Improved --- Candles.js | 26 ++++++++++++++++---------- Volumes.js | 26 ++++++++++++++++---------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/Candles.js b/Candles.js index 04611d98b..d953531f5 100644 --- a/Candles.js +++ b/Candles.js @@ -50,6 +50,12 @@ let candles = []; // Here we keep the candles to be ploted every time the Draw() function is called by the AAWebPlatform. + let zoomChangedEventSubscriptionId + let offsetChangedEventSubscriptionId + let filesUpdatedEventSubscriptionId + let dragFinishedEventSubscriptionId + let dimmensionsChangedEventSubscriptionId + return thisObject; function finalize() { @@ -59,11 +65,11 @@ /* Stop listening to the necesary events. */ - viewPort.eventHandler.stopListening("Zoom Changed", onZoomChanged); - viewPort.eventHandler.stopListening("Offset Changed", onOffsetChanged); - marketFiles.eventHandler.stopListening("Files Updated", onFilesUpdated); - canvas.eventHandler.stopListening("Drag Finished", onDragFinished); - thisObject.container.eventHandler.stopListening('Dimmensions Changed') + viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId); + viewPort.eventHandler.stopListening(offsetChangedEventSubscriptionId); + marketFiles.eventHandler.stopListening(filesUpdatedEventSubscriptionId); + canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); + thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) /* Destroyd References */ @@ -109,16 +115,16 @@ /* Listen to the necesary events. */ - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); - marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); + filesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); + dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); /* Get ready for plotting. */ recalculate(); - thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { + dimmensionsChangedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { recalculateScale() recalculate(); }) diff --git a/Volumes.js b/Volumes.js index b78c8bf67..4fb1fddcb 100644 --- a/Volumes.js +++ b/Volumes.js @@ -48,6 +48,12 @@ let volumes = []; // Here we keep the volumes to be ploted every time the Draw() function is called by the AAWebPlatform. + let zoomChangedEventSubscriptionId + let offsetChangedEventSubscriptionId + let filesUpdatedEventSubscriptionId + let dragFinishedEventSubscriptionId + let dimmensionsChangedEventSubscriptionId + return thisObject; function finalize() { @@ -57,11 +63,11 @@ /* Stop listening to the necesary events. */ - viewPort.eventHandler.stopListening("Zoom Changed", onZoomChanged); - viewPort.eventHandler.stopListening("Offset Changed", onOffsetChanged); - marketFiles.eventHandler.stopListening("Files Updated", onFilesUpdated); - canvas.eventHandler.stopListening("Drag Finished", onDragFinished); - thisObject.container.eventHandler.stopListening('Dimmensions Changed') + viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId); + viewPort.eventHandler.stopListening(offsetChangedEventSubscriptionId); + marketFiles.eventHandler.stopListening(filesUpdatedEventSubscriptionId); + canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); + thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) /* Destroyd References */ @@ -105,10 +111,10 @@ /* Listen to the necesary events. */ - viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); - marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); - canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); + offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); + filesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); + dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); /* Get ready for plotting. */ @@ -116,7 +122,7 @@ recalculate(); recalculateScaleY(); - thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { + dimmensionsChangedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { recalculateScaleX(); recalculate(); recalculateScaleY(); From 7a1032c51fcb3bfce23cf71e5c9c3731af0af24d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 28 Apr 2019 08:16:33 +0200 Subject: [PATCH 128/176] Removing INFO LOG and fixing BUG when scaling --- Candles.js | 52 ---------------------------------------------------- Volumes.js | 33 --------------------------------- 2 files changed, 85 deletions(-) diff --git a/Candles.js b/Candles.js index d953531f5..b9732c8ed 100644 --- a/Candles.js +++ b/Candles.js @@ -1,7 +1,6 @@ function newAAMastersPlottersCandlesVolumesCandles() { const MODULE_NAME = "Candles Plotter"; - const INFO_LOG = false; const ERROR_LOG = true; const INTENSIVE_LOG = false; const logger = newWebDebugLog(); @@ -61,8 +60,6 @@ function finalize() { try { - if (INFO_LOG === true) { logger.write("[INFO] finalize -> Entering function."); } - /* Stop listening to the necesary events. */ viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId); @@ -92,8 +89,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } - /* Store the information received. */ marketFiles = pStorage.marketFiles[0]; @@ -141,8 +136,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); } - let container; /* First we check if this point is inside this space. */ @@ -168,8 +161,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onFilesUpdated -> Entering function."); } - let newMarketFile = marketFiles.getFile(timePeriod); if (newMarketFile !== undefined) { @@ -188,8 +179,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); } - if (timePeriod !== pTimePeriod) { timePeriod = pTimePeriod; @@ -224,8 +213,6 @@ function setDatetime(pDatetime) { - if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); } - datetime = pDatetime; } @@ -234,8 +221,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] positionAtDatetime -> Entering function."); } - value = newDatetime.valueOf(); /* Now we calculate which candle has this new time, because it will give us the y coordinate. */ @@ -337,8 +322,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onDailyFileLoaded -> Entering function."); } - if (event.currentValue === event.totalValue) { /* This happens only when all of the files in the cursor have been loaded. */ @@ -373,8 +356,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); } - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { recalculateUsingMarketFiles(); @@ -397,8 +378,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingDailyFiles -> Entering function."); } - if (fileCursor === undefined) { return; } // We need to wait if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor @@ -495,8 +474,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingMarketFiles -> Entering function."); } - if (marketFile === undefined) { return; } // Initialization not complete yet. let daysOnSides = getSideDays(timePeriod); @@ -561,10 +538,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); } - - if (marketFile === undefined) { return; } // We need the market file to be loaded to make the calculation. - if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated. let minValue = { @@ -585,25 +558,6 @@ thisObject.container.frame.height ); - function getMaxRate() { - - if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> getMaxRate -> Entering function."); } - - let maxValue = 0; - - for (let i = 0; i < marketFile.length; i++) { - - let currentMax = marketFile[i][1]; // 1 = rates. - - if (maxValue < currentMax) { - maxValue = currentMax; - } - } - - return maxValue; - - } - } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> err = " + err.stack); } @@ -781,8 +735,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onZoomChanged -> Entering function."); } - recalculate(); } catch (err) { @@ -795,8 +747,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onOffsetChanged -> Entering function."); } - if (Math.random() * 100 > 95) { recalculate() @@ -812,8 +762,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onDragFinished -> Entering function."); } - recalculate(); } catch (err) { diff --git a/Volumes.js b/Volumes.js index 4fb1fddcb..bf4e52bee 100644 --- a/Volumes.js +++ b/Volumes.js @@ -1,7 +1,6 @@ function newAAMastersPlottersCandlesVolumesVolumes() { const MODULE_NAME = "Volumes Plotter"; - const INFO_LOG = false; const ERROR_LOG = true; const INTENSIVE_LOG = false; const logger = newWebDebugLog(); @@ -59,8 +58,6 @@ function finalize() { try { - if (INFO_LOG === true) { logger.write("[INFO] finalize -> Entering function."); } - /* Stop listening to the necesary events. */ viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId); @@ -90,8 +87,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } - /* Store the information received. */ marketFiles = pStorage.marketFiles[0]; @@ -148,8 +143,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); } - let container; /* First we check if this point is inside this space. */ @@ -175,8 +168,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onFilesUpdated -> Entering function."); } - let newMarketFile = marketFiles.getFile(timePeriod); if (newMarketFile !== undefined) { @@ -199,8 +190,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); } - if (timePeriod !== pTimePeriod) { timePeriod = pTimePeriod; @@ -235,8 +224,6 @@ function setDatetime(pDatetime) { - if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); } - datetime = pDatetime; } @@ -245,8 +232,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onDailyFileLoaded -> Entering function."); } - if (event.currentValue === event.totalValue) { /* This happens only when all of the files in the cursor have been loaded. */ @@ -283,8 +268,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); } - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { recalculateUsingMarketFiles(); @@ -307,8 +290,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingDailyFiles -> Entering function."); } - if (fileCursor === undefined) { return; } // We need to wait if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor @@ -392,8 +373,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingMarketFiles -> Entering function."); } - if (marketFile === undefined) { return; } // Initialization not complete yet. let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); @@ -445,8 +424,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculateScaleX -> Entering function."); } - var minValue = { x: MIN_PLOTABLE_DATE.valueOf() }; @@ -477,8 +454,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] recalculateScaleY -> Entering function."); } - var minValue = { y: 0 }; @@ -505,8 +480,6 @@ function getMaxVolume() { - if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); } - let maxValue = 0; for (var i = 0; i < scaleFile.length; i++) { @@ -813,8 +786,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onZoomChanged -> Entering function."); } - recalculateScaleX(); recalculate(); recalculateScaleY(); @@ -829,8 +800,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onOffsetChanged -> Entering function."); } - if (Math.random() * 100 > 95) { recalculateScaleX(); @@ -849,8 +818,6 @@ try { - if (INFO_LOG === true) { logger.write("[INFO] onDragFinished -> Entering function."); } - recalculateScaleX(); recalculate(); recalculateScaleY(); From 36115c63b5a5408017d240e38f61ad8c623ffd3d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 10 May 2019 20:53:26 +0200 Subject: [PATCH 129/176] fitFunction IMplemented --- CandlePanel.js | 58 ++++++++++++++++++++++++++++++-------------------- VolumePanel.js | 56 +++++++++++++++++++++++++++++------------------- Volumes.js | 12 +++++------ 3 files changed, 75 insertions(+), 51 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index c160b95aa..5da958ce6 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -1,15 +1,16 @@  function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { - var thisObject = { - onEventRaised: onEventRaised, + let thisObject = { + fitFunction: undefined, container: undefined, + onEventRaised: onEventRaised, draw: draw, getContainer: getContainer, initialize: initialize }; - var container = newContainer(); + let container = newContainer(); container.initialize(); thisObject.container = container; @@ -32,29 +33,30 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { panelTabButton = newPanelTabButton() panelTabButton.parentContainer = thisObject.container panelTabButton.container.frame.parentFrame = thisObject.container.frame + panelTabButton.fitFunction = thisObject.fitFunction panelTabButton.initialize() } function getContainer(point) { - var container; + let container; container = panelTabButton.getContainer(point) if (container !== undefined) { return container } - /* First we check if this point is inside this space. */ - if (thisObject.container.frame.isThisPointHere(point, true) === true) { - return thisObject.container; + let checkPoint = { + x: point.x, + y: point.y + } - } else { - - /* This point does not belong to this space. */ - - return undefined; - } + checkPoint = thisObject.fitFunction(checkPoint) + if (point.x === checkPoint.x && point.y === checkPoint.y) { + return thisObject.container; + } + } } @@ -67,11 +69,12 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { function draw() { - thisObject.container.frame.draw(false, false, true); + thisObject.container.frame.draw(false, false, true, thisObject.fitFunction); plotCurrentCandleInfo(); panelTabButton.draw() + } @@ -86,43 +89,43 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { const X_AXIS = thisObject.container.frame.width / 2; const Y_AXIS = frameTitleHeight + frameBodyHeight / 2; - var candlePoint1 = { + let candlePoint1 = { x: X_AXIS - currentCandle.bodyWidth / 2, y: Y_AXIS - currentCandle.bodyHeight / 2 }; - var candlePoint2 = { + let candlePoint2 = { x: X_AXIS + currentCandle.bodyWidth / 2, y: Y_AXIS - currentCandle.bodyHeight / 2 }; - var candlePoint3 = { + let candlePoint3 = { x: X_AXIS + currentCandle.bodyWidth / 2, y: Y_AXIS + currentCandle.bodyHeight / 2 }; - var candlePoint4 = { + let candlePoint4 = { x: X_AXIS - currentCandle.bodyWidth / 2, y: Y_AXIS + currentCandle.bodyHeight / 2 }; - var stickPoint1 = { + let stickPoint1 = { x: X_AXIS - currentCandle.stickWidth / 2, y: candlePoint1.y - currentCandle.stickStart }; - var stickPoint2 = { + let stickPoint2 = { x: X_AXIS + currentCandle.stickWidth / 2, y: candlePoint1.y - currentCandle.stickStart }; - var stickPoint3 = { + let stickPoint3 = { x: X_AXIS + currentCandle.stickWidth / 2, y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight }; - var stickPoint4 = { + let stickPoint4 = { x: X_AXIS - currentCandle.stickWidth / 2, y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight }; @@ -195,12 +198,20 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { candlePoint3 = thisObject.container.frame.frameThisPoint(candlePoint3); candlePoint4 = thisObject.container.frame.frameThisPoint(candlePoint4); + candlePoint1 = thisObject.fitFunction(candlePoint1) + candlePoint2 = thisObject.fitFunction(candlePoint2) + candlePoint3 = thisObject.fitFunction(candlePoint3) + candlePoint4 = thisObject.fitFunction(candlePoint4) + stickPoint1 = thisObject.container.frame.frameThisPoint(stickPoint1); stickPoint2 = thisObject.container.frame.frameThisPoint(stickPoint2); stickPoint3 = thisObject.container.frame.frameThisPoint(stickPoint3); stickPoint4 = thisObject.container.frame.frameThisPoint(stickPoint4); - + stickPoint1 = thisObject.fitFunction(stickPoint1) + stickPoint2 = thisObject.fitFunction(stickPoint2) + stickPoint3 = thisObject.fitFunction(stickPoint3) + stickPoint4 = thisObject.fitFunction(stickPoint4) browserCanvasContext.beginPath(); @@ -294,6 +305,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { }; labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); + labelPoint = thisObject.fitFunction(labelPoint) browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'; browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); diff --git a/VolumePanel.js b/VolumePanel.js index e09f06871..4ce49bbd2 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -1,15 +1,16 @@  function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { - var thisObject = { - onEventRaised: onEventRaised, + let thisObject = { + fitFunction: undefined, container: undefined, + onEventRaised: onEventRaised, draw: draw, getContainer: getContainer, initialize: initialize }; - var container = newContainer(); + let container = newContainer(); container.initialize(); thisObject.container = container; @@ -32,29 +33,30 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { panelTabButton = newPanelTabButton() panelTabButton.parentContainer = thisObject.container panelTabButton.container.frame.parentFrame = thisObject.container.frame + panelTabButton.fitFunction = thisObject.fitFunction panelTabButton.initialize() } function getContainer(point) { - var container; + let container; container = panelTabButton.getContainer(point) if (container !== undefined) { return container } - /* First we check if this point is inside this space. */ - if (thisObject.container.frame.isThisPointHere(point, true) === true) { - return thisObject.container; + let checkPoint = { + x: point.x, + y: point.y + } - } else { + checkPoint = thisObject.fitFunction(checkPoint) - /* This point does not belong to this space. */ - - return undefined; + if (point.x === checkPoint.x && point.y === checkPoint.y) { + return thisObject.container; + } } - } @@ -67,14 +69,13 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { function draw() { - thisObject.container.frame.draw(false, false, true); + thisObject.container.frame.draw(false, false, true, thisObject.fitFunction); plotCurrentVolumeInfo(); panelTabButton.draw() } - function plotCurrentVolumeInfo() { if (currentVolume === undefined) { return; } @@ -87,22 +88,22 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { const Y_AXIS_BUY = frameTitleHeight + frameBodyHeight * 0.85; const Y_AXIS_SELL = frameTitleHeight + frameBodyHeight * 0.15; - var buyVolumePoint1 = { + let buyVolumePoint1 = { x: X_AXIS - currentVolume.buyInfo.baseWidth / 2, y: Y_AXIS_BUY }; - var buyVolumePoint2 = { + let buyVolumePoint2 = { x: X_AXIS - currentVolume.buyInfo.topWidth / 2, y: Y_AXIS_BUY + currentVolume.buyInfo.height }; - var buyVolumePoint3 = { + let buyVolumePoint3 = { x: X_AXIS + currentVolume.buyInfo.topWidth / 2, y: Y_AXIS_BUY + currentVolume.buyInfo.height }; - var buyVolumePoint4 = { + let buyVolumePoint4 = { x: X_AXIS + currentVolume.buyInfo.baseWidth / 2, y: Y_AXIS_BUY }; @@ -117,22 +118,27 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { buyVolumePoint3 = thisObject.container.frame.frameThisPoint(buyVolumePoint3); buyVolumePoint4 = thisObject.container.frame.frameThisPoint(buyVolumePoint4); - var sellVolumePoint1 = { + buyVolumePoint1 = thisObject.fitFunction(buyVolumePoint1) + buyVolumePoint2 = thisObject.fitFunction(buyVolumePoint2) + buyVolumePoint3 = thisObject.fitFunction(buyVolumePoint3) + buyVolumePoint4 = thisObject.fitFunction(buyVolumePoint4) + + let sellVolumePoint1 = { x: X_AXIS - currentVolume.buyInfo.baseWidth / 2, y: Y_AXIS_SELL }; - var sellVolumePoint2 = { + let sellVolumePoint2 = { x: X_AXIS - currentVolume.buyInfo.topWidth / 2, y: Y_AXIS_SELL + currentVolume.sellInfo.height }; - var sellVolumePoint3 = { + let sellVolumePoint3 = { x: X_AXIS + currentVolume.buyInfo.topWidth / 2, y: Y_AXIS_SELL + currentVolume.sellInfo.height }; - var sellVolumePoint4 = { + let sellVolumePoint4 = { x: X_AXIS + currentVolume.buyInfo.baseWidth / 2, y: Y_AXIS_SELL }; @@ -147,6 +153,11 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { sellVolumePoint3 = thisObject.container.frame.frameThisPoint(sellVolumePoint3); sellVolumePoint4 = thisObject.container.frame.frameThisPoint(sellVolumePoint4); + sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1) + sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1) + sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1) + sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1) + const OPACITY = '0.40'; browserCanvasContext.beginPath(); @@ -216,6 +227,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { }; labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); + labelPoint = thisObject.fitFunction(labelPoint) browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'; browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); diff --git a/Volumes.js b/Volumes.js index bf4e52bee..a91dc0407 100644 --- a/Volumes.js +++ b/Volumes.js @@ -424,11 +424,11 @@ try { - var minValue = { + let minValue = { x: MIN_PLOTABLE_DATE.valueOf() }; - var maxValue = { + let maxValue = { x: MAX_PLOTABLE_DATE.valueOf() }; @@ -454,11 +454,11 @@ try { - var minValue = { + let minValue = { y: 0 }; - var maxValue = { + let maxValue = { y: 0 }; @@ -482,7 +482,7 @@ let maxValue = 0; - for (var i = 0; i < scaleFile.length; i++) { + for (let i = 0; i < scaleFile.length; i++) { let currentMax = (scaleFile[i][0] + scaleFile[i][1]) * 4; @@ -534,7 +534,7 @@ if (volumes.length > 0) { - for (var i = 0; i < volumes.length; i++) { + for (let i = 0; i < volumes.length; i++) { volume = volumes[i]; From 7cbbab5542eda87ee79cd28eedf1e07a3b0fc04a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 12 May 2019 09:48:58 +0200 Subject: [PATCH 130/176] Title change --- CandlePanel.js | 4 ++-- VolumePanel.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 5da958ce6..b54dfed63 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -14,8 +14,8 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { container.initialize(); thisObject.container = container; - container.displacement.containerName = "Current Candle Panel"; - container.frame.containerName = "Current Candle Panel"; + container.displacement.containerName = "Candle"; + container.frame.containerName = "Candle"; let currentCandle; let panelTabButton diff --git a/VolumePanel.js b/VolumePanel.js index 4ce49bbd2..9f0aa3466 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -14,8 +14,8 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { container.initialize(); thisObject.container = container; - container.displacement.containerName = "Current Volume Panel"; - container.frame.containerName = "Current Volume Panel"; + container.displacement.containerName = "Volume"; + container.frame.containerName = "Volumel"; let currentVolume; let panelTabButton From ab204701effe71c9a004dc3312ad89b812fe582a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 12 May 2019 10:12:19 +0200 Subject: [PATCH 131/176] FIX fitfunction --- VolumePanel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/VolumePanel.js b/VolumePanel.js index 9f0aa3466..d0ce5dc4e 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -15,7 +15,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.container = container; container.displacement.containerName = "Volume"; - container.frame.containerName = "Volumel"; + container.frame.containerName = "Volume"; let currentVolume; let panelTabButton @@ -154,9 +154,9 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { sellVolumePoint4 = thisObject.container.frame.frameThisPoint(sellVolumePoint4); sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1) - sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1) - sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1) - sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1) + sellVolumePoint2 = thisObject.fitFunction(sellVolumePoint2) + sellVolumePoint3 = thisObject.fitFunction(sellVolumePoint3) + sellVolumePoint4 = thisObject.fitFunction(sellVolumePoint4) const OPACITY = '0.40'; From 1ee01953578e5d4ed7ae3c35c27398cf35bfd849 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 27 Jun 2019 20:03:31 +0200 Subject: [PATCH 132/176] formatting --- Candles.js | 13 ++++++++----- Volumes.js | 11 +++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Candles.js b/Candles.js index b9732c8ed..c5fef30d0 100644 --- a/Candles.js +++ b/Candles.js @@ -17,11 +17,11 @@ setTimePeriod: setTimePeriod, setDatetime: setDatetime, draw: draw, - recalculateScale: recalculateScale, + recalculateScale: recalculateScale, /* Events declared outside the plotter. */ - onDailyFileLoaded: onDailyFileLoaded, + onDailyFileLoaded: onDailyFileLoaded, // Secondary functions and properties. @@ -226,7 +226,7 @@ /* Now we calculate which candle has this new time, because it will give us the y coordinate. */ let candleFound = false; - let lastClose; + let lastClose; for (let i = 0; i < candles.length; i++) { @@ -668,9 +668,10 @@ if (userPositionDate >= candle.begin && userPositionDate <= candle.end) { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time - } + } browserCanvasContext.lineWidth = 1; + browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); browserCanvasContext.beginPath(); @@ -707,7 +708,7 @@ }; thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); } - + if ( candlePoint1.x < viewPort.visibleArea.topLeft.x + 50 || @@ -719,6 +720,7 @@ } browserCanvasContext.lineWidth = 1; + browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); @@ -771,3 +773,4 @@ } } + diff --git a/Volumes.js b/Volumes.js index a91dc0407..7420a8c8d 100644 --- a/Volumes.js +++ b/Volumes.js @@ -10,7 +10,7 @@ /* Events declared outside the plotter. */ - onDailyFileLoaded: onDailyFileLoaded, + onDailyFileLoaded: onDailyFileLoaded, // Main functions and properties. @@ -20,7 +20,7 @@ getContainer: getContainer, setTimePeriod: setTimePeriod, setDatetime: setDatetime, - recalculateScale: recalculateScale, + recalculateScale: recalculateScale, draw: draw }; @@ -718,11 +718,12 @@ if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current bar accroding to time - } + } browserCanvasContext.fill(); browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 0.40)'; browserCanvasContext.lineWidth = 1; + browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); @@ -739,12 +740,13 @@ if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current volume accroding to time - } + } browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 0.40)'; browserCanvasContext.fill(); browserCanvasContext.lineWidth = 1; + browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { @@ -829,3 +831,4 @@ } } + From f2254b9a21eeaa8efa559305f64cc681bc26ebf1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 15 Jul 2019 10:01:49 +0200 Subject: [PATCH 133/176] Min Max --- CandlePanel.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index b54dfed63..ed95d06ce 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -56,7 +56,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { if (point.x === checkPoint.x && point.y === checkPoint.y) { return thisObject.container; } - } + } } @@ -88,10 +88,10 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { const X_AXIS = thisObject.container.frame.width / 2; const Y_AXIS = frameTitleHeight + frameBodyHeight / 2; - + let candlePoint1 = { x: X_AXIS - currentCandle.bodyWidth / 2, - y: Y_AXIS - currentCandle.bodyHeight / 2 + y: Y_AXIS - currentCandle.bodyHeight / 2 }; let candlePoint2 = { @@ -106,7 +106,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { let candlePoint4 = { x: X_AXIS - currentCandle.bodyWidth / 2, - y: Y_AXIS + currentCandle.bodyHeight / 2 + y: Y_AXIS + currentCandle.bodyHeight / 2 }; @@ -122,12 +122,12 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { let stickPoint3 = { x: X_AXIS + currentCandle.stickWidth / 2, - y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight + y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight }; let stickPoint4 = { x: X_AXIS - currentCandle.stickWidth / 2, - y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight + y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight }; @@ -256,15 +256,15 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { /* put the labels with the candles values */ - + let y; - printLabel('High', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '1'); + printLabel('Max', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '1'); printLabel(currentCandle.innerCandle.max, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '0.50'); - printLabel('Low', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '1'); + printLabel('Min', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '1'); printLabel(currentCandle.innerCandle.min, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '0.50'); @@ -273,7 +273,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } - printLabel('Open', X_AXIS * 1 / 2, y , '1'); + printLabel('Open', X_AXIS * 1 / 2, y, '1'); printLabel(currentCandle.innerCandle.open, X_AXIS * 1 / 2, y + frameBodyHeight * 0.05, '0.50'); y = Y_AXIS + currentCandle.bodyHeight / 2; @@ -281,10 +281,10 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } - printLabel('Close', X_AXIS * 3 / 2, y , '1'); - printLabel(currentCandle.innerCandle.close, X_AXIS * 3 / 2, y + frameBodyHeight * 0.05, '0.50'); + printLabel('Close', X_AXIS * 3 / 2, y, '1'); + printLabel(currentCandle.innerCandle.close, X_AXIS * 3 / 2, y + frameBodyHeight * 0.05, '0.50'); + - function printLabel(labelToPrint, x, y, opacity) { @@ -320,3 +320,4 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { } + From bbdf49fef645e7d12cce51641f04e71c836e8ece Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 22 Sep 2019 11:29:21 +0200 Subject: [PATCH 134/176] Daily Files Updated Events now Handled --- Candles.js | 47 +++++++++++++++++++---------------------------- Volumes.js | 33 +++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Candles.js b/Candles.js index c5fef30d0..4109cffad 100644 --- a/Candles.js +++ b/Candles.js @@ -51,9 +51,10 @@ let zoomChangedEventSubscriptionId let offsetChangedEventSubscriptionId - let filesUpdatedEventSubscriptionId let dragFinishedEventSubscriptionId let dimmensionsChangedEventSubscriptionId + let marketFilesUpdatedEventSubscriptionId + let dailyFilesUpdatedEventSubscriptionId return thisObject; @@ -64,9 +65,10 @@ viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId); viewPort.eventHandler.stopListening(offsetChangedEventSubscriptionId); - marketFiles.eventHandler.stopListening(filesUpdatedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) + marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId); + dailyFiles.eventHandler.stopListening(dailyFilesUpdatedEventSubscriptionId); /* Destroyd References */ @@ -112,8 +114,9 @@ zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); - filesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); + dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); /* Get ready for plotting. */ @@ -157,48 +160,46 @@ } } - function onFilesUpdated() { - + function onMarketFilesUpdated() { try { - let newMarketFile = marketFiles.getFile(timePeriod); - if (newMarketFile !== undefined) { - marketFile = newMarketFile; recalculate(); } - } catch (err) { + if (ERROR_LOG === true) { logger.write("[ERROR] onMarketFilesUpdated -> err = " + err.stack); } + } + } - if (ERROR_LOG === true) { logger.write("[ERROR] onFilesUpdated -> err = " + err.stack); } + function onDailyFilesUpdated() { + try { + let newFileCursor = dailyFiles.getFileCursor(timePeriod); + if (newFileCursor !== undefined) { + fileCursor = newFileCursor; + recalculate(); + } + } catch (err) { + if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFilesUpdated -> err = " + err.stack); } } } function setTimePeriod(pTimePeriod) { try { - if (timePeriod !== pTimePeriod) { - timePeriod = pTimePeriod; if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - let newMarketFile = marketFiles.getFile(pTimePeriod); - if (newMarketFile !== undefined) { - marketFile = newMarketFile; recalculate(); } } else { - let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); - if (newFileCursor !== undefined) { - fileCursor = newFileCursor; recalculate(); } @@ -452,18 +453,10 @@ let upperEnd = rightDate.valueOf(); if (candles.length > 0) { - if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { - setTimeout(recalculate, 2000); - - //console.log("File missing while calculating candles, scheduling a recalculation in 2 seconds."); - } } - - //console.log("Olivia > recalculateUsingDailyFiles > total candles generated : " + candles.length); - } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingDailyFiles -> err = " + err.stack); } @@ -526,8 +519,6 @@ } } - //console.log("Olivia > recalculateUsingMarketFiles > total candles generated : " + candles.length); - } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingMarketFiles -> err = " + err.stack); } diff --git a/Volumes.js b/Volumes.js index 7420a8c8d..f94b8322a 100644 --- a/Volumes.js +++ b/Volumes.js @@ -49,9 +49,10 @@ let zoomChangedEventSubscriptionId let offsetChangedEventSubscriptionId - let filesUpdatedEventSubscriptionId let dragFinishedEventSubscriptionId let dimmensionsChangedEventSubscriptionId + let marketFilesUpdatedEventSubscriptionId + let dailyFilesUpdatedEventSubscriptionId return thisObject; @@ -62,9 +63,10 @@ viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId); viewPort.eventHandler.stopListening(offsetChangedEventSubscriptionId); - marketFiles.eventHandler.stopListening(filesUpdatedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) + marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId); + dailyFiles.eventHandler.stopListening(dailyFilesUpdatedEventSubscriptionId); /* Destroyd References */ @@ -108,8 +110,9 @@ zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); - filesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onFilesUpdated); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); + marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); + dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); /* Get ready for plotting. */ @@ -164,25 +167,31 @@ } } - function onFilesUpdated() { - + function onMarketFilesUpdated() { try { - let newMarketFile = marketFiles.getFile(timePeriod); - if (newMarketFile !== undefined) { - marketFile = newMarketFile; - recalculateScaleX(); recalculate(); recalculateScaleY(); - } - } catch (err) { + if (ERROR_LOG === true) { logger.write("[ERROR] onMarketFilesUpdated -> err = " + err.stack); } + } + } - if (ERROR_LOG === true) { logger.write("[ERROR] onFilesUpdated -> err = " + err.stack); } + function onDailyFilesUpdated() { + try { + let newFileCursor = dailyFiles.getFileCursor(timePeriod); + if (newFileCursor !== undefined) { + fileCursor = newFileCursor; + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + } + } catch (err) { + if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFilesUpdated -> err = " + err.stack); } } } From 39e09f236491ef97b2c08202dd5668617427cf8f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Sep 2019 15:51:34 +0200 Subject: [PATCH 135/176] Performance Redesign --- Candles.js | 253 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 158 insertions(+), 95 deletions(-) diff --git a/Candles.js b/Candles.js index 4109cffad..7387b2d1f 100644 --- a/Candles.js +++ b/Candles.js @@ -564,157 +564,216 @@ if (candles.length > 0) { - /* Now we calculate and plot the candles */ - + /* Now we calculate all the points. */ for (let i = 0; i < candles.length; i++) { candle = candles[i]; - let candlePoint1 = { + candle.candlePoint1 = { x: candle.begin + timePeriod / 7 * 1.5, y: candle.open }; - let candlePoint2 = { + candle.candlePoint2 = { x: candle.begin + timePeriod / 7 * 5.5, y: candle.open }; - let candlePoint3 = { + candle.candlePoint3 = { x: candle.begin + timePeriod / 7 * 5.5, y: candle.close }; - let candlePoint4 = { + candle.candlePoint4 = { x: candle.begin + timePeriod / 7 * 1.5, y: candle.close }; - candlePoint1 = timeLineCoordinateSystem.transformThisPoint(candlePoint1); - candlePoint2 = timeLineCoordinateSystem.transformThisPoint(candlePoint2); - candlePoint3 = timeLineCoordinateSystem.transformThisPoint(candlePoint3); - candlePoint4 = timeLineCoordinateSystem.transformThisPoint(candlePoint4); + candle.candlePoint1 = timeLineCoordinateSystem.transformThisPoint(candle.candlePoint1); + candle.candlePoint2 = timeLineCoordinateSystem.transformThisPoint(candle.candlePoint2); + candle.candlePoint3 = timeLineCoordinateSystem.transformThisPoint(candle.candlePoint3); + candle.candlePoint4 = timeLineCoordinateSystem.transformThisPoint(candle.candlePoint4); - candlePoint1 = transformThisPoint(candlePoint1, thisObject.container); - candlePoint2 = transformThisPoint(candlePoint2, thisObject.container); - candlePoint3 = transformThisPoint(candlePoint3, thisObject.container); - candlePoint4 = transformThisPoint(candlePoint4, thisObject.container); + candle.candlePoint1 = transformThisPoint(candle.candlePoint1, thisObject.container); + candle.candlePoint2 = transformThisPoint(candle.candlePoint2, thisObject.container); + candle.candlePoint3 = transformThisPoint(candle.candlePoint3, thisObject.container); + candle.candlePoint4 = transformThisPoint(candle.candlePoint4, thisObject.container); - if (candlePoint2.x < viewPort.visibleArea.bottomLeft.x || candlePoint1.x > viewPort.visibleArea.bottomRight.x) { - continue; + candle.candlePoint1 = viewPort.fitIntoVisibleArea(candle.candlePoint1); + candle.candlePoint2 = viewPort.fitIntoVisibleArea(candle.candlePoint2); + candle.candlePoint3 = viewPort.fitIntoVisibleArea(candle.candlePoint3); + candle.candlePoint4 = viewPort.fitIntoVisibleArea(candle.candlePoint4); + + candle.stickPoint1 = { + x: candle.begin + timePeriod / 7 * 3.2, + y: candle.max + }; + + candle.stickPoint2 = { + x: candle.begin + timePeriod / 7 * 3.8, + y: candle.max + }; + + candle.stickPoint3 = { + x: candle.begin + timePeriod / 7 * 3.8, + y: candle.min + }; + + candle.stickPoint4 = { + x: candle.begin + timePeriod / 7 * 3.2, + y: candle.min + }; + + candle.stickPoint1 = timeLineCoordinateSystem.transformThisPoint(candle.stickPoint1); + candle.stickPoint2 = timeLineCoordinateSystem.transformThisPoint(candle.stickPoint2); + candle.stickPoint3 = timeLineCoordinateSystem.transformThisPoint(candle.stickPoint3); + candle.stickPoint4 = timeLineCoordinateSystem.transformThisPoint(candle.stickPoint4); + + candle.stickPoint1 = transformThisPoint(candle.stickPoint1, thisObject.container); + candle.stickPoint2 = transformThisPoint(candle.stickPoint2, thisObject.container); + candle.stickPoint3 = transformThisPoint(candle.stickPoint3, thisObject.container); + candle.stickPoint4 = transformThisPoint(candle.stickPoint4, thisObject.container); + + candle.stickPoint1 = viewPort.fitIntoVisibleArea(candle.stickPoint1); + candle.stickPoint2 = viewPort.fitIntoVisibleArea(candle.stickPoint2); + candle.stickPoint3 = viewPort.fitIntoVisibleArea(candle.stickPoint3); + candle.stickPoint4 = viewPort.fitIntoVisibleArea(candle.stickPoint4); + + } + + /* On screen candles */ + let onScreenCandles = [] + let mouseCandle + + for (let i = 0; i < candles.length; i++) { + + candle = candles[i]; + + if (candle.candlePoint2.x < viewPort.visibleArea.bottomLeft.x || candle.candlePoint1.x > viewPort.visibleArea.bottomRight.x) { + continue } - candlePoint1 = viewPort.fitIntoVisibleArea(candlePoint1); - candlePoint2 = viewPort.fitIntoVisibleArea(candlePoint2); - candlePoint3 = viewPort.fitIntoVisibleArea(candlePoint3); - candlePoint4 = viewPort.fitIntoVisibleArea(candlePoint4); + if (onScreenCandles.length < 5000) { + onScreenCandles.push(candle) + } - let stickPoint1 = { - x: candle.begin + timePeriod / 7 * 3.2, - y: candle.max - }; + if (userPositionDate >= candle.begin && userPositionDate <= candle.end) { + mouseCandle = candle + } + } - let stickPoint2 = { - x: candle.begin + timePeriod / 7 * 3.8, - y: candle.max - }; + /* We draw the sticks */ + browserCanvasContext.beginPath(); - let stickPoint3 = { - x: candle.begin + timePeriod / 7 * 3.8, - y: candle.min - }; + for (let i = 0; i < onScreenCandles.length; i++) { - let stickPoint4 = { - x: candle.begin + timePeriod / 7 * 3.2, - y: candle.min - }; + candle = onScreenCandles[i]; - stickPoint1 = timeLineCoordinateSystem.transformThisPoint(stickPoint1); - stickPoint2 = timeLineCoordinateSystem.transformThisPoint(stickPoint2); - stickPoint3 = timeLineCoordinateSystem.transformThisPoint(stickPoint3); - stickPoint4 = timeLineCoordinateSystem.transformThisPoint(stickPoint4); + browserCanvasContext.moveTo(candle.stickPoint1.x, candle.stickPoint1.y); + browserCanvasContext.lineTo(candle.stickPoint2.x, candle.stickPoint2.y); + browserCanvasContext.lineTo(candle.stickPoint3.x, candle.stickPoint3.y); + browserCanvasContext.lineTo(candle.stickPoint4.x, candle.stickPoint4.y); + } - stickPoint1 = transformThisPoint(stickPoint1, thisObject.container); - stickPoint2 = transformThisPoint(stickPoint2, thisObject.container); - stickPoint3 = transformThisPoint(stickPoint3, thisObject.container); - stickPoint4 = transformThisPoint(stickPoint4, thisObject.container); + browserCanvasContext.closePath(); + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; + browserCanvasContext.fill(); - stickPoint1 = viewPort.fitIntoVisibleArea(stickPoint1); - stickPoint2 = viewPort.fitIntoVisibleArea(stickPoint2); - stickPoint3 = viewPort.fitIntoVisibleArea(stickPoint3); - stickPoint4 = viewPort.fitIntoVisibleArea(stickPoint4); + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; + browserCanvasContext.lineWidth = 1; + browserCanvasContext.setLineDash([0, 0]) + browserCanvasContext.stroke(); + /* The stick at the mouse candle */ + if (mouseCandle) { browserCanvasContext.beginPath(); - browserCanvasContext.moveTo(stickPoint1.x, stickPoint1.y); - browserCanvasContext.lineTo(stickPoint2.x, stickPoint2.y); - browserCanvasContext.lineTo(stickPoint3.x, stickPoint3.y); - browserCanvasContext.lineTo(stickPoint4.x, stickPoint4.y); + candle = mouseCandle + + browserCanvasContext.moveTo(candle.stickPoint1.x, candle.stickPoint1.y); + browserCanvasContext.lineTo(candle.stickPoint2.x, candle.stickPoint2.y); + browserCanvasContext.lineTo(candle.stickPoint3.x, candle.stickPoint3.y); + browserCanvasContext.lineTo(candle.stickPoint4.x, candle.stickPoint4.y); browserCanvasContext.closePath(); browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; browserCanvasContext.fill(); - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; - - if (userPositionDate >= candle.begin && userPositionDate <= candle.end) { - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time - } - + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); + } + + + /* We draw the candles. */ + drawCandlesByDirection('up') + drawCandlesByDirection('down') + drawCandlesByDirection('side') + + function drawCandlesByDirection(direction) { browserCanvasContext.beginPath(); - browserCanvasContext.moveTo(candlePoint1.x, candlePoint1.y); - browserCanvasContext.lineTo(candlePoint2.x, candlePoint2.y); - browserCanvasContext.lineTo(candlePoint3.x, candlePoint3.y); - browserCanvasContext.lineTo(candlePoint4.x, candlePoint4.y); + for (let i = 0; i < onScreenCandles.length; i++) { + + candle = onScreenCandles[i]; + + if (candle.direction !== direction) { continue } + + browserCanvasContext.moveTo(candle.candlePoint1.x, candle.candlePoint1.y); + browserCanvasContext.lineTo(candle.candlePoint2.x, candle.candlePoint2.y); + browserCanvasContext.lineTo(candle.candlePoint3.x, candle.candlePoint3.y); + browserCanvasContext.lineTo(candle.candlePoint4.x, candle.candlePoint4.y); + } browserCanvasContext.closePath(); - if (candle.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 1)'; } - if (candle.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 1)'; } - if (candle.direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } + if (direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 1)'; } + if (direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 1)'; } + if (direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } - if (candle.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } - if (candle.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } - if (candle.direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } + if (direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } + if (direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } + if (direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } - if (userPositionDate >= candle.begin && userPositionDate <= candle.end) { - - /* highlight the current candle */ - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time - - let currentCandle = { - bodyWidth: candlePoint2.x - candlePoint1.x, - bodyHeight: candlePoint3.y - candlePoint2.y, - stickHeight: stickPoint4.y - stickPoint2.y, - stickWidth: stickPoint2.x - stickPoint1.x, - stickStart: candlePoint2.y - stickPoint2.y, - period: timePeriod, - innerCandle: candle - }; - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); - } - - if ( - candlePoint1.x < viewPort.visibleArea.topLeft.x + 50 - || - candlePoint1.x > viewPort.visibleArea.bottomRight.x - 50 - ) { - // we leave this candles without fill. - } else { - browserCanvasContext.fill(); - } + browserCanvasContext.fill(); browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); + } + /* Draw mouse candel and Raise Event. */ + if (mouseCandle) { + /* highlight the current candle */ + + browserCanvasContext.beginPath(); + + candle = mouseCandle + + browserCanvasContext.moveTo(candle.candlePoint1.x, candle.candlePoint1.y); + browserCanvasContext.lineTo(candle.candlePoint2.x, candle.candlePoint2.y); + browserCanvasContext.lineTo(candle.candlePoint3.x, candle.candlePoint3.y); + browserCanvasContext.lineTo(candle.candlePoint4.x, candle.candlePoint4.y); + + browserCanvasContext.closePath(); + + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current candle accroding to time + + browserCanvasContext.fill(); + + let currentCandle = { + bodyWidth: candle.candlePoint2.x - candle.candlePoint1.x, + bodyHeight: candle.candlePoint3.y - candle.candlePoint2.y, + stickHeight: candle.stickPoint4.y - candle.stickPoint2.y, + stickWidth: candle.stickPoint2.x - candle.stickPoint1.x, + stickStart: candle.candlePoint2.y - candle.stickPoint2.y, + period: timePeriod, + innerCandle: candle + }; + thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); } } @@ -724,6 +783,7 @@ } } + function onZoomChanged(event) { try { @@ -765,3 +825,6 @@ } + + + From 87f7399b0bed19bfeb98811a1a1e0dfb47c9eebd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 17 Oct 2019 22:20:22 +0200 Subject: [PATCH 136/176] forced recalculation impleneted --- Candles.js | 9 +++++++-- Volumes.js | 13 +++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Candles.js b/Candles.js index 7387b2d1f..d171693ad 100644 --- a/Candles.js +++ b/Candles.js @@ -796,12 +796,17 @@ } } - function onOffsetChanged() { + function onOffsetChanged(event) { try { + if (event !== undefined) { + if (event.recalculate === true) { + recalculate() + return + } + } if (Math.random() * 100 > 95) { - recalculate() }; diff --git a/Volumes.js b/Volumes.js index f94b8322a..be89d403e 100644 --- a/Volumes.js +++ b/Volumes.js @@ -807,16 +807,21 @@ } } - function onOffsetChanged() { + function onOffsetChanged(event) { try { - + if (event !== undefined) { + if (event.recalculate === true) { + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + return + } + } if (Math.random() * 100 > 95) { - recalculateScaleX(); recalculate(); recalculateScaleY(); - }; } catch (err) { From faeeb0955d7ad631650116bfc6340a139ef738ce Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Dec 2019 10:46:51 +0100 Subject: [PATCH 137/176] Data Mine Refactoring --- this.plotter.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/this.plotter.config.json b/this.plotter.config.json index 11e87aa45..c95e1db35 100644 --- a/this.plotter.config.json +++ b/this.plotter.config.json @@ -1,7 +1,7 @@ { "displayName": "Plotters Candles & Volumes", "codeName": "PlottersCandlesVolumes", - "devTeam": "AAMasters", + "dataMine": "AAMasters", "modules": [ { "codeName": "Candles", From 64dcc390a24840ac77a044bd29ab34207491181b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Dec 2019 13:27:43 +0100 Subject: [PATCH 138/176] Time Frame Refectoring --- Candles.js | 60 +++++++++++++++++++++++++++--------------------------- Volumes.js | 60 +++++++++++++++++++++++++++--------------------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/Candles.js b/Candles.js index d171693ad..bebebe7d0 100644 --- a/Candles.js +++ b/Candles.js @@ -14,7 +14,7 @@ finalize: finalize, container: undefined, getContainer: getContainer, - setTimePeriod: setTimePeriod, + setTimeFrame: setTimeFrame, setDatetime: setDatetime, draw: draw, recalculateScale: recalculateScale, @@ -36,14 +36,14 @@ let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. - let timePeriod; // This will hold the current Time Period the user is at. + let timeFrame; // This will hold the current Time Frame the user is at. let datetime; // This will hold the current Datetime the user is at. let marketFile; // This is the current Market File being plotted. let fileCursor; // This is the current File Cursor being used to retrieve Daily Files. - let marketFiles; // This object will provide the different Market Files at different Time Periods. - let dailyFiles; // This object will provide the different File Cursors at different Time Periods. + let marketFiles; // This object will provide the different Market Files at different Time Frames. + let dailyFiles; // This object will provide the different File Cursors at different Time Frames. /* these are module specific variables: */ @@ -76,7 +76,7 @@ dailyFiles = undefined; datetime = undefined; - timePeriod = undefined; + timeFrame = undefined; marketFile = undefined; fileCursor = undefined; @@ -87,7 +87,7 @@ } } - function initialize(pStorage, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { + function initialize(pStorage, pExchange, pMarket, pDatetime, pTimeFrame, callBackFunction) { try { @@ -97,7 +97,7 @@ dailyFiles = pStorage.dailyFiles[0]; datetime = pDatetime; - timePeriod = pTimePeriod; + timeFrame = pTimeFrame; /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ @@ -107,8 +107,8 @@ /* Now we set the right files according to current Period. */ - marketFile = marketFiles.getFile(pTimePeriod); - fileCursor = dailyFiles.getFileCursor(pTimePeriod); + marketFile = marketFiles.getFile(pTimeFrame); + fileCursor = dailyFiles.getFileCursor(pTimeFrame); /* Listen to the necesary events. */ @@ -162,7 +162,7 @@ function onMarketFilesUpdated() { try { - let newMarketFile = marketFiles.getFile(timePeriod); + let newMarketFile = marketFiles.getFile(timeFrame); if (newMarketFile !== undefined) { marketFile = newMarketFile; recalculate(); @@ -174,7 +174,7 @@ function onDailyFilesUpdated() { try { - let newFileCursor = dailyFiles.getFileCursor(timePeriod); + let newFileCursor = dailyFiles.getFileCursor(timeFrame); if (newFileCursor !== undefined) { fileCursor = newFileCursor; recalculate(); @@ -184,21 +184,21 @@ } } - function setTimePeriod(pTimePeriod) { + function setTimeFrame(pTimeFrame) { try { - if (timePeriod !== pTimePeriod) { - timePeriod = pTimePeriod; + if (timeFrame !== pTimeFrame) { + timeFrame = pTimeFrame; - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { - let newMarketFile = marketFiles.getFile(pTimePeriod); + if (timeFrame >= _1_HOUR_IN_MILISECONDS) { + let newMarketFile = marketFiles.getFile(pTimeFrame); if (newMarketFile !== undefined) { marketFile = newMarketFile; recalculate(); } } else { - let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); + let newFileCursor = dailyFiles.getFileCursor(pTimeFrame); if (newFileCursor !== undefined) { fileCursor = newFileCursor; recalculate(); @@ -208,7 +208,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] setTimePeriod -> err = " + err.stack); } + if (ERROR_LOG === true) { logger.write("[ERROR] setTimeFrame -> err = " + err.stack); } } } @@ -357,7 +357,7 @@ try { - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + if (timeFrame >= _1_HOUR_IN_MILISECONDS) { recalculateUsingMarketFiles(); @@ -383,7 +383,7 @@ if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let daysOnSides = getSideDays(timePeriod); + let daysOnSides = getSideDays(timeFrame); let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); @@ -469,7 +469,7 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. - let daysOnSides = getSideDays(timePeriod); + let daysOnSides = getSideDays(timeFrame); let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); @@ -570,22 +570,22 @@ candle = candles[i]; candle.candlePoint1 = { - x: candle.begin + timePeriod / 7 * 1.5, + x: candle.begin + timeFrame / 7 * 1.5, y: candle.open }; candle.candlePoint2 = { - x: candle.begin + timePeriod / 7 * 5.5, + x: candle.begin + timeFrame / 7 * 5.5, y: candle.open }; candle.candlePoint3 = { - x: candle.begin + timePeriod / 7 * 5.5, + x: candle.begin + timeFrame / 7 * 5.5, y: candle.close }; candle.candlePoint4 = { - x: candle.begin + timePeriod / 7 * 1.5, + x: candle.begin + timeFrame / 7 * 1.5, y: candle.close }; @@ -605,22 +605,22 @@ candle.candlePoint4 = viewPort.fitIntoVisibleArea(candle.candlePoint4); candle.stickPoint1 = { - x: candle.begin + timePeriod / 7 * 3.2, + x: candle.begin + timeFrame / 7 * 3.2, y: candle.max }; candle.stickPoint2 = { - x: candle.begin + timePeriod / 7 * 3.8, + x: candle.begin + timeFrame / 7 * 3.8, y: candle.max }; candle.stickPoint3 = { - x: candle.begin + timePeriod / 7 * 3.8, + x: candle.begin + timeFrame / 7 * 3.8, y: candle.min }; candle.stickPoint4 = { - x: candle.begin + timePeriod / 7 * 3.2, + x: candle.begin + timeFrame / 7 * 3.2, y: candle.min }; @@ -770,7 +770,7 @@ stickHeight: candle.stickPoint4.y - candle.stickPoint2.y, stickWidth: candle.stickPoint2.x - candle.stickPoint1.x, stickStart: candle.candlePoint2.y - candle.stickPoint2.y, - period: timePeriod, + period: timeFrame, innerCandle: candle }; thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); diff --git a/Volumes.js b/Volumes.js index be89d403e..83c35f53c 100644 --- a/Volumes.js +++ b/Volumes.js @@ -18,7 +18,7 @@ finalize: finalize, container: undefined, getContainer: getContainer, - setTimePeriod: setTimePeriod, + setTimeFrame: setTimeFrame, setDatetime: setDatetime, recalculateScale: recalculateScale, draw: draw @@ -32,14 +32,14 @@ let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. let plotAreaFrame = newTimeLineCoordinateSystem(); // This chart uses this extra object. - let timePeriod; // This will hold the current Time Period the user is at. + let timeFrame; // This will hold the current Time Frame the user is at. let datetime; // This will hold the current Datetime the user is at. let marketFile; // This is the current Market File being plotted. let fileCursor; // This is the current File Cursor being used to retrieve Daily Files. - let marketFiles; // This object will provide the different Market Files at different Time Periods. - let dailyFiles; // This object will provide the different File Cursors at different Time Periods. + let marketFiles; // This object will provide the different Market Files at different Time Frames. + let dailyFiles; // This object will provide the different File Cursors at different Time Frames. let scaleFile; // This file is used to calculate the scale. @@ -74,7 +74,7 @@ dailyFiles = undefined; datetime = undefined; - timePeriod = undefined; + timeFrame = undefined; marketFile = undefined; fileCursor = undefined; @@ -85,7 +85,7 @@ } } - function initialize(pStorage, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { + function initialize(pStorage, pExchange, pMarket, pDatetime, pTimeFrame, callBackFunction) { try { @@ -95,7 +95,7 @@ dailyFiles = pStorage.dailyFiles[0]; datetime = pDatetime; - timePeriod = pTimePeriod; + timeFrame = pTimeFrame; /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ @@ -103,8 +103,8 @@ /* Now we set the right files according to current Period. */ - marketFile = marketFiles.getFile(pTimePeriod); - fileCursor = dailyFiles.getFileCursor(pTimePeriod); + marketFile = marketFiles.getFile(pTimeFrame); + fileCursor = dailyFiles.getFileCursor(pTimeFrame); /* Listen to the necesary events. */ @@ -169,7 +169,7 @@ function onMarketFilesUpdated() { try { - let newMarketFile = marketFiles.getFile(timePeriod); + let newMarketFile = marketFiles.getFile(timeFrame); if (newMarketFile !== undefined) { marketFile = newMarketFile; recalculateScaleX(); @@ -183,7 +183,7 @@ function onDailyFilesUpdated() { try { - let newFileCursor = dailyFiles.getFileCursor(timePeriod); + let newFileCursor = dailyFiles.getFileCursor(timeFrame); if (newFileCursor !== undefined) { fileCursor = newFileCursor; recalculateScaleX(); @@ -195,17 +195,17 @@ } } - function setTimePeriod(pTimePeriod) { + function setTimeFrame(pTimeFrame) { try { - if (timePeriod !== pTimePeriod) { + if (timeFrame !== pTimeFrame) { - timePeriod = pTimePeriod; + timeFrame = pTimeFrame; - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + if (timeFrame >= _1_HOUR_IN_MILISECONDS) { - let newMarketFile = marketFiles.getFile(pTimePeriod); + let newMarketFile = marketFiles.getFile(pTimeFrame); if (newMarketFile !== undefined) { @@ -215,7 +215,7 @@ } else { - let newFileCursor = dailyFiles.getFileCursor(pTimePeriod); + let newFileCursor = dailyFiles.getFileCursor(pTimeFrame); if (newFileCursor !== undefined) { @@ -227,7 +227,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] setTimePeriod -> err = " + err.stack); } + if (ERROR_LOG === true) { logger.write("[ERROR] setTimeFrame -> err = " + err.stack); } } } @@ -277,7 +277,7 @@ try { - if (timePeriod >= _1_HOUR_IN_MILISECONDS) { + if (timeFrame >= _1_HOUR_IN_MILISECONDS) { recalculateUsingMarketFiles(); @@ -471,9 +471,9 @@ y: 0 }; - let timePeriodRatio = ONE_DAY_IN_MILISECONDS / timePeriod; + let timeFrameRatio = ONE_DAY_IN_MILISECONDS / timeFrame; - maxValue.y = getMaxVolume() / (timePeriodRatio / 2.5); + maxValue.y = getMaxVolume() / (timeFrameRatio / 2.5); timeLineCoordinateSystem.initializeY( minValue, @@ -555,22 +555,22 @@ function calculateBuys(plot, height) { volumePointA1 = { - x: volume.begin + timePeriod / 7 * 2, + x: volume.begin + timeFrame / 7 * 2, y: 0 }; volumePointA2 = { - x: volume.begin + timePeriod / 7 * 2, + x: volume.begin + timeFrame / 7 * 2, y: volume.amountBuy }; volumePointA3 = { - x: volume.begin + timePeriod / 7 * 5, + x: volume.begin + timeFrame / 7 * 5, y: volume.amountBuy }; volumePointA4 = { - x: volume.begin + timePeriod / 7 * 5, + x: volume.begin + timeFrame / 7 * 5, y: 0 }; @@ -620,22 +620,22 @@ function calculateSells(plot, height) { volumePointB1 = { - x: volume.begin + timePeriod / 7 * 2, + x: volume.begin + timeFrame / 7 * 2, y: height }; volumePointB2 = { - x: volume.begin + timePeriod / 7 * 2, + x: volume.begin + timeFrame / 7 * 2, y: height - volume.amountSell }; volumePointB3 = { - x: volume.begin + timePeriod / 7 * 5, + x: volume.begin + timeFrame / 7 * 5, y: height - volume.amountSell }; volumePointB4 = { - x: volume.begin + timePeriod / 7 * 5, + x: volume.begin + timeFrame / 7 * 5, y: height }; @@ -775,7 +775,7 @@ let currentVolume = { buyInfo: buyInfo, sellInfo: sellInfo, - period: timePeriod, + period: timeFrame, innerVolumeBar: volume }; From 3f86b9d7dba7e1577a7fb46b0d2ebef3bfddd494 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 10 Jan 2020 08:06:25 +0100 Subject: [PATCH 139/176] Code Cleaning --- CandlePanel.js | 1 - VolumePanel.js | 1 - 2 files changed, 2 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index ed95d06ce..f7927258d 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -14,7 +14,6 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { container.initialize(); thisObject.container = container; - container.displacement.containerName = "Candle"; container.frame.containerName = "Candle"; let currentCandle; diff --git a/VolumePanel.js b/VolumePanel.js index d0ce5dc4e..f460952aa 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -14,7 +14,6 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { container.initialize(); thisObject.container = container; - container.displacement.containerName = "Volume"; container.frame.containerName = "Volume"; let currentVolume; From f26c20423cb01538121fd952c2b3263aa31d07d1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 11 Jan 2020 18:38:54 +0100 Subject: [PATCH 140/176] fitfuction and refactoring --- Candles.js | 50 +++++++++++++++++++++++++++++++------------------- Volumes.js | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 57 insertions(+), 33 deletions(-) diff --git a/Candles.js b/Candles.js index bebebe7d0..3d4abcc90 100644 --- a/Candles.js +++ b/Candles.js @@ -13,6 +13,7 @@ initialize: initialize, finalize: finalize, container: undefined, + fitFunction: undefined, getContainer: getContainer, setTimeFrame: setTimeFrame, setDatetime: setDatetime, @@ -34,7 +35,7 @@ thisObject.container = newContainer() thisObject.container.initialize(MODULE_NAME) - let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. + let coordinateSystem = newCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. let timeFrame; // This will hold the current Time Frame the user is at. let datetime; // This will hold the current Datetime the user is at. @@ -81,6 +82,7 @@ marketFile = undefined; fileCursor = undefined; + thisObject.fitFunction = undefined } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err = " + err.stack); } @@ -242,7 +244,7 @@ y: candles[i].open }; - targetPoint = timeLineCoordinateSystem.transformThisPoint(targetPoint); + targetPoint = coordinateSystem.transformThisPoint(targetPoint); targetPoint = transformThisPoint(targetPoint, thisObject.container); let targetMax = { @@ -250,7 +252,7 @@ y: candles[i].max }; - targetMax = timeLineCoordinateSystem.transformThisPoint(targetMax); + targetMax = coordinateSystem.transformThisPoint(targetMax); targetMax = transformThisPoint(targetMax, thisObject.container); let targetMin = { @@ -258,7 +260,7 @@ y: candles[i].min }; - targetMin = timeLineCoordinateSystem.transformThisPoint(targetMin); + targetMin = coordinateSystem.transformThisPoint(targetMin); targetMin = transformThisPoint(targetMin, thisObject.container); let center = { @@ -295,7 +297,7 @@ y: lastClose }; - targetPoint = timeLineCoordinateSystem.transformThisPoint(targetPoint); + targetPoint = coordinateSystem.transformThisPoint(targetPoint); targetPoint = transformThisPoint(targetPoint, thisObject.container); let center = { @@ -385,8 +387,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -471,8 +473,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -529,7 +531,7 @@ try { - if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated. + if (coordinateSystem.maxValue > 0) { return; } // Already calculated. let minValue = { x: MIN_PLOTABLE_DATE.valueOf(), @@ -542,7 +544,7 @@ }; - timeLineCoordinateSystem.initialize( + coordinateSystem.initialize( minValue, maxValue, thisObject.container.frame.width, @@ -589,10 +591,10 @@ y: candle.close }; - candle.candlePoint1 = timeLineCoordinateSystem.transformThisPoint(candle.candlePoint1); - candle.candlePoint2 = timeLineCoordinateSystem.transformThisPoint(candle.candlePoint2); - candle.candlePoint3 = timeLineCoordinateSystem.transformThisPoint(candle.candlePoint3); - candle.candlePoint4 = timeLineCoordinateSystem.transformThisPoint(candle.candlePoint4); + candle.candlePoint1 = coordinateSystem.transformThisPoint(candle.candlePoint1); + candle.candlePoint2 = coordinateSystem.transformThisPoint(candle.candlePoint2); + candle.candlePoint3 = coordinateSystem.transformThisPoint(candle.candlePoint3); + candle.candlePoint4 = coordinateSystem.transformThisPoint(candle.candlePoint4); candle.candlePoint1 = transformThisPoint(candle.candlePoint1, thisObject.container); candle.candlePoint2 = transformThisPoint(candle.candlePoint2, thisObject.container); @@ -604,6 +606,11 @@ candle.candlePoint3 = viewPort.fitIntoVisibleArea(candle.candlePoint3); candle.candlePoint4 = viewPort.fitIntoVisibleArea(candle.candlePoint4); + candle.candlePoint1 = thisObject.fitFunction(candle.candlePoint1); + candle.candlePoint2 = thisObject.fitFunction(candle.candlePoint2); + candle.candlePoint3 = thisObject.fitFunction(candle.candlePoint3); + candle.candlePoint4 = thisObject.fitFunction(candle.candlePoint4); + candle.stickPoint1 = { x: candle.begin + timeFrame / 7 * 3.2, y: candle.max @@ -624,10 +631,10 @@ y: candle.min }; - candle.stickPoint1 = timeLineCoordinateSystem.transformThisPoint(candle.stickPoint1); - candle.stickPoint2 = timeLineCoordinateSystem.transformThisPoint(candle.stickPoint2); - candle.stickPoint3 = timeLineCoordinateSystem.transformThisPoint(candle.stickPoint3); - candle.stickPoint4 = timeLineCoordinateSystem.transformThisPoint(candle.stickPoint4); + candle.stickPoint1 = coordinateSystem.transformThisPoint(candle.stickPoint1); + candle.stickPoint2 = coordinateSystem.transformThisPoint(candle.stickPoint2); + candle.stickPoint3 = coordinateSystem.transformThisPoint(candle.stickPoint3); + candle.stickPoint4 = coordinateSystem.transformThisPoint(candle.stickPoint4); candle.stickPoint1 = transformThisPoint(candle.stickPoint1, thisObject.container); candle.stickPoint2 = transformThisPoint(candle.stickPoint2, thisObject.container); @@ -639,6 +646,11 @@ candle.stickPoint3 = viewPort.fitIntoVisibleArea(candle.stickPoint3); candle.stickPoint4 = viewPort.fitIntoVisibleArea(candle.stickPoint4); + candle.stickPoint1 = thisObject.fitFunction(candle.stickPoint1); + candle.stickPoint2 = thisObject.fitFunction(candle.stickPoint2); + candle.stickPoint3 = thisObject.fitFunction(candle.stickPoint3); + candle.stickPoint4 = thisObject.fitFunction(candle.stickPoint4); + } /* On screen candles */ diff --git a/Volumes.js b/Volumes.js index 83c35f53c..5b9e8327b 100644 --- a/Volumes.js +++ b/Volumes.js @@ -17,6 +17,7 @@ initialize: initialize, finalize: finalize, container: undefined, + fitFunction: undefined, getContainer: getContainer, setTimeFrame: setTimeFrame, setDatetime: setDatetime, @@ -29,8 +30,8 @@ thisObject.container = newContainer() thisObject.container.initialize(MODULE_NAME) - let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. - let plotAreaFrame = newTimeLineCoordinateSystem(); // This chart uses this extra object. + let coordinateSystem = newCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. + let plotAreaFrame = newCoordinateSystem(); // This chart uses this extra object. let timeFrame; // This will hold the current Time Frame the user is at. let datetime; // This will hold the current Datetime the user is at. @@ -79,6 +80,7 @@ marketFile = undefined; fileCursor = undefined; + thisObject.fitFunction = undefined } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err = " + err.stack); } @@ -303,8 +305,8 @@ if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -384,8 +386,8 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, timeLineCoordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, timeLineCoordinateSystem); + let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -441,7 +443,7 @@ x: MAX_PLOTABLE_DATE.valueOf() }; - timeLineCoordinateSystem.initializeX( + coordinateSystem.initializeX( minValue, maxValue, thisObject.container.frame.width @@ -475,7 +477,7 @@ maxValue.y = getMaxVolume() / (timeFrameRatio / 2.5); - timeLineCoordinateSystem.initializeY( + coordinateSystem.initializeY( minValue, maxValue, viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y @@ -601,13 +603,13 @@ if (volumePointA1.y > viewPort.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - if (calculateBuys(timeLineCoordinateSystem, visibleHeight) === false) { continue; } // We snap t to the view port. + if (calculateBuys(coordinateSystem, visibleHeight) === false) { continue; } // We snap t to the view port. /* Now we set the real value of y. */ volumePointA1.y = viewPort.visibleArea.bottomRight.y; - volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; - volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; + volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * coordinateSystem.scale.y; + volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * coordinateSystem.scale.y; volumePointA4.y = viewPort.visibleArea.bottomRight.y; } @@ -655,13 +657,13 @@ if (volumePointB1.y < viewPort.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - calculateSells(timeLineCoordinateSystem, visibleHeight); // We snap it to the view port. + calculateSells(coordinateSystem, visibleHeight); // We snap it to the view port. /* Now we set the real value of y. */ volumePointB1.y = viewPort.visibleArea.topLeft.y; - volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; - volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; + volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * coordinateSystem.scale.y; + volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * coordinateSystem.scale.y; volumePointB4.y = viewPort.visibleArea.topLeft.y; } @@ -696,6 +698,16 @@ volumePointB3 = viewPort.fitIntoVisibleArea(volumePointB3); volumePointB4 = viewPort.fitIntoVisibleArea(volumePointB4); + volumePointA1 = thisObject.fitFunction(volumePointA1); + volumePointA2 = thisObject.fitFunction(volumePointA2); + volumePointA3 = thisObject.fitFunction(volumePointA3); + volumePointA4 = thisObject.fitFunction(volumePointA4); + + volumePointB1 = thisObject.fitFunction(volumePointB1); + volumePointB2 = thisObject.fitFunction(volumePointB2); + volumePointB3 = thisObject.fitFunction(volumePointB3); + volumePointB4 = thisObject.fitFunction(volumePointB4); + /* Everything must fit within the Frame. We know that that is equivalent to say that each bar con not be higher than the base of the opposite . */ if (volumePointA2.y < volumePointB1.y) { From d221a689787c59bca88e47e8f5c77744e52c3bad Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 15 Jan 2020 08:30:35 +0100 Subject: [PATCH 141/176] Code Cleaning --- Candles.js | 2 +- Volumes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Candles.js b/Candles.js index 3d4abcc90..bbb05fd6b 100644 --- a/Candles.js +++ b/Candles.js @@ -89,7 +89,7 @@ } } - function initialize(pStorage, pExchange, pMarket, pDatetime, pTimeFrame, callBackFunction) { + function initialize(pStorage, pDatetime, pTimeFrame, callBackFunction) { try { diff --git a/Volumes.js b/Volumes.js index 5b9e8327b..0eb184145 100644 --- a/Volumes.js +++ b/Volumes.js @@ -87,7 +87,7 @@ } } - function initialize(pStorage, pExchange, pMarket, pDatetime, pTimeFrame, callBackFunction) { + function initialize(pStorage, pDatetime, pTimeFrame, callBackFunction) { try { From a4e59d210b16cb1d842a9eb8fa3f3ac6026c2863 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 17 Jan 2020 08:52:13 +0100 Subject: [PATCH 142/176] Standarizing Names --- CandlePanel.js | 25 +++++++++++++++++-------- Candles.js | 6 +++--- VolumePanel.js | 25 +++++++++++++++++-------- Volumes.js | 6 +++--- this.plotter.config.json | 4 ++-- 5 files changed, 42 insertions(+), 24 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index f7927258d..f4e8529ca 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -4,23 +4,32 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { let thisObject = { fitFunction: undefined, container: undefined, - onEventRaised: onEventRaised, + onRecordChange: onRecordChange, draw: draw, getContainer: getContainer, - initialize: initialize + initialize: initialize, + finalize: finalize }; - let container = newContainer(); - container.initialize(); - thisObject.container = container; - - container.frame.containerName = "Candle"; + thisObject.container = newContainer(); + thisObject.container.initialize(); + thisObject.container.frame.containerName = "Candle"; let currentCandle; let panelTabButton return thisObject; + function finalize() { + thisObject.container.finalize() + thisObject.container = undefined + thisObject.fitFunction = undefined + + currentCandle = undefined + panelTabButton.finalize() + panelTabButton = undefined + } + function initialize() { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; @@ -59,7 +68,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { } - function onEventRaised(lastCurrentCandle) { + function onRecordChange(lastCurrentCandle) { currentCandle = lastCurrentCandle; diff --git a/Candles.js b/Candles.js index bbb05fd6b..6abbb632a 100644 --- a/Candles.js +++ b/Candles.js @@ -439,7 +439,7 @@ if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { thisObject.currentCandle = candle; - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); + thisObject.container.eventHandler.raiseEvent("Current Record Changed", thisObject.currentCandle); } } @@ -515,7 +515,7 @@ if (datetime.valueOf() >= candle.begin && datetime.valueOf() <= candle.end) { thisObject.currentCandle = candle; - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", thisObject.currentCandle); + thisObject.container.eventHandler.raiseEvent("Current Record Changed", thisObject.currentCandle); } } @@ -785,7 +785,7 @@ period: timeFrame, innerCandle: candle }; - thisObject.container.eventHandler.raiseEvent("Current Candle Changed", currentCandle); + thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentCandle); } } diff --git a/VolumePanel.js b/VolumePanel.js index f460952aa..8df5284bc 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -4,23 +4,32 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { let thisObject = { fitFunction: undefined, container: undefined, - onEventRaised: onEventRaised, + onRecordChange: onRecordChange, draw: draw, getContainer: getContainer, - initialize: initialize + initialize: initialize, + finalize: finalize }; - let container = newContainer(); - container.initialize(); - thisObject.container = container; - - container.frame.containerName = "Volume"; + thisObject.container = newContainer(); + thisObject.container.initialize(); + thisObject.container.frame.containerName = "Volume"; let currentVolume; let panelTabButton return thisObject; + function finalize() { + thisObject.container.finalize() + thisObject.container = undefined + thisObject.fitFunction = undefined + + currentVolume = undefined + panelTabButton.finalize() + panelTabButton = undefined + } + function initialize() { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; @@ -59,7 +68,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { } - function onEventRaised(lastCurrentVolume) { + function onRecordChange(lastCurrentVolume) { currentVolume = lastCurrentVolume; diff --git a/Volumes.js b/Volumes.js index 0eb184145..c8ca9acd5 100644 --- a/Volumes.js +++ b/Volumes.js @@ -346,7 +346,7 @@ if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { - thisObject.container.eventHandler.raiseEvent("Current Volume Changed", thisObject.currentCandle); + thisObject.container.eventHandler.raiseEvent("Current Record Changed", thisObject.currentCandle); } } @@ -417,7 +417,7 @@ if (datetime.valueOf() >= volume.begin && datetime.valueOf() <= volume.end) { - thisObject.container.eventHandler.raiseEvent("Current Volume Changed", thisObject.currentCandle); + thisObject.container.eventHandler.raiseEvent("Current Record Changed", thisObject.currentCandle); } } @@ -791,7 +791,7 @@ innerVolumeBar: volume }; - thisObject.container.eventHandler.raiseEvent("Current Volume Changed", currentVolume); + thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentVolume); } diff --git a/this.plotter.config.json b/this.plotter.config.json index c95e1db35..1f777a5af 100644 --- a/this.plotter.config.json +++ b/this.plotter.config.json @@ -12,7 +12,7 @@ { "codeName": "CandlePanel", "moduleName": "CandlePanel", - "event": "Current Candle Changed" + "event": "Current Record Changed" } ] }, @@ -25,7 +25,7 @@ { "codeName": "VolumePanel", "moduleName": "VolumePanel", - "event": "Current Volume Changed" + "event": "Current Record Changed" } ] } From a1febcf96a4ebb5c3bbaa3a8587c56f266cf994a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 17 Jan 2020 17:49:09 +0100 Subject: [PATCH 143/176] Viewport Related Refactoring --- Candles.js | 12 ++++++------ Volumes.js | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Candles.js b/Candles.js index 6abbb632a..3cf8c81ac 100644 --- a/Candles.js +++ b/Candles.js @@ -114,8 +114,8 @@ /* Listen to the necesary events. */ - zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); + zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); + offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); @@ -796,7 +796,7 @@ } - function onZoomChanged(event) { + function onViewportZoomChanged(event) { try { @@ -804,11 +804,11 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onZoomChanged -> err = " + err.stack); } + if (ERROR_LOG === true) { logger.write("[ERROR] onViewportZoomChanged -> err = " + err.stack); } } } - function onOffsetChanged(event) { + function onViewportPositionChanged(event) { try { @@ -824,7 +824,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onOffsetChanged -> err = " + err.stack); } + if (ERROR_LOG === true) { logger.write("[ERROR] onViewportPositionChanged -> err = " + err.stack); } } } diff --git a/Volumes.js b/Volumes.js index c8ca9acd5..2fa906f39 100644 --- a/Volumes.js +++ b/Volumes.js @@ -110,8 +110,8 @@ /* Listen to the necesary events. */ - zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); - offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Offset Changed", onOffsetChanged); + zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); + offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); @@ -805,7 +805,7 @@ } } - function onZoomChanged(event) { + function onViewportZoomChanged(event) { try { @@ -815,11 +815,11 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onZoomChanged -> err = " + err.stack); } + if (ERROR_LOG === true) { logger.write("[ERROR] onViewportZoomChanged -> err = " + err.stack); } } } - function onOffsetChanged(event) { + function onViewportPositionChanged(event) { try { if (event !== undefined) { @@ -838,7 +838,7 @@ } catch (err) { - if (ERROR_LOG === true) { logger.write("[ERROR] onOffsetChanged -> err = " + err.stack); } + if (ERROR_LOG === true) { logger.write("[ERROR] onViewportPositionChanged -> err = " + err.stack); } } } From 1a9f859a50b0b9b28045275c22b0e93280e07b2d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 17 Jan 2020 18:46:36 +0100 Subject: [PATCH 144/176] Viewport inside the Chartspace --- CandlePanel.js | 4 ++-- Candles.js | 50 +++++++++++++++++++++---------------------- VolumePanel.js | 4 ++-- Volumes.js | 58 +++++++++++++++++++++++++------------------------- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index f4e8529ca..f436bfb1a 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -35,8 +35,8 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 2; - thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height; + thisObject.container.frame.position.x = canvas.chartSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width * 2; + thisObject.container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; panelTabButton = newPanelTabButton() panelTabButton.parentContainer = thisObject.container diff --git a/Candles.js b/Candles.js index 3cf8c81ac..4af5529fe 100644 --- a/Candles.js +++ b/Candles.js @@ -64,8 +64,8 @@ /* Stop listening to the necesary events. */ - viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId); - viewPort.eventHandler.stopListening(offsetChangedEventSubscriptionId); + canvas.chartSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); + canvas.chartSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId); @@ -114,8 +114,8 @@ /* Listen to the necesary events. */ - zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); - offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); + zoomChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); + offsetChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); @@ -264,18 +264,18 @@ targetMin = transformThisPoint(targetMin, thisObject.container); let center = { - x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2, - y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) / 2 + x: (canvas.chartSpace.viewport.visibleArea.bottomRight.x - canvas.chartSpace.viewport.visibleArea.bottomLeft.x) / 2, + y: (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topRight.y) / 2 }; - if (targetMax.y < viewPort.visibleArea.topLeft.y || targetMin.y > viewPort.visibleArea.bottomRight.y) { + if (targetMax.y < canvas.chartSpace.viewport.visibleArea.topLeft.y || targetMin.y > canvas.chartSpace.viewport.visibleArea.bottomRight.y) { let displaceVector = { x: 0, y: center.y - targetPoint.y }; - viewPort.displaceTarget(displaceVector); + canvas.chartSpace.viewport.displaceTarget(displaceVector); } @@ -284,7 +284,7 @@ y: 0 }; - viewPort.displace(displaceVector); + canvas.chartSpace.viewport.displace(displaceVector); return; } @@ -301,8 +301,8 @@ targetPoint = transformThisPoint(targetPoint, thisObject.container); let center = { - x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2, - y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) / 2 + x: (canvas.chartSpace.viewport.visibleArea.bottomRight.x - canvas.chartSpace.viewport.visibleArea.bottomLeft.x) / 2, + y: (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topRight.y) / 2 }; let displaceVector = { @@ -310,7 +310,7 @@ y: center.y - targetPoint.y }; - viewPort.displace(displaceVector); + canvas.chartSpace.viewport.displace(displaceVector); return; } @@ -387,8 +387,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -473,8 +473,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -601,10 +601,10 @@ candle.candlePoint3 = transformThisPoint(candle.candlePoint3, thisObject.container); candle.candlePoint4 = transformThisPoint(candle.candlePoint4, thisObject.container); - candle.candlePoint1 = viewPort.fitIntoVisibleArea(candle.candlePoint1); - candle.candlePoint2 = viewPort.fitIntoVisibleArea(candle.candlePoint2); - candle.candlePoint3 = viewPort.fitIntoVisibleArea(candle.candlePoint3); - candle.candlePoint4 = viewPort.fitIntoVisibleArea(candle.candlePoint4); + candle.candlePoint1 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint1); + candle.candlePoint2 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint2); + candle.candlePoint3 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint3); + candle.candlePoint4 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint4); candle.candlePoint1 = thisObject.fitFunction(candle.candlePoint1); candle.candlePoint2 = thisObject.fitFunction(candle.candlePoint2); @@ -641,10 +641,10 @@ candle.stickPoint3 = transformThisPoint(candle.stickPoint3, thisObject.container); candle.stickPoint4 = transformThisPoint(candle.stickPoint4, thisObject.container); - candle.stickPoint1 = viewPort.fitIntoVisibleArea(candle.stickPoint1); - candle.stickPoint2 = viewPort.fitIntoVisibleArea(candle.stickPoint2); - candle.stickPoint3 = viewPort.fitIntoVisibleArea(candle.stickPoint3); - candle.stickPoint4 = viewPort.fitIntoVisibleArea(candle.stickPoint4); + candle.stickPoint1 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint1); + candle.stickPoint2 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint2); + candle.stickPoint3 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint3); + candle.stickPoint4 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint4); candle.stickPoint1 = thisObject.fitFunction(candle.stickPoint1); candle.stickPoint2 = thisObject.fitFunction(candle.stickPoint2); @@ -661,7 +661,7 @@ candle = candles[i]; - if (candle.candlePoint2.x < viewPort.visibleArea.bottomLeft.x || candle.candlePoint1.x > viewPort.visibleArea.bottomRight.x) { + if (candle.candlePoint2.x < canvas.chartSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartSpace.viewport.visibleArea.bottomRight.x) { continue } diff --git a/VolumePanel.js b/VolumePanel.js index 8df5284bc..4bcf3b2a0 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -35,8 +35,8 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width; - thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height; + thisObject.container.frame.position.x = canvas.chartSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width; + thisObject.container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; panelTabButton = newPanelTabButton() panelTabButton.parentContainer = thisObject.container diff --git a/Volumes.js b/Volumes.js index 2fa906f39..fa7daab72 100644 --- a/Volumes.js +++ b/Volumes.js @@ -62,8 +62,8 @@ /* Stop listening to the necesary events. */ - viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId); - viewPort.eventHandler.stopListening(offsetChangedEventSubscriptionId); + canvas.chartSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); + canvas.chartSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId); @@ -110,8 +110,8 @@ /* Listen to the necesary events. */ - zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); - offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); + zoomChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); + offsetChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); @@ -305,8 +305,8 @@ if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -386,8 +386,8 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. - let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -480,7 +480,7 @@ coordinateSystem.initializeY( minValue, maxValue, - viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y + canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topLeft.y ); plotAreaFrame.initializeY( @@ -523,7 +523,7 @@ /* Now we calculate and plot the volumes */ - let visibleHeight = viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y; + let visibleHeight = canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topLeft.y; let frameCorner1 = { x: 0, @@ -591,7 +591,7 @@ volumePointA1.x = volumePointA1.x - baseIncrement; volumePointA4.x = volumePointA4.x + baseIncrement; - if (volumePointA4.x < viewPort.visibleArea.bottomLeft.x || volumePointA1.x > viewPort.visibleArea.bottomRight.x) { + if (volumePointA4.x < canvas.chartSpace.viewport.visibleArea.bottomLeft.x || volumePointA1.x > canvas.chartSpace.viewport.visibleArea.bottomRight.x) { return false; } @@ -601,16 +601,16 @@ if (calculateBuys(plotAreaFrame, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. - if (volumePointA1.y > viewPort.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { + if (volumePointA1.y > canvas.chartSpace.viewport.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { if (calculateBuys(coordinateSystem, visibleHeight) === false) { continue; } // We snap t to the view port. /* Now we set the real value of y. */ - volumePointA1.y = viewPort.visibleArea.bottomRight.y; - volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * coordinateSystem.scale.y; - volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * coordinateSystem.scale.y; - volumePointA4.y = viewPort.visibleArea.bottomRight.y; + volumePointA1.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y; + volumePointA2.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y - volume.amountBuy * coordinateSystem.scale.y; + volumePointA3.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y - volume.amountBuy * coordinateSystem.scale.y; + volumePointA4.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y; } @@ -655,16 +655,16 @@ calculateSells(plotAreaFrame, thisObject.container.frame.height); // We try to see if it fits in the visible area. - if (volumePointB1.y < viewPort.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { + if (volumePointB1.y < canvas.chartSpace.viewport.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { calculateSells(coordinateSystem, visibleHeight); // We snap it to the view port. /* Now we set the real value of y. */ - volumePointB1.y = viewPort.visibleArea.topLeft.y; - volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * coordinateSystem.scale.y; - volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * coordinateSystem.scale.y; - volumePointB4.y = viewPort.visibleArea.topLeft.y; + volumePointB1.y = canvas.chartSpace.viewport.visibleArea.topLeft.y; + volumePointB2.y = canvas.chartSpace.viewport.visibleArea.topLeft.y + volume.amountSell * coordinateSystem.scale.y; + volumePointB3.y = canvas.chartSpace.viewport.visibleArea.topLeft.y + volume.amountSell * coordinateSystem.scale.y; + volumePointB4.y = canvas.chartSpace.viewport.visibleArea.topLeft.y; } @@ -688,15 +688,15 @@ /* Everything must fit within the visible area */ - volumePointA1 = viewPort.fitIntoVisibleArea(volumePointA1); - volumePointA2 = viewPort.fitIntoVisibleArea(volumePointA2); - volumePointA3 = viewPort.fitIntoVisibleArea(volumePointA3); - volumePointA4 = viewPort.fitIntoVisibleArea(volumePointA4); + volumePointA1 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointA1); + volumePointA2 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointA2); + volumePointA3 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointA3); + volumePointA4 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointA4); - volumePointB1 = viewPort.fitIntoVisibleArea(volumePointB1); - volumePointB2 = viewPort.fitIntoVisibleArea(volumePointB2); - volumePointB3 = viewPort.fitIntoVisibleArea(volumePointB3); - volumePointB4 = viewPort.fitIntoVisibleArea(volumePointB4); + volumePointB1 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointB1); + volumePointB2 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointB2); + volumePointB3 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointB3); + volumePointB4 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointB4); volumePointA1 = thisObject.fitFunction(volumePointA1); volumePointA2 = thisObject.fitFunction(volumePointA2); From f1c8f4ab4c1c95f885b5fe11110c5e7a4767ba17 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 18 Jan 2020 12:11:57 +0100 Subject: [PATCH 145/176] Unused code removed --- Candles.js | 104 +---------------------------------------------------- 1 file changed, 1 insertion(+), 103 deletions(-) diff --git a/Candles.js b/Candles.js index 4af5529fe..0b2c66b54 100644 --- a/Candles.js +++ b/Candles.js @@ -26,8 +26,7 @@ // Secondary functions and properties. - currentCandle: undefined, - positionAtDatetime: positionAtDatetime + currentCandle: undefined }; /* this is part of the module template */ @@ -220,107 +219,6 @@ } - function positionAtDatetime(newDatetime) { - - try { - - value = newDatetime.valueOf(); - - /* Now we calculate which candle has this new time, because it will give us the y coordinate. */ - - let candleFound = false; - let lastClose; - - for (let i = 0; i < candles.length; i++) { - - lastClose = candles[i].close; - - if (value >= candles[i].begin && value <= candles[i].end) { - - candleFound = true; - - let targetPoint = { - x: value, - y: candles[i].open - }; - - targetPoint = coordinateSystem.transformThisPoint(targetPoint); - targetPoint = transformThisPoint(targetPoint, thisObject.container); - - let targetMax = { - x: value, - y: candles[i].max - }; - - targetMax = coordinateSystem.transformThisPoint(targetMax); - targetMax = transformThisPoint(targetMax, thisObject.container); - - let targetMin = { - x: value, - y: candles[i].min - }; - - targetMin = coordinateSystem.transformThisPoint(targetMin); - targetMin = transformThisPoint(targetMin, thisObject.container); - - let center = { - x: (canvas.chartSpace.viewport.visibleArea.bottomRight.x - canvas.chartSpace.viewport.visibleArea.bottomLeft.x) / 2, - y: (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topRight.y) / 2 - }; - - if (targetMax.y < canvas.chartSpace.viewport.visibleArea.topLeft.y || targetMin.y > canvas.chartSpace.viewport.visibleArea.bottomRight.y) { - - let displaceVector = { - x: 0, - y: center.y - targetPoint.y - }; - - canvas.chartSpace.viewport.displaceTarget(displaceVector); - - } - - let displaceVector = { - x: center.x - targetPoint.x, - y: 0 - }; - - canvas.chartSpace.viewport.displace(displaceVector); - - return; - } - } - - if (candleFound === false) { - - let targetPoint = { - x: value, - y: lastClose - }; - - targetPoint = coordinateSystem.transformThisPoint(targetPoint); - targetPoint = transformThisPoint(targetPoint, thisObject.container); - - let center = { - x: (canvas.chartSpace.viewport.visibleArea.bottomRight.x - canvas.chartSpace.viewport.visibleArea.bottomLeft.x) / 2, - y: (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topRight.y) / 2 - }; - - let displaceVector = { - x: center.x - targetPoint.x, - y: center.y - targetPoint.y - }; - - canvas.chartSpace.viewport.displace(displaceVector); - - return; - } - - } catch (err) { - - if (ERROR_LOG === true) { logger.write("[ERROR] positionAtDatetime -> err = " + err.stack); } - } - } - function onDailyFileLoaded(event) { try { From 43ccdf67f1b354a221193c87a5761927822e5f77 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 20 Jan 2020 15:29:45 +0100 Subject: [PATCH 146/176] allowing all candles to be plotted --- Candles.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Candles.js b/Candles.js index 0b2c66b54..008457f36 100644 --- a/Candles.js +++ b/Candles.js @@ -438,7 +438,7 @@ let maxValue = { x: MAX_PLOTABLE_DATE.valueOf(), - y: nextPorwerOf10(USDT_BTC_HTH) / 4 // TODO: This 4 is temporary + y: nextPorwerOf10(MAX_DEFAULT_RATE_SCALE_VALUE) / 4 // TODO: This 4 is temporary }; @@ -563,9 +563,9 @@ continue } - if (onScreenCandles.length < 5000) { + //if (onScreenCandles.length < 15000) { onScreenCandles.push(candle) - } + //} if (userPositionDate >= candle.begin && userPositionDate <= candle.end) { mouseCandle = candle From 7ce77c1ac3e2c30b53ddad7af88a3e322d4df3b0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 29 Jan 2020 10:25:21 +0100 Subject: [PATCH 147/176] showPanles functionality implemented --- CandlePanel.js | 6 ++++-- VolumePanel.js | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index f436bfb1a..297f02f66 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -4,6 +4,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { let thisObject = { fitFunction: undefined, container: undefined, + isVisible: true, onRecordChange: onRecordChange, draw: draw, getContainer: getContainer, @@ -24,6 +25,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { thisObject.container.finalize() thisObject.container = undefined thisObject.fitFunction = undefined + thisObject.isVisible = undefined currentCandle = undefined panelTabButton.finalize() @@ -46,7 +48,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { } function getContainer(point) { - + if (thisObject.isVisible !== true) { return } let container; container = panelTabButton.getContainer(point) @@ -76,7 +78,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { function draw() { - + if (thisObject.isVisible !== true) { return } thisObject.container.frame.draw(false, false, true, thisObject.fitFunction); plotCurrentCandleInfo(); diff --git a/VolumePanel.js b/VolumePanel.js index 4bcf3b2a0..04ecbefb5 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -4,6 +4,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { let thisObject = { fitFunction: undefined, container: undefined, + isVisible: true, onRecordChange: onRecordChange, draw: draw, getContainer: getContainer, @@ -24,6 +25,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.container.finalize() thisObject.container = undefined thisObject.fitFunction = undefined + thisObject.isVisible = undefined currentVolume = undefined panelTabButton.finalize() From 0f4cc4c20086a0c7307e5d71bb9fef51ccf8c200 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 29 Jan 2020 18:45:26 +0100 Subject: [PATCH 148/176] visible --- VolumePanel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VolumePanel.js b/VolumePanel.js index 04ecbefb5..50a3d726a 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -48,7 +48,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { } function getContainer(point) { - + if (thisObject.isVisible !== true) { return } let container; container = panelTabButton.getContainer(point) @@ -78,7 +78,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { function draw() { - + if (thisObject.isVisible !== true) { return } thisObject.container.frame.draw(false, false, true, thisObject.fitFunction); plotCurrentVolumeInfo(); From 73b9458396222a316892ea7222bcdf765ccd27f6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 30 Jan 2020 19:13:10 +0100 Subject: [PATCH 149/176] coordinateSystem going down to Plotters --- Candles.js | 15 +++++++++------ Volumes.js | 12 +++++++++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Candles.js b/Candles.js index 008457f36..9a2303e47 100644 --- a/Candles.js +++ b/Candles.js @@ -17,6 +17,7 @@ getContainer: getContainer, setTimeFrame: setTimeFrame, setDatetime: setDatetime, + setCoordinateSystem: setCoordinateSystem, draw: draw, recalculateScale: recalculateScale, @@ -34,7 +35,7 @@ thisObject.container = newContainer() thisObject.container.initialize(MODULE_NAME) - let coordinateSystem = newCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. + let coordinateSystem let timeFrame; // This will hold the current Time Frame the user is at. let datetime; // This will hold the current Datetime the user is at. @@ -82,13 +83,15 @@ fileCursor = undefined; thisObject.fitFunction = undefined + + coordinateSystem = undefined } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err = " + err.stack); } } } - function initialize(pStorage, pDatetime, pTimeFrame, callBackFunction) { + function initialize(pStorage, pDatetime, pTimeFrame, pCoordinateSystem, callBackFunction) { try { @@ -99,13 +102,12 @@ datetime = pDatetime; timeFrame = pTimeFrame; + coordinateSystem = pCoordinateSystem /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ marketFile = marketFiles.getFile(ONE_DAY_IN_MILISECONDS); // This file is the one processed faster. - recalculateScale(); - /* Now we set the right files according to current Period. */ marketFile = marketFiles.getFile(pTimeFrame); @@ -124,7 +126,6 @@ recalculate(); dimmensionsChangedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { - recalculateScale() recalculate(); }) @@ -214,9 +215,11 @@ } function setDatetime(pDatetime) { - datetime = pDatetime; + } + function setCoordinateSystem(pCoordinateSystem) { + coordinateSystem = pCoordinateSystem } function onDailyFileLoaded(event) { diff --git a/Volumes.js b/Volumes.js index fa7daab72..82521b61b 100644 --- a/Volumes.js +++ b/Volumes.js @@ -21,6 +21,7 @@ getContainer: getContainer, setTimeFrame: setTimeFrame, setDatetime: setDatetime, + setCoordinateSystem: setCoordinateSystem, recalculateScale: recalculateScale, draw: draw }; @@ -30,7 +31,7 @@ thisObject.container = newContainer() thisObject.container.initialize(MODULE_NAME) - let coordinateSystem = newCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. + let coordinateSystem let plotAreaFrame = newCoordinateSystem(); // This chart uses this extra object. let timeFrame; // This will hold the current Time Frame the user is at. @@ -81,13 +82,15 @@ fileCursor = undefined; thisObject.fitFunction = undefined + + coordinateSystem = undefined } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] finalize -> err = " + err.stack); } } } - function initialize(pStorage, pDatetime, pTimeFrame, callBackFunction) { + function initialize(pStorage, pDatetime, pTimeFrame, pCoordinateSystem, callBackFunction) { try { @@ -98,6 +101,7 @@ datetime = pDatetime; timeFrame = pTimeFrame; + coordinateSystem = pCoordinateSystem /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ @@ -234,9 +238,11 @@ } function setDatetime(pDatetime) { - datetime = pDatetime; + } + function setCoordinateSystem(pCoordinateSystem) { + coordinateSystem = pCoordinateSystem } function onDailyFileLoaded(event) { From b449ec4ad91be8ec13dca9d91c86f1bebde9efc4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 30 Jan 2020 22:04:48 +0100 Subject: [PATCH 150/176] no more getUserPosition --- Candles.js | 12 ++++++++---- Volumes.js | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Candles.js b/Candles.js index 9a2303e47..7daa2bf90 100644 --- a/Candles.js +++ b/Candles.js @@ -50,6 +50,7 @@ let candles = []; // Here we keep the candles to be ploted every time the Draw() function is called by the AAWebPlatform. + let onMouseOverEventSuscriptionId let zoomChangedEventSubscriptionId let offsetChangedEventSubscriptionId let dragFinishedEventSubscriptionId @@ -63,7 +64,7 @@ try { /* Stop listening to the necesary events. */ - + thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId) canvas.chartSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); canvas.chartSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); @@ -120,6 +121,7 @@ dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); + onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) /* Get ready for plotting. */ @@ -137,6 +139,11 @@ } } + function onMouseOver(event) { + let userPosition = getDateFromPoint(event, thisObject.container, coordinateSystem) + userPositionDate = userPosition.valueOf() + } + function getContainer(point) { try { @@ -462,9 +469,6 @@ try { - let userPosition = getUserPosition() - let userPositionDate = userPosition.point.x - if (candles.length > 0) { /* Now we calculate all the points. */ diff --git a/Volumes.js b/Volumes.js index 82521b61b..185fa070d 100644 --- a/Volumes.js +++ b/Volumes.js @@ -49,6 +49,7 @@ let volumes = []; // Here we keep the volumes to be ploted every time the Draw() function is called by the AAWebPlatform. + let onMouseOverEventSuscriptionId let zoomChangedEventSubscriptionId let offsetChangedEventSubscriptionId let dragFinishedEventSubscriptionId @@ -62,7 +63,7 @@ try { /* Stop listening to the necesary events. */ - + thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId) canvas.chartSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); canvas.chartSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); @@ -119,6 +120,7 @@ dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); + onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) /* Get ready for plotting. */ @@ -140,6 +142,11 @@ } } + function onMouseOver(event) { + let userPosition = getDateFromPoint(event, thisObject.container, coordinateSystem) + userPositionDate = userPosition.valueOf() + } + function recalculateScale() { recalculateScaleX(); @@ -522,9 +529,6 @@ try { - let userPosition = getUserPosition() - let userPositionDate = userPosition.point.x - if (volumes.length > 0) { /* Now we calculate and plot the volumes */ From 7692e3685d76c08554eb0051085a2d77d226ec5c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 31 Jan 2020 11:47:11 +0100 Subject: [PATCH 151/176] events at coordinate system --- Candles.js | 30 ++++++++++++++++++++++++++++-- Volumes.js | 30 ++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/Candles.js b/Candles.js index 7daa2bf90..9ea30488e 100644 --- a/Candles.js +++ b/Candles.js @@ -57,7 +57,9 @@ let dimmensionsChangedEventSubscriptionId let marketFilesUpdatedEventSubscriptionId let dailyFilesUpdatedEventSubscriptionId + let scaleChangedEventSubscriptionId + let userPositionDate return thisObject; function finalize() { @@ -85,6 +87,7 @@ thisObject.fitFunction = undefined + finalizeCoordinateSystem() coordinateSystem = undefined } catch (err) { @@ -104,6 +107,7 @@ datetime = pDatetime; timeFrame = pTimeFrame; coordinateSystem = pCoordinateSystem + initializeCoordinateSystem() /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ @@ -139,6 +143,18 @@ } } + function initializeCoordinateSystem() { + scaleChangedEventSubscriptionId = coordinateSystem.eventHandler.listenToEvent('Scale Changed', onScaleChanged) + } + + function finalizeCoordinateSystem() { + coordinateSystem.eventHandler.stopListening(scaleChangedEventSubscriptionId) + } + + function onScaleChanged() { + recalculate(); + } + function onMouseOver(event) { let userPosition = getDateFromPoint(event, thisObject.container, coordinateSystem) userPositionDate = userPosition.valueOf() @@ -226,7 +242,9 @@ } function setCoordinateSystem(pCoordinateSystem) { + finalizeCoordinateSystem() coordinateSystem = pCoordinateSystem + initializeCoordinateSystem() } function onDailyFileLoaded(event) { @@ -340,7 +358,11 @@ if (candle.open < candle.close) { candle.direction = 'up'; } if (candle.open === candle.close) { candle.direction = 'side'; } - if (candle.begin >= farLeftDate.valueOf() && candle.end <= farRightDate.valueOf()) { + + if ( + (candle.begin >= farLeftDate.valueOf() && candle.end <= farRightDate.valueOf()) && + (candle.begin >= coordinateSystem.min.x && candle.end <= coordinateSystem.max.x) + ) { candles.push(candle); @@ -416,7 +438,11 @@ if (candle.open < candle.close) { candle.direction = 'up'; } if (candle.open === candle.close) { candle.direction = 'side'; } - if (candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) { + if ( + (candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) && + (candle.begin >= coordinateSystem.min.x && candle.end <= coordinateSystem.max.x) + ) + { candles.push(candle); diff --git a/Volumes.js b/Volumes.js index 185fa070d..0a9a29236 100644 --- a/Volumes.js +++ b/Volumes.js @@ -56,7 +56,9 @@ let dimmensionsChangedEventSubscriptionId let marketFilesUpdatedEventSubscriptionId let dailyFilesUpdatedEventSubscriptionId + let scaleChangedEventSubscriptionId + let userPositionDate return thisObject; function finalize() { @@ -84,6 +86,7 @@ thisObject.fitFunction = undefined + finalizeCoordinateSystem() coordinateSystem = undefined } catch (err) { @@ -103,6 +106,7 @@ datetime = pDatetime; timeFrame = pTimeFrame; coordinateSystem = pCoordinateSystem + initializeCoordinateSystem() /* We need a Market File in order to calculate the Y scale, since this scale depends on actual data. */ @@ -142,6 +146,20 @@ } } + function initializeCoordinateSystem() { + scaleChangedEventSubscriptionId = coordinateSystem.eventHandler.listenToEvent('Scale Changed', onScaleChanged) + } + + function finalizeCoordinateSystem() { + coordinateSystem.eventHandler.stopListening(scaleChangedEventSubscriptionId) + } + + function onScaleChanged() { + recalculateScaleX(); + recalculate(); + recalculateScaleY(); + } + function onMouseOver(event) { let userPosition = getDateFromPoint(event, thisObject.container, coordinateSystem) userPositionDate = userPosition.valueOf() @@ -249,7 +267,9 @@ } function setCoordinateSystem(pCoordinateSystem) { + finalizeCoordinateSystem() coordinateSystem = pCoordinateSystem + initializeCoordinateSystem() } function onDailyFileLoaded(event) { @@ -353,7 +373,10 @@ volume.begin = dailyFile[i][2]; volume.end = dailyFile[i][3]; - if (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) { + if ( + (volume.begin >= farLeftDate.valueOf() && volume.end <= farRightDate.valueOf()) && + (volume.begin >= coordinateSystem.min.x && volume.end <= coordinateSystem.max.x) + ) { volumes.push(volume); @@ -424,7 +447,10 @@ volume.begin = marketFile[i][2]; volume.end = marketFile[i][3]; - if (volume.begin >= leftDate.valueOf() && volume.end <= rightDate.valueOf()) { + if ( + (volume.begin >= leftDate.valueOf() && volume.end <= rightDate.valueOf()) && + (volume.begin >= coordinateSystem.min.x && volume.end <= coordinateSystem.max.x) + ) { volumes.push(volume); From e3713f79d24f14aa2780562225d9195976929573 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 31 Jan 2020 19:57:23 +0100 Subject: [PATCH 152/176] Volumes Working --- Candles.js | 40 ------------- Volumes.js | 172 ++++------------------------------------------------- 2 files changed, 13 insertions(+), 199 deletions(-) diff --git a/Candles.js b/Candles.js index 9ea30488e..fda698682 100644 --- a/Candles.js +++ b/Candles.js @@ -7,9 +7,6 @@ logger.fileName = MODULE_NAME; let thisObject = { - - // Main functions and properties. - initialize: initialize, finalize: finalize, container: undefined, @@ -19,14 +16,7 @@ setDatetime: setDatetime, setCoordinateSystem: setCoordinateSystem, draw: draw, - recalculateScale: recalculateScale, - - /* Events declared outside the plotter. */ - onDailyFileLoaded: onDailyFileLoaded, - - // Secondary functions and properties. - currentCandle: undefined }; @@ -461,36 +451,6 @@ } } - function recalculateScale() { - - try { - - if (coordinateSystem.maxValue > 0) { return; } // Already calculated. - - let minValue = { - x: MIN_PLOTABLE_DATE.valueOf(), - y: 0 - }; - - let maxValue = { - x: MAX_PLOTABLE_DATE.valueOf(), - y: nextPorwerOf10(MAX_DEFAULT_RATE_SCALE_VALUE) / 4 // TODO: This 4 is temporary - }; - - - coordinateSystem.initialize( - minValue, - maxValue, - thisObject.container.frame.width, - thisObject.container.frame.height - ); - - } catch (err) { - - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> err = " + err.stack); } - } - } - function plotChart() { try { diff --git a/Volumes.js b/Volumes.js index 0a9a29236..45c956855 100644 --- a/Volumes.js +++ b/Volumes.js @@ -32,7 +32,6 @@ thisObject.container.initialize(MODULE_NAME) let coordinateSystem - let plotAreaFrame = newCoordinateSystem(); // This chart uses this extra object. let timeFrame; // This will hold the current Time Frame the user is at. let datetime; // This will hold the current Datetime the user is at. @@ -128,14 +127,10 @@ /* Get ready for plotting. */ - recalculateScaleX(); recalculate(); - recalculateScaleY(); - + dimmensionsChangedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { - recalculateScaleX(); recalculate(); - recalculateScaleY(); }) callBackFunction(); @@ -155,9 +150,7 @@ } function onScaleChanged() { - recalculateScaleX(); recalculate(); - recalculateScaleY(); } function onMouseOver(event) { @@ -166,11 +159,7 @@ } function recalculateScale() { - - recalculateScaleX(); recalculate(); - recalculateScaleY(); - } function getContainer(point) { @@ -203,9 +192,7 @@ let newMarketFile = marketFiles.getFile(timeFrame); if (newMarketFile !== undefined) { marketFile = newMarketFile; - recalculateScaleX(); recalculate(); - recalculateScaleY(); } } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] onMarketFilesUpdated -> err = " + err.stack); } @@ -217,9 +204,7 @@ let newFileCursor = dailyFiles.getFileCursor(timeFrame); if (newFileCursor !== undefined) { fileCursor = newFileCursor; - recalculateScaleX(); recalculate(); - recalculateScaleY(); } } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFilesUpdated -> err = " + err.stack); } @@ -274,21 +259,9 @@ function onDailyFileLoaded(event) { - try { - - if (event.currentValue === event.totalValue) { - - /* This happens only when all of the files in the cursor have been loaded. */ - - recalculateScaleX(); - recalculate(); - recalculateScaleY(); - - } - - } catch (err) { - - if (ERROR_LOG === true) { logger.write("[ERROR] onDailyFileLoaded -> err = " + err.stack); } + if (event.currentValue === event.totalValue) { + /* This happens only when all of the files in the cursor have been loaded. */ + recalculate(); } } @@ -309,25 +282,12 @@ } function recalculate() { - - try { - - if (timeFrame >= _1_HOUR_IN_MILISECONDS) { - - recalculateUsingMarketFiles(); - - } else { - - recalculateUsingDailyFiles(); - - } - - thisObject.container.eventHandler.raiseEvent("Volumes Changed", volumes); - - } catch (err) { - - if (ERROR_LOG === true) { logger.write("[ERROR] recalculate -> err = " + err.stack); } + if (timeFrame >= _1_HOUR_IN_MILISECONDS) { + recalculateUsingMarketFiles(); + } else { + recalculateUsingDailyFiles(); } + thisObject.container.eventHandler.raiseEvent("Volumes Changed", volumes); } function recalculateUsingDailyFiles() { @@ -470,87 +430,6 @@ } } - function recalculateScaleX() { - - try { - - let minValue = { - x: MIN_PLOTABLE_DATE.valueOf() - }; - - let maxValue = { - x: MAX_PLOTABLE_DATE.valueOf() - }; - - coordinateSystem.initializeX( - minValue, - maxValue, - thisObject.container.frame.width - ); - - plotAreaFrame.initializeX( - minValue, - maxValue, - thisObject.container.frame.width - ); - - } catch (err) { - - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScaleX -> err = " + err.stack); } - } - } - - function recalculateScaleY() { - - try { - - let minValue = { - y: 0 - }; - - let maxValue = { - y: 0 - }; - - let timeFrameRatio = ONE_DAY_IN_MILISECONDS / timeFrame; - - maxValue.y = getMaxVolume() / (timeFrameRatio / 2.5); - - coordinateSystem.initializeY( - minValue, - maxValue, - canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topLeft.y - ); - - plotAreaFrame.initializeY( - minValue, - maxValue, - thisObject.container.frame.height - ); - - function getMaxVolume() { - - let maxValue = 0; - - for (let i = 0; i < scaleFile.length; i++) { - - let currentMax = (scaleFile[i][0] + scaleFile[i][1]) * 4; - - if (maxValue < currentMax) { - maxValue = currentMax; - } - } - - return maxValue; - - } - - } catch (err) { - - if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScaleY -> err = " + err.stack); } - } - } - function plotChart() { try { @@ -635,7 +514,7 @@ } - if (calculateBuys(plotAreaFrame, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. + if (calculateBuys(coordinateSystem, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. if (volumePointA1.y > canvas.chartSpace.viewport.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { @@ -689,7 +568,7 @@ } - calculateSells(plotAreaFrame, thisObject.container.frame.height); // We try to see if it fits in the visible area. + calculateSells(coordinateSystem, thisObject.container.frame.height); // We try to see if it fits in the visible area. if (volumePointB1.y < canvas.chartSpace.viewport.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { @@ -830,7 +709,6 @@ thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentVolume); } - } } } @@ -842,17 +720,7 @@ } function onViewportZoomChanged(event) { - - try { - - recalculateScaleX(); - recalculate(); - recalculateScaleY(); - - } catch (err) { - - if (ERROR_LOG === true) { logger.write("[ERROR] onViewportZoomChanged -> err = " + err.stack); } - } + recalculate() } function onViewportPositionChanged(event) { @@ -860,16 +728,12 @@ try { if (event !== undefined) { if (event.recalculate === true) { - recalculateScaleX(); recalculate(); - recalculateScaleY(); return } } if (Math.random() * 100 > 95) { - recalculateScaleX(); recalculate(); - recalculateScaleY(); }; } catch (err) { @@ -879,17 +743,7 @@ } function onDragFinished() { - - try { - - recalculateScaleX(); - recalculate(); - recalculateScaleY(); - - } catch (err) { - - if (ERROR_LOG === true) { logger.write("[ERROR] onDragFinished -> err = " + err.stack); } - } + recalculate(); } } From 32da960032b23e7eff81b21fcc0ad31db260359c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 31 Jan 2020 20:34:56 +0100 Subject: [PATCH 153/176] Volumes not leaving viewport --- Volumes.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/Volumes.js b/Volumes.js index 45c956855..1ecb4f859 100644 --- a/Volumes.js +++ b/Volumes.js @@ -516,17 +516,12 @@ if (calculateBuys(coordinateSystem, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. - if (volumePointA1.y > canvas.chartSpace.viewport.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - - if (calculateBuys(coordinateSystem, visibleHeight) === false) { continue; } // We snap t to the view port. - - /* Now we set the real value of y. */ - - volumePointA1.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y; - volumePointA2.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y - volume.amountBuy * coordinateSystem.scale.y; - volumePointA3.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y - volume.amountBuy * coordinateSystem.scale.y; - volumePointA4.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y; - + let diffA = volumePointA1.y - canvas.chartSpace.viewport.visibleArea.bottomLeft.y + if (diffA > 0) { + volumePointA1.y = volumePointA1.y - diffA + volumePointA2.y = volumePointA2.y - diffA + volumePointA3.y = volumePointA3.y - diffA + volumePointA4.y = volumePointA4.y - diffA } let volumePointB1; @@ -570,17 +565,12 @@ calculateSells(coordinateSystem, thisObject.container.frame.height); // We try to see if it fits in the visible area. - if (volumePointB1.y < canvas.chartSpace.viewport.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - - calculateSells(coordinateSystem, visibleHeight); // We snap it to the view port. - - /* Now we set the real value of y. */ - - volumePointB1.y = canvas.chartSpace.viewport.visibleArea.topLeft.y; - volumePointB2.y = canvas.chartSpace.viewport.visibleArea.topLeft.y + volume.amountSell * coordinateSystem.scale.y; - volumePointB3.y = canvas.chartSpace.viewport.visibleArea.topLeft.y + volume.amountSell * coordinateSystem.scale.y; - volumePointB4.y = canvas.chartSpace.viewport.visibleArea.topLeft.y; - + let diffB = volumePointB1.y - canvas.chartSpace.viewport.visibleArea.topLeft.y + if (diffB < 0) { + volumePointB1.y = volumePointB1.y - diffB + volumePointB2.y = volumePointB2.y - diffB + volumePointB3.y = volumePointB3.y - diffB + volumePointB4.y = volumePointB4.y - diffB } /* We put a wider base */ From 9e2e96138f26ffd0e29fffadfa94a8750b4ae65a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 31 Jan 2020 20:49:53 +0100 Subject: [PATCH 154/176] Candles not going out of viewport --- Candles.js | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/Candles.js b/Candles.js index fda698682..8d7838387 100644 --- a/Candles.js +++ b/Candles.js @@ -492,16 +492,6 @@ candle.candlePoint3 = transformThisPoint(candle.candlePoint3, thisObject.container); candle.candlePoint4 = transformThisPoint(candle.candlePoint4, thisObject.container); - candle.candlePoint1 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint1); - candle.candlePoint2 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint2); - candle.candlePoint3 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint3); - candle.candlePoint4 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint4); - - candle.candlePoint1 = thisObject.fitFunction(candle.candlePoint1); - candle.candlePoint2 = thisObject.fitFunction(candle.candlePoint2); - candle.candlePoint3 = thisObject.fitFunction(candle.candlePoint3); - candle.candlePoint4 = thisObject.fitFunction(candle.candlePoint4); - candle.stickPoint1 = { x: candle.begin + timeFrame / 7 * 3.2, y: candle.max @@ -532,6 +522,42 @@ candle.stickPoint3 = transformThisPoint(candle.stickPoint3, thisObject.container); candle.stickPoint4 = transformThisPoint(candle.stickPoint4, thisObject.container); + let diffA = candle.stickPoint3.y - canvas.chartSpace.viewport.visibleArea.bottomLeft.y + if (diffA > 0) { + candle.candlePoint1.y = candle.candlePoint1.y - diffA + candle.candlePoint2.y = candle.candlePoint2.y - diffA + candle.candlePoint3.y = candle.candlePoint3.y - diffA + candle.candlePoint4.y = candle.candlePoint4.y - diffA + + candle.stickPoint1.y = candle.stickPoint1.y - diffA + candle.stickPoint2.y = candle.stickPoint2.y - diffA + candle.stickPoint3.y = candle.stickPoint3.y - diffA + candle.stickPoint4.y = candle.stickPoint4.y - diffA + } + + let diffB = candle.stickPoint1.y - canvas.chartSpace.viewport.visibleArea.topLeft.y + if (diffB < 0) { + candle.candlePoint1.y = candle.candlePoint1.y - diffB + candle.candlePoint2.y = candle.candlePoint2.y - diffB + candle.candlePoint3.y = candle.candlePoint3.y - diffB + candle.candlePoint4.y = candle.candlePoint4.y - diffB + + candle.stickPoint1.y = candle.stickPoint1.y - diffB + candle.stickPoint2.y = candle.stickPoint2.y - diffB + candle.stickPoint3.y = candle.stickPoint3.y - diffB + candle.stickPoint4.y = candle.stickPoint4.y - diffB + } + + candle.candlePoint1 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint1); + candle.candlePoint2 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint2); + candle.candlePoint3 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint3); + candle.candlePoint4 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint4); + + candle.candlePoint1 = thisObject.fitFunction(candle.candlePoint1); + candle.candlePoint2 = thisObject.fitFunction(candle.candlePoint2); + candle.candlePoint3 = thisObject.fitFunction(candle.candlePoint3); + candle.candlePoint4 = thisObject.fitFunction(candle.candlePoint4); + candle.stickPoint1 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint1); candle.stickPoint2 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint2); candle.stickPoint3 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint3); From 162dcc7951b988a05d02621e4dc0a042d0081673 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 12 Feb 2020 19:16:58 +0100 Subject: [PATCH 155/176] Refactoring --- Candles.js | 10 +++++----- Volumes.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Candles.js b/Candles.js index 8d7838387..71af87418 100644 --- a/Candles.js +++ b/Candles.js @@ -146,7 +146,7 @@ } function onMouseOver(event) { - let userPosition = getDateFromPoint(event, thisObject.container, coordinateSystem) + let userPosition = getDateFromPointAtBrowserCanvas(event, thisObject.container, coordinateSystem) userPositionDate = userPosition.valueOf() } @@ -303,8 +303,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -393,8 +393,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); diff --git a/Volumes.js b/Volumes.js index 1ecb4f859..18d564740 100644 --- a/Volumes.js +++ b/Volumes.js @@ -154,7 +154,7 @@ } function onMouseOver(event) { - let userPosition = getDateFromPoint(event, thisObject.container, coordinateSystem) + let userPosition = getDateFromPointAtBrowserCanvas(event, thisObject.container, coordinateSystem) userPositionDate = userPosition.valueOf() } @@ -298,8 +298,8 @@ if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -382,8 +382,8 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. - let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); From 9c9120c9f1f0baaba6ebc54c98916fc9ad3071fb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 14 Feb 2020 07:49:08 +0100 Subject: [PATCH 156/176] autoscale --- Candles.js | 5 +++++ Volumes.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Candles.js b/Candles.js index 71af87418..cf10c3d57 100644 --- a/Candles.js +++ b/Candles.js @@ -582,6 +582,11 @@ continue } + /* Contributing to Auto-Scale*/ + coordinateSystem.reportValue(candle.max) + coordinateSystem.reportValue(candle.min) + + //if (onScreenCandles.length < 15000) { onScreenCandles.push(candle) //} diff --git a/Volumes.js b/Volumes.js index 18d564740..3d4a72f56 100644 --- a/Volumes.js +++ b/Volumes.js @@ -699,6 +699,10 @@ thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentVolume); } + /* Contributing to Auto-Scale*/ + coordinateSystem.reportValue(volume.amountBuy * 5) + coordinateSystem.reportValue(volume.amountSell * 5) + coordinateSystem.reportValue(0) } } } From f6595c2df7686c6b3f1874f4652d08c16802d17a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 14 Feb 2020 21:54:33 +0100 Subject: [PATCH 157/176] for special effect --- CandlePanel.js | 4 +- Candles.js | 101 +++++++++++++++++++++++++++++-------------------- VolumePanel.js | 4 +- Volumes.js | 46 +++++++++++----------- 4 files changed, 86 insertions(+), 69 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 297f02f66..4ee162d6d 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -37,8 +37,8 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - thisObject.container.frame.position.x = canvas.chartSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width * 2; - thisObject.container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; + thisObject.container.frame.position.x = canvas.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width * 2; + thisObject.container.frame.position.y = canvas.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; panelTabButton = newPanelTabButton() panelTabButton.parentContainer = thisObject.container diff --git a/Candles.js b/Candles.js index cf10c3d57..adabe9ed2 100644 --- a/Candles.js +++ b/Candles.js @@ -57,8 +57,8 @@ /* Stop listening to the necesary events. */ thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId) - canvas.chartSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); - canvas.chartSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); + canvas.chartingSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); + canvas.chartingSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId); @@ -110,8 +110,8 @@ /* Listen to the necesary events. */ - zoomChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); - offsetChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); + zoomChangedEventSubscriptionId = canvas.chartingSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); + offsetChangedEventSubscriptionId = canvas.chartingSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); @@ -303,8 +303,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -348,6 +348,13 @@ if (candle.open < candle.close) { candle.direction = 'up'; } if (candle.open === candle.close) { candle.direction = 'side'; } + /* Contributing to Auto-Scale*/ + if (i === 0) { + coordinateSystem.reportXValue(candle.begin) + } + if (i === dailyFile.length - 1) { + coordinateSystem.reportXValue(candle.end) + } if ( (candle.begin >= farLeftDate.valueOf() && candle.end <= farRightDate.valueOf()) && @@ -393,8 +400,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -428,6 +435,14 @@ if (candle.open < candle.close) { candle.direction = 'up'; } if (candle.open === candle.close) { candle.direction = 'side'; } + /* Contributing to Auto-Scale*/ + if (i === 0) { + coordinateSystem.reportXValue(candle.begin) + } + if (i === marketFile.length - 1) { + coordinateSystem.reportXValue(candle.end) + } + if ( (candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) && (candle.begin >= coordinateSystem.min.x && candle.end <= coordinateSystem.max.x) @@ -522,46 +537,48 @@ candle.stickPoint3 = transformThisPoint(candle.stickPoint3, thisObject.container); candle.stickPoint4 = transformThisPoint(candle.stickPoint4, thisObject.container); - let diffA = candle.stickPoint3.y - canvas.chartSpace.viewport.visibleArea.bottomLeft.y - if (diffA > 0) { - candle.candlePoint1.y = candle.candlePoint1.y - diffA - candle.candlePoint2.y = candle.candlePoint2.y - diffA - candle.candlePoint3.y = candle.candlePoint3.y - diffA - candle.candlePoint4.y = candle.candlePoint4.y - diffA + if (canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT) { + let diffA = candle.stickPoint3.y - canvas.chartingSpace.viewport.visibleArea.bottomLeft.y + if (diffA > 0) { + candle.candlePoint1.y = candle.candlePoint1.y - diffA + candle.candlePoint2.y = candle.candlePoint2.y - diffA + candle.candlePoint3.y = candle.candlePoint3.y - diffA + candle.candlePoint4.y = candle.candlePoint4.y - diffA - candle.stickPoint1.y = candle.stickPoint1.y - diffA - candle.stickPoint2.y = candle.stickPoint2.y - diffA - candle.stickPoint3.y = candle.stickPoint3.y - diffA - candle.stickPoint4.y = candle.stickPoint4.y - diffA + candle.stickPoint1.y = candle.stickPoint1.y - diffA + candle.stickPoint2.y = candle.stickPoint2.y - diffA + candle.stickPoint3.y = candle.stickPoint3.y - diffA + candle.stickPoint4.y = candle.stickPoint4.y - diffA + } + + let diffB = candle.stickPoint1.y - canvas.chartingSpace.viewport.visibleArea.topLeft.y + if (diffB < 0) { + candle.candlePoint1.y = candle.candlePoint1.y - diffB + candle.candlePoint2.y = candle.candlePoint2.y - diffB + candle.candlePoint3.y = candle.candlePoint3.y - diffB + candle.candlePoint4.y = candle.candlePoint4.y - diffB + + candle.stickPoint1.y = candle.stickPoint1.y - diffB + candle.stickPoint2.y = candle.stickPoint2.y - diffB + candle.stickPoint3.y = candle.stickPoint3.y - diffB + candle.stickPoint4.y = candle.stickPoint4.y - diffB + } } - let diffB = candle.stickPoint1.y - canvas.chartSpace.viewport.visibleArea.topLeft.y - if (diffB < 0) { - candle.candlePoint1.y = candle.candlePoint1.y - diffB - candle.candlePoint2.y = candle.candlePoint2.y - diffB - candle.candlePoint3.y = candle.candlePoint3.y - diffB - candle.candlePoint4.y = candle.candlePoint4.y - diffB - - candle.stickPoint1.y = candle.stickPoint1.y - diffB - candle.stickPoint2.y = candle.stickPoint2.y - diffB - candle.stickPoint3.y = candle.stickPoint3.y - diffB - candle.stickPoint4.y = candle.stickPoint4.y - diffB - } - - candle.candlePoint1 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint1); - candle.candlePoint2 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint2); - candle.candlePoint3 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint3); - candle.candlePoint4 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.candlePoint4); + candle.candlePoint1 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint1); + candle.candlePoint2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint2); + candle.candlePoint3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint3); + candle.candlePoint4 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint4); candle.candlePoint1 = thisObject.fitFunction(candle.candlePoint1); candle.candlePoint2 = thisObject.fitFunction(candle.candlePoint2); candle.candlePoint3 = thisObject.fitFunction(candle.candlePoint3); candle.candlePoint4 = thisObject.fitFunction(candle.candlePoint4); - candle.stickPoint1 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint1); - candle.stickPoint2 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint2); - candle.stickPoint3 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint3); - candle.stickPoint4 = canvas.chartSpace.viewport.fitIntoVisibleArea(candle.stickPoint4); + candle.stickPoint1 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint1); + candle.stickPoint2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint2); + candle.stickPoint3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint3); + candle.stickPoint4 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint4); candle.stickPoint1 = thisObject.fitFunction(candle.stickPoint1); candle.stickPoint2 = thisObject.fitFunction(candle.stickPoint2); @@ -578,13 +595,13 @@ candle = candles[i]; - if (candle.candlePoint2.x < canvas.chartSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartSpace.viewport.visibleArea.bottomRight.x) { + if (candle.candlePoint2.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) { continue } /* Contributing to Auto-Scale*/ - coordinateSystem.reportValue(candle.max) - coordinateSystem.reportValue(candle.min) + coordinateSystem.reportYValue(candle.max) + coordinateSystem.reportYValue(candle.min) //if (onScreenCandles.length < 15000) { diff --git a/VolumePanel.js b/VolumePanel.js index 50a3d726a..0ac28e3f7 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -37,8 +37,8 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - thisObject.container.frame.position.x = canvas.chartSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width; - thisObject.container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; + thisObject.container.frame.position.x = canvas.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width; + thisObject.container.frame.position.y = canvas.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; panelTabButton = newPanelTabButton() panelTabButton.parentContainer = thisObject.container diff --git a/Volumes.js b/Volumes.js index 3d4a72f56..19ff0c473 100644 --- a/Volumes.js +++ b/Volumes.js @@ -65,8 +65,8 @@ /* Stop listening to the necesary events. */ thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId) - canvas.chartSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); - canvas.chartSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); + canvas.chartingSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); + canvas.chartingSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId); @@ -118,8 +118,8 @@ /* Listen to the necesary events. */ - zoomChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); - offsetChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); + zoomChangedEventSubscriptionId = canvas.chartingSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); + offsetChangedEventSubscriptionId = canvas.chartingSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); @@ -298,8 +298,8 @@ if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -382,8 +382,8 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. - let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -438,7 +438,7 @@ /* Now we calculate and plot the volumes */ - let visibleHeight = canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topLeft.y; + let visibleHeight = canvas.chartingSpace.viewport.visibleArea.bottomRight.y - canvas.chartingSpace.viewport.visibleArea.topLeft.y; let frameCorner1 = { x: 0, @@ -506,7 +506,7 @@ volumePointA1.x = volumePointA1.x - baseIncrement; volumePointA4.x = volumePointA4.x + baseIncrement; - if (volumePointA4.x < canvas.chartSpace.viewport.visibleArea.bottomLeft.x || volumePointA1.x > canvas.chartSpace.viewport.visibleArea.bottomRight.x) { + if (volumePointA4.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || volumePointA1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) { return false; } @@ -516,7 +516,7 @@ if (calculateBuys(coordinateSystem, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. - let diffA = volumePointA1.y - canvas.chartSpace.viewport.visibleArea.bottomLeft.y + let diffA = volumePointA1.y - canvas.chartingSpace.viewport.visibleArea.bottomLeft.y if (diffA > 0) { volumePointA1.y = volumePointA1.y - diffA volumePointA2.y = volumePointA2.y - diffA @@ -565,7 +565,7 @@ calculateSells(coordinateSystem, thisObject.container.frame.height); // We try to see if it fits in the visible area. - let diffB = volumePointB1.y - canvas.chartSpace.viewport.visibleArea.topLeft.y + let diffB = volumePointB1.y - canvas.chartingSpace.viewport.visibleArea.topLeft.y if (diffB < 0) { volumePointB1.y = volumePointB1.y - diffB volumePointB2.y = volumePointB2.y - diffB @@ -593,15 +593,15 @@ /* Everything must fit within the visible area */ - volumePointA1 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointA1); - volumePointA2 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointA2); - volumePointA3 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointA3); - volumePointA4 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointA4); + volumePointA1 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointA1); + volumePointA2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointA2); + volumePointA3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointA3); + volumePointA4 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointA4); - volumePointB1 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointB1); - volumePointB2 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointB2); - volumePointB3 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointB3); - volumePointB4 = canvas.chartSpace.viewport.fitIntoVisibleArea(volumePointB4); + volumePointB1 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointB1); + volumePointB2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointB2); + volumePointB3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointB3); + volumePointB4 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointB4); volumePointA1 = thisObject.fitFunction(volumePointA1); volumePointA2 = thisObject.fitFunction(volumePointA2); @@ -700,9 +700,9 @@ } /* Contributing to Auto-Scale*/ - coordinateSystem.reportValue(volume.amountBuy * 5) - coordinateSystem.reportValue(volume.amountSell * 5) - coordinateSystem.reportValue(0) + coordinateSystem.reportYValue(volume.amountBuy * 5) + coordinateSystem.reportYValue(volume.amountSell * 5) + coordinateSystem.reportYValue(0) } } } From 48f368b351c412cc24c4bb4c668df1dae84adc31 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 1 Mar 2020 15:35:35 +0100 Subject: [PATCH 158/176] Low Res Implementation --- Candles.js | 47 +++++++++++++++++++++++++++++++++-------------- Volumes.js | 32 ++++++++++++++++++++++---------- 2 files changed, 55 insertions(+), 24 deletions(-) diff --git a/Candles.js b/Candles.js index adabe9ed2..40c883bcd 100644 --- a/Candles.js +++ b/Candles.js @@ -470,6 +470,13 @@ try { + let lowResolution = false + if (canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { + if (candles.length > 100) { + lowResolution = true + } + } + if (candles.length > 0) { /* Now we calculate all the points. */ @@ -627,13 +634,17 @@ } browserCanvasContext.closePath(); - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; - browserCanvasContext.fill(); - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; - browserCanvasContext.lineWidth = 1; - browserCanvasContext.setLineDash([0, 0]) - browserCanvasContext.stroke(); + if (lowResolution === false) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; + browserCanvasContext.fill(); + + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; + browserCanvasContext.lineWidth = 1; + browserCanvasContext.setLineDash([0, 0]) + browserCanvasContext.stroke(); + + } /* The stick at the mouse candle */ if (mouseCandle) { @@ -647,8 +658,11 @@ browserCanvasContext.lineTo(candle.stickPoint4.x, candle.stickPoint4.y); browserCanvasContext.closePath(); - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; - browserCanvasContext.fill(); + + if (lowResolution === false) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; + browserCanvasContext.fill(); + } browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; browserCanvasContext.lineWidth = 1; @@ -676,23 +690,28 @@ browserCanvasContext.lineTo(candle.candlePoint2.x, candle.candlePoint2.y); browserCanvasContext.lineTo(candle.candlePoint3.x, candle.candlePoint3.y); browserCanvasContext.lineTo(candle.candlePoint4.x, candle.candlePoint4.y); + browserCanvasContext.lineTo(candle.candlePoint1.x, candle.candlePoint1.y); } browserCanvasContext.closePath(); + if (lowResolution === false) { + + if (direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } + if (direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } + if (direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } + + browserCanvasContext.fill(); + } + if (direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 1)'; } if (direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 1)'; } if (direction === 'side') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } - if (direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 1)'; } - if (direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)'; } - if (direction === 'side') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; } - - browserCanvasContext.fill(); - browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); + } /* Draw mouse candel and Raise Event. */ diff --git a/Volumes.js b/Volumes.js index 19ff0c473..bc187fced 100644 --- a/Volumes.js +++ b/Volumes.js @@ -434,6 +434,13 @@ try { + let lowResolution = false + if (canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { + if (volumes.length > 100) { + lowResolution = true + } + } + if (volumes.length > 0) { /* Now we calculate and plot the volumes */ @@ -640,19 +647,21 @@ browserCanvasContext.closePath(); - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 0.40)'; + if (lowResolution === false) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', 0.40)'; - if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current bar accroding to time + if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current bar accroding to time + } } browserCanvasContext.fill(); + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 0.40)'; browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); - - + browserCanvasContext.beginPath(); browserCanvasContext.moveTo(volumePointB1.x, volumePointB1.y); @@ -662,19 +671,22 @@ browserCanvasContext.closePath(); - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 0.40)'; + if (lowResolution === false) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 0.40)'; - if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current volume accroding to time + if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 0.40)'; // Current volume accroding to time + } + + browserCanvasContext.fill(); } browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', 0.40)'; - browserCanvasContext.fill(); browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); - + if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { let buyInfo = { From 0e64069d14f3edad32f8d6a3272930cc7108891a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 3 Mar 2020 21:12:24 +0100 Subject: [PATCH 159/176] switch to 24hs --- Candles.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Candles.js b/Candles.js index 40c883bcd..915ece46e 100644 --- a/Candles.js +++ b/Candles.js @@ -263,7 +263,7 @@ thisObject.container.frame.draw(); - plotChart(); + return plotChart(); } catch (err) { @@ -469,7 +469,7 @@ function plotChart() { try { - + let elementsPlotted = 0 let lowResolution = false if (canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { if (candles.length > 100) { @@ -691,6 +691,8 @@ browserCanvasContext.lineTo(candle.candlePoint3.x, candle.candlePoint3.y); browserCanvasContext.lineTo(candle.candlePoint4.x, candle.candlePoint4.y); browserCanvasContext.lineTo(candle.candlePoint1.x, candle.candlePoint1.y); + + elementsPlotted++ } browserCanvasContext.closePath(); @@ -746,7 +748,7 @@ thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentCandle); } } - + return elementsPlotted } catch (err) { if (ERROR_LOG === true) { logger.write("[ERROR] plotChart -> err = " + err.stack); } From 36ec138e3d1f16a61bac64c0345721b35a9802c2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 4 Mar 2020 09:17:37 +0100 Subject: [PATCH 160/176] Update Candles.js --- Candles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Candles.js b/Candles.js index 915ece46e..0f0280b9a 100644 --- a/Candles.js +++ b/Candles.js @@ -694,7 +694,7 @@ elementsPlotted++ } - + browserCanvasContext.closePath(); if (lowResolution === false) { From 6fc0231651c5b714b31a91168734e8a1a600fe8e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Mar 2020 20:59:21 +0100 Subject: [PATCH 161/176] Rafactoring --- CandlePanel.js | 2 +- Candles.js | 2 +- VolumePanel.js | 2 +- Volumes.js | 2 +- this.plotter.config.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 4ee162d6d..c993af980 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -1,5 +1,5 @@  -function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { +function newMastersPlottersCandlesVolumesCandlesCandlePanel() { let thisObject = { fitFunction: undefined, diff --git a/Candles.js b/Candles.js index 0f0280b9a..73963ce56 100644 --- a/Candles.js +++ b/Candles.js @@ -1,4 +1,4 @@ -function newAAMastersPlottersCandlesVolumesCandles() { +function newMastersPlottersCandlesVolumesCandles() { const MODULE_NAME = "Candles Plotter"; const ERROR_LOG = true; diff --git a/VolumePanel.js b/VolumePanel.js index 0ac28e3f7..972d326aa 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -1,5 +1,5 @@  -function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { +function newMastersPlottersCandlesVolumesVolumesVolumePanel() { let thisObject = { fitFunction: undefined, diff --git a/Volumes.js b/Volumes.js index bc187fced..1e2415327 100644 --- a/Volumes.js +++ b/Volumes.js @@ -1,4 +1,4 @@ -function newAAMastersPlottersCandlesVolumesVolumes() { +function newMastersPlottersCandlesVolumesVolumes() { const MODULE_NAME = "Volumes Plotter"; const ERROR_LOG = true; diff --git a/this.plotter.config.json b/this.plotter.config.json index 1f777a5af..5ac90a9dc 100644 --- a/this.plotter.config.json +++ b/this.plotter.config.json @@ -1,7 +1,7 @@ { "displayName": "Plotters Candles & Volumes", "codeName": "PlottersCandlesVolumes", - "dataMine": "AAMasters", + "dataMine": "Masters", "modules": [ { "codeName": "Candles", From d19b39c05cdd7fd4a7a849af83a52d98e5a6f20c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Mar 2020 13:31:44 +0100 Subject: [PATCH 162/176] No candles with zero open --- Candles.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Candles.js b/Candles.js index 73963ce56..0f9eea85d 100644 --- a/Candles.js +++ b/Candles.js @@ -602,6 +602,9 @@ candle = candles[i]; + /* Skip the first candle with zero at open */ + if (candle.open === 0) { continue } + if (candle.candlePoint2.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) { continue } From 0406dcb177ff9cf2b4989851ef456441eba1588e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Mar 2020 08:12:24 +0100 Subject: [PATCH 163/176] refactoring --- CandlePanel.js | 20 ++++++++++---------- VolumePanel.js | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index c993af980..cd7240781 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -17,7 +17,7 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { thisObject.container.frame.containerName = "Candle"; let currentCandle; - let panelTabButton + let upDownButton return thisObject; @@ -28,8 +28,8 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { thisObject.isVisible = undefined currentCandle = undefined - panelTabButton.finalize() - panelTabButton = undefined + upDownButton.finalize() + upDownButton = undefined } function initialize() { @@ -40,18 +40,18 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { thisObject.container.frame.position.x = canvas.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width * 2; thisObject.container.frame.position.y = canvas.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; - panelTabButton = newPanelTabButton() - panelTabButton.parentContainer = thisObject.container - panelTabButton.container.frame.parentFrame = thisObject.container.frame - panelTabButton.fitFunction = thisObject.fitFunction - panelTabButton.initialize() + upDownButton = newUpDownButton() + upDownButton.parentContainer = thisObject.container + upDownButton.container.frame.parentFrame = thisObject.container.frame + upDownButton.fitFunction = thisObject.fitFunction + upDownButton.initialize() } function getContainer(point) { if (thisObject.isVisible !== true) { return } let container; - container = panelTabButton.getContainer(point) + container = upDownButton.getContainer(point) if (container !== undefined) { return container } if (thisObject.container.frame.isThisPointHere(point, true) === true) { @@ -83,7 +83,7 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { plotCurrentCandleInfo(); - panelTabButton.draw() + upDownButton.draw() } diff --git a/VolumePanel.js b/VolumePanel.js index 972d326aa..0d872ec4f 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -17,7 +17,7 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.container.frame.containerName = "Volume"; let currentVolume; - let panelTabButton + let upDownButton return thisObject; @@ -28,8 +28,8 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.isVisible = undefined currentVolume = undefined - panelTabButton.finalize() - panelTabButton = undefined + upDownButton.finalize() + upDownButton = undefined } function initialize() { @@ -40,18 +40,18 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.container.frame.position.x = canvas.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width; thisObject.container.frame.position.y = canvas.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; - panelTabButton = newPanelTabButton() - panelTabButton.parentContainer = thisObject.container - panelTabButton.container.frame.parentFrame = thisObject.container.frame - panelTabButton.fitFunction = thisObject.fitFunction - panelTabButton.initialize() + upDownButton = newUpDownButton() + upDownButton.parentContainer = thisObject.container + upDownButton.container.frame.parentFrame = thisObject.container.frame + upDownButton.fitFunction = thisObject.fitFunction + upDownButton.initialize() } function getContainer(point) { if (thisObject.isVisible !== true) { return } let container; - container = panelTabButton.getContainer(point) + container = upDownButton.getContainer(point) if (container !== undefined) { return container } if (thisObject.container.frame.isThisPointHere(point, true) === true) { @@ -83,7 +83,7 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { plotCurrentVolumeInfo(); - panelTabButton.draw() + upDownButton.draw() } function plotCurrentVolumeInfo() { From fc126835d958acdf1b6e644434030605587df856 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Mar 2020 13:38:18 +0100 Subject: [PATCH 164/176] Limits on candle width --- CandlePanel.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/CandlePanel.js b/CandlePanel.js index cd7240781..1cb8ba1b3 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -202,6 +202,65 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { } + const leftLimit = thisObject.container.frame.width * 0.40; + const rightLimit = thisObject.container.frame.width * 0.60; + + if (candlePoint1.x < leftLimit) { + + candlePoint1.x = leftLimit; + candlePoint4.x = leftLimit; + + } + + if (stickPoint1.x < leftLimit) { + + stickPoint1.x = leftLimit; + stickPoint4.x = leftLimit; + + } + + if (candlePoint4.x < leftLimit) { + + candlePoint4.x = leftLimit; + candlePoint1.x = leftLimit; + + } + + if (stickPoint4.x < leftLimit) { + + stickPoint4.x = leftLimit; + stickPoint1.x = leftLimit; + + } + + if (candlePoint2.x > rightLimit) { + + candlePoint2.x = rightLimit; + candlePoint3.x = rightLimit; + + } + + if (stickPoint2.x > rightLimit) { + + stickPoint2.x = rightLimit; + stickPoint3.x = rightLimit; + + } + + if (candlePoint3.x > rightLimit) { + + candlePoint3.x = rightLimit; + candlePoint2.x = rightLimit; + + } + + if (stickPoint3.x > rightLimit) { + + stickPoint3.x = rightLimit; + stickPoint2.x = rightLimit; + + } + candlePoint1 = thisObject.container.frame.frameThisPoint(candlePoint1); candlePoint2 = thisObject.container.frame.frameThisPoint(candlePoint2); From 501d8b8ca40b1cd261086b81655b8b1069b08d01 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Mar 2020 14:12:52 +0100 Subject: [PATCH 165/176] limits fixed --- VolumePanel.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/VolumePanel.js b/VolumePanel.js index 0d872ec4f..60854383e 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -118,6 +118,28 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { y: Y_AXIS_BUY }; + /* Extra bounderies due to constrained space */ + + const upperLimit = frameTitleHeight + frameBodyHeight * 0.15; + const downLimit = frameTitleHeight + frameBodyHeight * 0.85; + + const leftLimit = thisObject.container.frame.width * 0.40; + const rightLimit = thisObject.container.frame.width * 0.60; + + if (buyVolumePoint1.y < downLimit) { buyVolumePoint1.y = downLimit; } + if (buyVolumePoint4.y < downLimit) { buyVolumePoint4.y = downLimit; } + + if (buyVolumePoint2.y < upperLimit) { buyVolumePoint2.y = upperLimit; } + if (buyVolumePoint3.y < upperLimit) { buyVolumePoint3.y = upperLimit; } + + if (buyVolumePoint1.x < leftLimit) { buyVolumePoint1.x = leftLimit; } + if (buyVolumePoint2.x < leftLimit) { buyVolumePoint2.x = leftLimit; } + + if (buyVolumePoint3.x > rightLimit) { buyVolumePoint3.x = rightLimit; } + if (buyVolumePoint4.x > rightLimit) { buyVolumePoint4.x = rightLimit; } + + + buyVolumePoint1 = thisObject.container.frame.fitIntoFrame(buyVolumePoint1); buyVolumePoint2 = thisObject.container.frame.fitIntoFrame(buyVolumePoint2); buyVolumePoint3 = thisObject.container.frame.fitIntoFrame(buyVolumePoint3); @@ -153,6 +175,18 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { y: Y_AXIS_SELL }; + if (sellVolumePoint1.y < upperLimit) { sellVolumePoint1.y = upperLimit; } + if (sellVolumePoint4.y < upperLimit) { sellVolumePoint4.y = upperLimit; } + + if (sellVolumePoint2.y > downLimit) { sellVolumePoint2.y = downLimit; } + if (sellVolumePoint3.y > downLimit) { sellVolumePoint3.y = downLimit; } + + if (sellVolumePoint1.x < leftLimit) { sellVolumePoint1.x = leftLimit; } + if (sellVolumePoint2.x < leftLimit) { sellVolumePoint2.x = leftLimit; } + + if (sellVolumePoint3.x > rightLimit) { sellVolumePoint3.x = rightLimit; } + if (sellVolumePoint4.x > rightLimit) { sellVolumePoint4.x = rightLimit; } + sellVolumePoint1 = thisObject.container.frame.fitIntoFrame(sellVolumePoint1); sellVolumePoint2 = thisObject.container.frame.fitIntoFrame(sellVolumePoint2); sellVolumePoint3 = thisObject.container.frame.fitIntoFrame(sellVolumePoint3); @@ -168,6 +202,8 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { sellVolumePoint3 = thisObject.fitFunction(sellVolumePoint3) sellVolumePoint4 = thisObject.fitFunction(sellVolumePoint4) + + const OPACITY = '0.40'; browserCanvasContext.beginPath(); From 9025b25a64f3573cab331c651d72f3423ffe3132 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Mar 2020 11:39:01 +0100 Subject: [PATCH 166/176] removing printLabel --- VolumePanel.js | 42 ++++-------------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/VolumePanel.js b/VolumePanel.js index 60854383e..ff7672fa3 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -241,47 +241,13 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { browserCanvasContext.lineWidth = 1; browserCanvasContext.stroke(); - /* put the labels with the volumes values */ - browserCanvasContext.beginPath(); + printLabel('Buy Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(currentVolume.innerVolumeBar.amountBuy, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel('Buy Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '1'); - printLabel(currentVolume.innerVolumeBar.amountBuy, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '0.50'); - - printLabel('Sell Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '1'); - printLabel(currentVolume.innerVolumeBar.amountSell, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '0.50'); - - - function printLabel(labelToPrint, x, y, opacity) { - - let labelPoint; - let fontSize = 10; - - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY + ' Saira'; - - let label = '' + labelToPrint; - if (isNaN(label) === false) { - label = Number(label).toLocaleString(); - } - - let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO; - - labelPoint = { - x: x - xOffset, - y: y - }; - - labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); - labelPoint = thisObject.fitFunction(labelPoint) - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'; - browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); - - } - - browserCanvasContext.closePath(); - browserCanvasContext.fill(); + printLabel('Sell Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(currentVolume.innerVolumeBar.amountSell, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); } From 8cdf22f956761fa59035ef1e2d10f3cd49df3e1d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Mar 2020 12:17:35 +0100 Subject: [PATCH 167/176] printLabel standarized --- CandlePanel.js | 60 +++++++++----------------------------------------- 1 file changed, 10 insertions(+), 50 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 1cb8ba1b3..e6c255403 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -202,8 +202,8 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { } - const leftLimit = thisObject.container.frame.width * 0.40; - const rightLimit = thisObject.container.frame.width * 0.60; + const leftLimit = thisObject.container.frame.width * 0.42; + const rightLimit = thisObject.container.frame.width * 0.58; if (candlePoint1.x < leftLimit) { @@ -320,73 +320,33 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { browserCanvasContext.lineWidth = 1; browserCanvasContext.stroke(); - - browserCanvasContext.beginPath(); - /* put the labels with the candles values */ - - - let y; - printLabel('Max', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '1'); - printLabel(currentCandle.innerCandle.max, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '0.50'); - - printLabel('Min', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '1'); - printLabel(currentCandle.innerCandle.min, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '0.50'); + printLabel('Max', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(currentCandle.innerCandle.max, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel('Min', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(currentCandle.innerCandle.min, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); y = Y_AXIS - currentCandle.bodyHeight / 2; if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } - printLabel('Open', X_AXIS * 1 / 2, y, '1'); - printLabel(currentCandle.innerCandle.open, X_AXIS * 1 / 2, y + frameBodyHeight * 0.05, '0.50'); + printLabel('Open', X_AXIS * 2 / 5, y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(currentCandle.innerCandle.open, X_AXIS * 2 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); y = Y_AXIS + currentCandle.bodyHeight / 2; if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } - printLabel('Close', X_AXIS * 3 / 2, y, '1'); - printLabel(currentCandle.innerCandle.close, X_AXIS * 3 / 2, y + frameBodyHeight * 0.05, '0.50'); - - - - function printLabel(labelToPrint, x, y, opacity) { - - let labelPoint; - let fontSize = 10; - - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY + ' Saira'; - - let label = '' + labelToPrint; - if (isNaN(label) === false) { - label = Number(label).toLocaleString(); - } - let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO; - - labelPoint = { - x: x - xOffset, - y: y - }; - - labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); - labelPoint = thisObject.fitFunction(labelPoint) - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'; - browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); - - } - - browserCanvasContext.closePath(); - browserCanvasContext.fill(); + printLabel('Close', X_AXIS * 7 / 5, y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(currentCandle.innerCandle.close, X_AXIS * 7 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); } - - } From bc9c3d15fa4054753df35e8738bc710dad1cdf71 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 10 Oct 2020 12:36:54 +0200 Subject: [PATCH 168/176] Charting Details Fixed --- Candles.js | 40 ++++++++++++++++++++-------------------- Volumes.js | 7 +++---- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Candles.js b/Candles.js index 0f9eea85d..9fd121278 100644 --- a/Candles.js +++ b/Candles.js @@ -445,9 +445,8 @@ if ( (candle.begin >= leftDate.valueOf() && candle.end <= rightDate.valueOf()) && - (candle.begin >= coordinateSystem.min.x && candle.end <= coordinateSystem.max.x) - ) - { + (candle.begin >= coordinateSystem.min.x && candle.end <= coordinateSystem.max.x) + ) { candles.push(candle); @@ -479,6 +478,10 @@ if (candles.length > 0) { + /* On screen candles */ + let onScreenCandles = [] + let mouseCandle + /* Now we calculate all the points. */ for (let i = 0; i < candles.length; i++) { @@ -514,6 +517,15 @@ candle.candlePoint3 = transformThisPoint(candle.candlePoint3, thisObject.container); candle.candlePoint4 = transformThisPoint(candle.candlePoint4, thisObject.container); + /* Skip the first candle with zero at open */ + if (candle.open === 0) { continue } + + if (candle.candlePoint2.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) { + continue + } + + addToOnScreenCandles(candle) + candle.stickPoint1 = { x: candle.begin + timeFrame / 7 * 3.2, y: candle.max @@ -591,23 +603,11 @@ candle.stickPoint2 = thisObject.fitFunction(candle.stickPoint2); candle.stickPoint3 = thisObject.fitFunction(candle.stickPoint3); candle.stickPoint4 = thisObject.fitFunction(candle.stickPoint4); - } - /* On screen candles */ - let onScreenCandles = [] - let mouseCandle - for (let i = 0; i < candles.length; i++) { - - candle = candles[i]; - /* Skip the first candle with zero at open */ - if (candle.open === 0) { continue } - - if (candle.candlePoint2.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) { - continue - } + function addToOnScreenCandles(candle) { /* Contributing to Auto-Scale*/ coordinateSystem.reportYValue(candle.max) @@ -615,7 +615,7 @@ //if (onScreenCandles.length < 15000) { - onScreenCandles.push(candle) + onScreenCandles.push(candle) //} if (userPositionDate >= candle.begin && userPositionDate <= candle.end) { @@ -641,7 +641,7 @@ if (lowResolution === false) { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', 1)'; browserCanvasContext.fill(); - + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT + ', 1)'; browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) @@ -697,7 +697,7 @@ elementsPlotted++ } - + browserCanvasContext.closePath(); if (lowResolution === false) { @@ -716,7 +716,7 @@ browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); - + } /* Draw mouse candel and Raise Event. */ diff --git a/Volumes.js b/Volumes.js index 1e2415327..0c0117ce4 100644 --- a/Volumes.js +++ b/Volumes.js @@ -128,7 +128,7 @@ /* Get ready for plotting. */ recalculate(); - + dimmensionsChangedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function () { recalculate(); }) @@ -567,7 +567,6 @@ volumePointB2 = transformThisPoint(volumePointB2, thisObject.container); volumePointB3 = transformThisPoint(volumePointB3, thisObject.container); volumePointB4 = transformThisPoint(volumePointB4, thisObject.container); - } calculateSells(coordinateSystem, thisObject.container.frame.height); // We try to see if it fits in the visible area. @@ -661,7 +660,7 @@ browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); - + browserCanvasContext.beginPath(); browserCanvasContext.moveTo(volumePointB1.x, volumePointB1.y); @@ -686,7 +685,7 @@ browserCanvasContext.lineWidth = 1; browserCanvasContext.setLineDash([0, 0]) browserCanvasContext.stroke(); - + if (userPositionDate >= volume.begin && userPositionDate <= volume.end) { let buyInfo = { From 9763723a33a99bcde52be1618e12f1287cf84f9b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 19 Oct 2020 12:08:00 +0200 Subject: [PATCH 169/176] UI Object --- CandlePanel.js | 4 ++-- Candles.js | 42 +++++++++++++++++++++--------------------- VolumePanel.js | 4 ++-- Volumes.js | 42 +++++++++++++++++++++--------------------- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index e6c255403..9cf318b4c 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -37,8 +37,8 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - thisObject.container.frame.position.x = canvas.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width * 2; - thisObject.container.frame.position.y = canvas.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; + thisObject.container.frame.position.x = UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width * 2; + thisObject.container.frame.position.y = UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; upDownButton = newUpDownButton() upDownButton.parentContainer = thisObject.container diff --git a/Candles.js b/Candles.js index 9fd121278..0f522eef5 100644 --- a/Candles.js +++ b/Candles.js @@ -57,8 +57,8 @@ /* Stop listening to the necesary events. */ thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId) - canvas.chartingSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); - canvas.chartingSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); + UI.projects.superalgos.spaces.chartingSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); + UI.projects.superalgos.spaces.chartingSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId); @@ -110,8 +110,8 @@ /* Listen to the necesary events. */ - zoomChangedEventSubscriptionId = canvas.chartingSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); - offsetChangedEventSubscriptionId = canvas.chartingSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); + zoomChangedEventSubscriptionId = UI.projects.superalgos.spaces.chartingSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); + offsetChangedEventSubscriptionId = UI.projects.superalgos.spaces.chartingSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); @@ -303,8 +303,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -400,8 +400,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -470,7 +470,7 @@ try { let elementsPlotted = 0 let lowResolution = false - if (canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { + if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { if (candles.length > 100) { lowResolution = true } @@ -520,7 +520,7 @@ /* Skip the first candle with zero at open */ if (candle.open === 0) { continue } - if (candle.candlePoint2.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) { + if (candle.candlePoint2.x < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.x) { continue } @@ -556,8 +556,8 @@ candle.stickPoint3 = transformThisPoint(candle.stickPoint3, thisObject.container); candle.stickPoint4 = transformThisPoint(candle.stickPoint4, thisObject.container); - if (canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT) { - let diffA = candle.stickPoint3.y - canvas.chartingSpace.viewport.visibleArea.bottomLeft.y + if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT) { + let diffA = candle.stickPoint3.y - UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.y if (diffA > 0) { candle.candlePoint1.y = candle.candlePoint1.y - diffA candle.candlePoint2.y = candle.candlePoint2.y - diffA @@ -570,7 +570,7 @@ candle.stickPoint4.y = candle.stickPoint4.y - diffA } - let diffB = candle.stickPoint1.y - canvas.chartingSpace.viewport.visibleArea.topLeft.y + let diffB = candle.stickPoint1.y - UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft.y if (diffB < 0) { candle.candlePoint1.y = candle.candlePoint1.y - diffB candle.candlePoint2.y = candle.candlePoint2.y - diffB @@ -584,20 +584,20 @@ } } - candle.candlePoint1 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint1); - candle.candlePoint2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint2); - candle.candlePoint3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint3); - candle.candlePoint4 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint4); + candle.candlePoint1 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint1); + candle.candlePoint2 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint2); + candle.candlePoint3 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint3); + candle.candlePoint4 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(candle.candlePoint4); candle.candlePoint1 = thisObject.fitFunction(candle.candlePoint1); candle.candlePoint2 = thisObject.fitFunction(candle.candlePoint2); candle.candlePoint3 = thisObject.fitFunction(candle.candlePoint3); candle.candlePoint4 = thisObject.fitFunction(candle.candlePoint4); - candle.stickPoint1 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint1); - candle.stickPoint2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint2); - candle.stickPoint3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint3); - candle.stickPoint4 = canvas.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint4); + candle.stickPoint1 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint1); + candle.stickPoint2 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint2); + candle.stickPoint3 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint3); + candle.stickPoint4 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(candle.stickPoint4); candle.stickPoint1 = thisObject.fitFunction(candle.stickPoint1); candle.stickPoint2 = thisObject.fitFunction(candle.stickPoint2); diff --git a/VolumePanel.js b/VolumePanel.js index ff7672fa3..b2257317b 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -37,8 +37,8 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - thisObject.container.frame.position.x = canvas.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width; - thisObject.container.frame.position.y = canvas.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; + thisObject.container.frame.position.x = UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width; + thisObject.container.frame.position.y = UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height; upDownButton = newUpDownButton() upDownButton.parentContainer = thisObject.container diff --git a/Volumes.js b/Volumes.js index 0c0117ce4..1affc8581 100644 --- a/Volumes.js +++ b/Volumes.js @@ -65,8 +65,8 @@ /* Stop listening to the necesary events. */ thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId) - canvas.chartingSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); - canvas.chartingSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); + UI.projects.superalgos.spaces.chartingSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); + UI.projects.superalgos.spaces.chartingSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId) marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId); @@ -118,8 +118,8 @@ /* Listen to the necesary events. */ - zoomChangedEventSubscriptionId = canvas.chartingSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); - offsetChangedEventSubscriptionId = canvas.chartingSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); + zoomChangedEventSubscriptionId = UI.projects.superalgos.spaces.chartingSpace.viewport.eventHandler.listenToEvent("Zoom Changed", onViewportZoomChanged); + offsetChangedEventSubscriptionId = UI.projects.superalgos.spaces.chartingSpace.viewport.eventHandler.listenToEvent("Position Changed", onViewportPositionChanged); dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); @@ -298,8 +298,8 @@ if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -382,8 +382,8 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. - let leftDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(canvas.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -435,7 +435,7 @@ try { let lowResolution = false - if (canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { + if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { if (volumes.length > 100) { lowResolution = true } @@ -445,7 +445,7 @@ /* Now we calculate and plot the volumes */ - let visibleHeight = canvas.chartingSpace.viewport.visibleArea.bottomRight.y - canvas.chartingSpace.viewport.visibleArea.topLeft.y; + let visibleHeight = UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.y - UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft.y; let frameCorner1 = { x: 0, @@ -513,7 +513,7 @@ volumePointA1.x = volumePointA1.x - baseIncrement; volumePointA4.x = volumePointA4.x + baseIncrement; - if (volumePointA4.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || volumePointA1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) { + if (volumePointA4.x < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x || volumePointA1.x > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.x) { return false; } @@ -523,7 +523,7 @@ if (calculateBuys(coordinateSystem, thisObject.container.frame.height) === false) { continue; } // We try to see if it fits in the visible area. - let diffA = volumePointA1.y - canvas.chartingSpace.viewport.visibleArea.bottomLeft.y + let diffA = volumePointA1.y - UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.y if (diffA > 0) { volumePointA1.y = volumePointA1.y - diffA volumePointA2.y = volumePointA2.y - diffA @@ -571,7 +571,7 @@ calculateSells(coordinateSystem, thisObject.container.frame.height); // We try to see if it fits in the visible area. - let diffB = volumePointB1.y - canvas.chartingSpace.viewport.visibleArea.topLeft.y + let diffB = volumePointB1.y - UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft.y if (diffB < 0) { volumePointB1.y = volumePointB1.y - diffB volumePointB2.y = volumePointB2.y - diffB @@ -599,15 +599,15 @@ /* Everything must fit within the visible area */ - volumePointA1 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointA1); - volumePointA2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointA2); - volumePointA3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointA3); - volumePointA4 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointA4); + volumePointA1 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(volumePointA1); + volumePointA2 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(volumePointA2); + volumePointA3 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(volumePointA3); + volumePointA4 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(volumePointA4); - volumePointB1 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointB1); - volumePointB2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointB2); - volumePointB3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointB3); - volumePointB4 = canvas.chartingSpace.viewport.fitIntoVisibleArea(volumePointB4); + volumePointB1 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(volumePointB1); + volumePointB2 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(volumePointB2); + volumePointB3 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(volumePointB3); + volumePointB4 = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(volumePointB4); volumePointA1 = thisObject.fitFunction(volumePointA1); volumePointA2 = thisObject.fitFunction(volumePointA2); From 4ba63819c301e9c9d567aced7333f1c0711c8aa3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 19 Oct 2020 19:12:36 +0200 Subject: [PATCH 170/176] coordinateTransformations --- Candles.js | 16 ++++++++-------- Volumes.js | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Candles.js b/Candles.js index 0f522eef5..0631a72cf 100644 --- a/Candles.js +++ b/Candles.js @@ -512,10 +512,10 @@ candle.candlePoint3 = coordinateSystem.transformThisPoint(candle.candlePoint3); candle.candlePoint4 = coordinateSystem.transformThisPoint(candle.candlePoint4); - candle.candlePoint1 = transformThisPoint(candle.candlePoint1, thisObject.container); - candle.candlePoint2 = transformThisPoint(candle.candlePoint2, thisObject.container); - candle.candlePoint3 = transformThisPoint(candle.candlePoint3, thisObject.container); - candle.candlePoint4 = transformThisPoint(candle.candlePoint4, thisObject.container); + candle.candlePoint1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.candlePoint1, thisObject.container); + candle.candlePoint2 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.candlePoint2, thisObject.container); + candle.candlePoint3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.candlePoint3, thisObject.container); + candle.candlePoint4 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.candlePoint4, thisObject.container); /* Skip the first candle with zero at open */ if (candle.open === 0) { continue } @@ -551,10 +551,10 @@ candle.stickPoint3 = coordinateSystem.transformThisPoint(candle.stickPoint3); candle.stickPoint4 = coordinateSystem.transformThisPoint(candle.stickPoint4); - candle.stickPoint1 = transformThisPoint(candle.stickPoint1, thisObject.container); - candle.stickPoint2 = transformThisPoint(candle.stickPoint2, thisObject.container); - candle.stickPoint3 = transformThisPoint(candle.stickPoint3, thisObject.container); - candle.stickPoint4 = transformThisPoint(candle.stickPoint4, thisObject.container); + candle.stickPoint1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.stickPoint1, thisObject.container); + candle.stickPoint2 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.stickPoint2, thisObject.container); + candle.stickPoint3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.stickPoint3, thisObject.container); + candle.stickPoint4 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.stickPoint4, thisObject.container); if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT) { let diffA = candle.stickPoint3.y - UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.y diff --git a/Volumes.js b/Volumes.js index 1affc8581..7f0fc4688 100644 --- a/Volumes.js +++ b/Volumes.js @@ -460,8 +460,8 @@ /* Now the transformations. */ - frameCorner1 = transformThisPoint(frameCorner1, thisObject.container.frame.container); - frameCorner2 = transformThisPoint(frameCorner2, thisObject.container.frame.container); + frameCorner1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(frameCorner1, thisObject.container.frame.container); + frameCorner2 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(frameCorner2, thisObject.container.frame.container); let frameHeightInViewPort = frameCorner2.y - frameCorner1.y; @@ -503,10 +503,10 @@ volumePointA3 = plot.transformThisPoint(volumePointA3); volumePointA4 = plot.transformThisPoint(volumePointA4); - volumePointA1 = transformThisPoint(volumePointA1, thisObject.container); - volumePointA2 = transformThisPoint(volumePointA2, thisObject.container); - volumePointA3 = transformThisPoint(volumePointA3, thisObject.container); - volumePointA4 = transformThisPoint(volumePointA4, thisObject.container); + volumePointA1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(volumePointA1, thisObject.container); + volumePointA2 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(volumePointA2, thisObject.container); + volumePointA3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(volumePointA3, thisObject.container); + volumePointA4 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(volumePointA4, thisObject.container); let baseIncrement = (volumePointA3.x - volumePointA1.x) * WIDHTER_VOLUME_BAR_BASE_FACTOR; @@ -563,10 +563,10 @@ volumePointB3 = plot.transformThisPoint2(volumePointB3); volumePointB4 = plot.transformThisPoint2(volumePointB4); - volumePointB1 = transformThisPoint(volumePointB1, thisObject.container); - volumePointB2 = transformThisPoint(volumePointB2, thisObject.container); - volumePointB3 = transformThisPoint(volumePointB3, thisObject.container); - volumePointB4 = transformThisPoint(volumePointB4, thisObject.container); + volumePointB1 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(volumePointB1, thisObject.container); + volumePointB2 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(volumePointB2, thisObject.container); + volumePointB3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(volumePointB3, thisObject.container); + volumePointB4 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(volumePointB4, thisObject.container); } calculateSells(coordinateSystem, thisObject.container.frame.height); // We try to see if it fits in the visible area. From 9490957c0687a4cfacf00ce21a9dcbe580586831 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 19 Oct 2020 19:22:07 +0200 Subject: [PATCH 171/176] dateRateTransformations --- Candles.js | 10 +++++----- Volumes.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Candles.js b/Candles.js index 0631a72cf..8d97669fe 100644 --- a/Candles.js +++ b/Candles.js @@ -146,7 +146,7 @@ } function onMouseOver(event) { - let userPosition = getDateFromPointAtBrowserCanvas(event, thisObject.container, coordinateSystem) + let userPosition = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(event, thisObject.container, coordinateSystem) userPositionDate = userPosition.valueOf() } @@ -303,8 +303,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -400,8 +400,8 @@ let daysOnSides = getSideDays(timeFrame); - let leftDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); diff --git a/Volumes.js b/Volumes.js index 7f0fc4688..29f6f9dcd 100644 --- a/Volumes.js +++ b/Volumes.js @@ -154,7 +154,7 @@ } function onMouseOver(event) { - let userPosition = getDateFromPointAtBrowserCanvas(event, thisObject.container, coordinateSystem) + let userPosition = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(event, thisObject.container, coordinateSystem) userPositionDate = userPosition.valueOf() } @@ -298,8 +298,8 @@ if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor - let leftDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); @@ -382,8 +382,8 @@ if (marketFile === undefined) { return; } // Initialization not complete yet. - let leftDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); - let rightDate = getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); + let leftDate = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem); + let rightDate = UI.projects.superalgos.utilities.dateRateTransformations.getDateFromPointAtBrowserCanvas(UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem); let dateDiff = rightDate.valueOf() - leftDate.valueOf(); From 19bfc1b01d4846a4b34899d816799c07c89eb697 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 19 Oct 2020 19:42:14 +0200 Subject: [PATCH 172/176] drawPrint --- CandlePanel.js | 16 ++++++++-------- VolumePanel.js | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 9cf318b4c..34247d6d2 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -324,27 +324,27 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { let y; - printLabel('Max', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel(currentCandle.innerCandle.max, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Max', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.max, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel('Min', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel(currentCandle.innerCandle.min, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Min', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.min, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); y = Y_AXIS - currentCandle.bodyHeight / 2; if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } - printLabel('Open', X_AXIS * 2 / 5, y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel(currentCandle.innerCandle.open, X_AXIS * 2 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Open', X_AXIS * 2 / 5, y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.open, X_AXIS * 2 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); y = Y_AXIS + currentCandle.bodyHeight / 2; if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } - printLabel('Close', X_AXIS * 7 / 5, y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel(currentCandle.innerCandle.close, X_AXIS * 7 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Close', X_AXIS * 7 / 5, y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.close, X_AXIS * 7 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); } } diff --git a/VolumePanel.js b/VolumePanel.js index b2257317b..87ce98777 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -243,11 +243,11 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { /* put the labels with the volumes values */ - printLabel('Buy Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel(currentVolume.innerVolumeBar.amountBuy, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Buy Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentVolume.innerVolumeBar.amountBuy, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel('Sell Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel(currentVolume.innerVolumeBar.amountSell, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Sell Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentVolume.innerVolumeBar.amountSell, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); } From cd1caf4e4806efbd9b31b17d6f259941f1675165 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 20 Oct 2020 13:05:27 +0200 Subject: [PATCH 173/176] Globals Ready --- Candles.js | 4 ++-- Volumes.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Candles.js b/Candles.js index 8d97669fe..28a48c4b7 100644 --- a/Candles.js +++ b/Candles.js @@ -470,7 +470,7 @@ try { let elementsPlotted = 0 let lowResolution = false - if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { + if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < UI.projects.superalgos.globals.zoom.ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { if (candles.length > 100) { lowResolution = true } @@ -556,7 +556,7 @@ candle.stickPoint3 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.stickPoint3, thisObject.container); candle.stickPoint4 = UI.projects.superalgos.utilities.coordinateTransformations.transformThisPoint(candle.stickPoint4, thisObject.container); - if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT) { + if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < UI.projects.superalgos.globals.zoom.ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT) { let diffA = candle.stickPoint3.y - UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.y if (diffA > 0) { candle.candlePoint1.y = candle.candlePoint1.y - diffA diff --git a/Volumes.js b/Volumes.js index 29f6f9dcd..ea0306bb2 100644 --- a/Volumes.js +++ b/Volumes.js @@ -435,7 +435,7 @@ try { let lowResolution = false - if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { + if (UI.projects.superalgos.spaces.chartingSpace.viewport.zoomTargetLevel < UI.projects.superalgos.globals.zoom.ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION) { if (volumes.length > 100) { lowResolution = true } From 6441457bd0a7b3870d6a75ded0a0ca8b1b3bd033 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 7 Nov 2020 19:14:04 +0100 Subject: [PATCH 174/176] Bug Fixed --- Candles.js | 4 ++-- Volumes.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Candles.js b/Candles.js index 28a48c4b7..a2ada6de4 100644 --- a/Candles.js +++ b/Candles.js @@ -317,7 +317,7 @@ while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { - let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); + let stringDate = currentDate.getUTCFullYear() + '-' + pad(currentDate.getUTCMonth() + 1, 2) + '-' + pad(currentDate.getUTCDate(), 2); let dailyFile = fileCursor.files.get(stringDate); @@ -383,7 +383,7 @@ if (candles.length > 0) { if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { - setTimeout(recalculate, 2000); + //setTimeout(recalculate, 2000); } } } catch (err) { diff --git a/Volumes.js b/Volumes.js index ea0306bb2..cf5691eee 100644 --- a/Volumes.js +++ b/Volumes.js @@ -312,7 +312,7 @@ while (currentDate.valueOf() <= farRightDate.valueOf() + ONE_DAY_IN_MILISECONDS) { - let stringDate = currentDate.getFullYear() + '-' + pad(currentDate.getMonth() + 1, 2) + '-' + pad(currentDate.getDate(), 2); + let stringDate = currentDate.getUTCFullYear() + '-' + pad(currentDate.getUTCMonth() + 1, 2) + '-' + pad(currentDate.getUTCDate(), 2); let dailyFile = fileCursor.files.get(stringDate); From cbe15536124633e30172066efc4ac4aed831139c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 8 Nov 2020 09:45:57 +0100 Subject: [PATCH 175/176] Update Candles.js --- Candles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Candles.js b/Candles.js index a2ada6de4..46aba26b6 100644 --- a/Candles.js +++ b/Candles.js @@ -383,7 +383,7 @@ if (candles.length > 0) { if (candles[0].begin > lowerEnd || candles[candles.length - 1].end < upperEnd) { - //setTimeout(recalculate, 2000); + setTimeout(recalculate, 2000); } } } catch (err) { From 90afb4ea2f2ba0e5ec115f62cf34f7d3a9197dbe Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Nov 2020 11:45:26 +0100 Subject: [PATCH 176/176] Panel Improvements --- CandlePanel.js | 16 ++++++++-------- VolumePanel.js | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CandlePanel.js b/CandlePanel.js index 34247d6d2..c223aaa74 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -324,27 +324,27 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() { let y; - UI.projects.superalgos.utilities.drawPrint.printLabel('Max', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.max, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Max', undefined, undefined, X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, 'Center', thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.max, undefined, undefined, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, 'Center', thisObject.container, thisObject.fitFunction); - UI.projects.superalgos.utilities.drawPrint.printLabel('Min', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.min, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Min', undefined, undefined, X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, 'Center', thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.min, undefined, undefined, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, 'Center', thisObject.container, thisObject.fitFunction); y = Y_AXIS - currentCandle.bodyHeight / 2; if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } - UI.projects.superalgos.utilities.drawPrint.printLabel('Open', X_AXIS * 2 / 5, y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.open, X_AXIS * 2 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Open', undefined, undefined, X_AXIS * 2 / 5, y, '0.60', undefined, undefined, 'Center', thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.open, undefined, undefined, X_AXIS * 2 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, 'Center', thisObject.container, thisObject.fitFunction); y = Y_AXIS + currentCandle.bodyHeight / 2; if (y < frameTitleHeight + frameBodyHeight * 0.15) { y = frameTitleHeight + frameBodyHeight * 0.15; } if (y > frameTitleHeight + frameBodyHeight * 0.80) { y = frameTitleHeight + frameBodyHeight * 0.80; } - UI.projects.superalgos.utilities.drawPrint.printLabel('Close', X_AXIS * 7 / 5, y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.close, X_AXIS * 7 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Close', undefined, undefined, X_AXIS * 7 / 5, y, '0.60', undefined, undefined, 'Center', thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentCandle.innerCandle.close, undefined, undefined, X_AXIS * 7 / 5, y + frameBodyHeight * 0.05, '1.00', 15, undefined, 'Center', thisObject.container, thisObject.fitFunction); } } diff --git a/VolumePanel.js b/VolumePanel.js index 87ce98777..9a1608a65 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -213,7 +213,7 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { browserCanvasContext.lineTo(buyVolumePoint3.x, buyVolumePoint3.y); browserCanvasContext.lineTo(buyVolumePoint4.x, buyVolumePoint4.y); - browserCanvasContext.closePath(); + browserCanvasContext.closePath(); browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', ' + OPACITY + ')'; browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', ' + OPACITY + ')'; @@ -243,11 +243,11 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() { /* put the labels with the volumes values */ - UI.projects.superalgos.utilities.drawPrint.printLabel('Buy Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - UI.projects.superalgos.utilities.drawPrint.printLabel(currentVolume.innerVolumeBar.amountBuy, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Buy Volume', undefined, undefined, X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, 'Center', thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentVolume.innerVolumeBar.amountBuy, undefined, undefined, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, 'Center', thisObject.container, thisObject.fitFunction); - UI.projects.superalgos.utilities.drawPrint.printLabel('Sell Volume', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); - UI.projects.superalgos.utilities.drawPrint.printLabel(currentVolume.innerVolumeBar.amountSell, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel('Sell Volume', undefined, undefined, X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, 'Center', thisObject.container, thisObject.fitFunction); + UI.projects.superalgos.utilities.drawPrint.printLabel(currentVolume.innerVolumeBar.amountSell, undefined, undefined, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, 'Center', thisObject.container, thisObject.fitFunction); }