From 78146c6ca4b98924950addf8ba7bc3aae40551c6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 23 Apr 2019 21:44:14 +0200 Subject: [PATCH] Label Sizes --- TradingSimulation.js | 17 +++++++-------- TradingSimulationPanel.js | 44 +++++++++++++++++++-------------------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/TradingSimulation.js b/TradingSimulation.js index a3ea914e9..c612d8c00 100644 --- a/TradingSimulation.js +++ b/TradingSimulation.js @@ -987,11 +987,11 @@ if (record.type === 'Buy@StopLoss') { - line1 = 'Stop'; + line1 = 'STOP'; } else { - line1 = 'PT'; + line1 = 'TP'; } if (record.lastProfit < 0) { @@ -1068,15 +1068,12 @@ /* Send the current record to the panel */ - if (datetime !== undefined) { - let dateValue = datetime.valueOf(); - if (dateValue >= record.begin && dateValue <= record.end) { + if (userPositionDate >= record.begin && userPositionDate <= record.end) { - let currentRecord = { - innerRecord: record - }; - thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentRecord); - } + let currentRecord = { + innerRecord: record + }; + thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentRecord); } /* This is how we write the text */ diff --git a/TradingSimulationPanel.js b/TradingSimulationPanel.js index 52f9ea907..307922662 100644 --- a/TradingSimulationPanel.js +++ b/TradingSimulationPanel.js @@ -97,87 +97,87 @@ function newAAMastersPlottersTradingSimulationTradingSimulationTradingSimulation y = y + increment; printLabel('Balance A', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.balanceA, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.balanceA, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Balance B', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.balanceB, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.balanceB, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Profit', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.profit, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.profit, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Last Profit', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.lastProfit, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.lastProfit, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Last Profit %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel((currentRecord.innerRecord.lastProfitPercent).toFixed(2) + ' % ', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel((currentRecord.innerRecord.lastProfitPercent).toFixed(2) + ' % ', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; - printLabel('Sell Rate', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); + printLabel('Rate', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.sellRate, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.sellRate, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; - printLabel('Stop Loss', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); + printLabel('Stop', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.stopLoss, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.stopLoss, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; - printLabel('Buy Order', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); + printLabel('Take Profit', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.buyOrder, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.buyOrder, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; - printLabel('Roundtrips', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); + printLabel('Trades', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.roundtrips, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.roundtrips, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Hits', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.hits, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.hits, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Fails', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.fails, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.fails, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Hit Ratio', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel((currentRecord.innerRecord.hitRatio * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel((currentRecord.innerRecord.hitRatio * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('ROI', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel((currentRecord.innerRecord.ROI * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel((currentRecord.innerRecord.ROI * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Periods', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.periods, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.periods, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Days', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel(currentRecord.innerRecord.days, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel(currentRecord.innerRecord.days, X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); y = y + increment; printLabel('Anualized Rate of Return', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1'); y = y + increment; - printLabel((currentRecord.innerRecord.anualizedRateOfReturn * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50'); + printLabel((currentRecord.innerRecord.anualizedRateOfReturn * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50',16); - function printLabel(labelToPrint, x, y, opacity) { + function printLabel(labelToPrint, x, y, opacity, fontSize) { let labelPoint; - let fontSize = 10; + if (fontSize === undefined) { fontSize = 10 }; browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY + ' Saira';