From b51ab08e1203af9963a71ed79f623479b59616c9 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 22 Apr 2019 19:38:13 +0200 Subject: [PATCH] Printing the text of profit or losses --- TradingSimulation.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/TradingSimulation.js b/TradingSimulation.js index 0f1ece60c..74782dbc7 100644 --- a/TradingSimulation.js +++ b/TradingSimulation.js @@ -711,7 +711,7 @@ }; let recordPoint3 = { // Short Stick Head - x: record.begin + (record.end - record.begin) / 2, + x: record.end, y: 0 }; @@ -1097,6 +1097,28 @@ browserCanvasContext.stroke(); } + if ( + recordPoint3.x < viewPort.visibleArea.topLeft.x + 250 + || + recordPoint3.x > viewPort.visibleArea.bottomRight.x - 250 + || + recordPoint3.y > viewPort.visibleArea.bottomRight.y - 100 + || + recordPoint3.y < viewPort.visibleArea.topLeft.y + 100 + ) { + // we do not write any text + } else { + if (line1 !== undefined && trade.entryPoint !== undefined) { + if ( + (directionShort > 0 && noShortTextUp === false) || + (directionShort < 0 && noShortTextDown === false) + ) { + printLabel(line1, recordPoint3.x - (recordPoint3.x - trade.entryPoint.x) / 2 - line1.length * FONT_ASPECT_RATIO, recordPoint3.y - 230, '0.50'); + printLabel(line2, recordPoint3.x - (recordPoint3.x - trade.entryPoint.x) / 2 - line2.length * FONT_ASPECT_RATIO, recordPoint3.y - 215, '0.50'); + } + } + } + } if (record.type === 'Sell') { @@ -1221,5 +1243,6 @@ +