diff --git a/Conditions.js b/Conditions.js index 8115c6e9e..0ef615f9d 100644 --- a/Conditions.js +++ b/Conditions.js @@ -25,7 +25,7 @@ // Secondary functions and properties. - currentRecord: undefined + record: undefined }; /* this is part of the module template */ @@ -390,8 +390,8 @@ if (datetime.valueOf() >= record.begin && datetime.valueOf() <= record.end) { - thisObject.currentRecord = record; - thisObject.container.eventHandler.raiseEvent("Current Condition Changed", thisObject.currentRecord); + thisObject.record = record; + thisObject.container.eventHandler.raiseEvent("Current Condition Changed", thisObject.record); } } @@ -461,8 +461,8 @@ if (datetime.valueOf() >= record.begin && datetime.valueOf() <= record.end) { - thisObject.currentRecord = record; - thisObject.container.eventHandler.raiseEvent("Current Condition Changed", thisObject.currentRecord); + thisObject.record = record; + thisObject.container.eventHandler.raiseEvent("Current Condition Changed", thisObject.record); } } @@ -492,7 +492,7 @@ if (userPositionDate >= conditionRecord.begin && userPositionDate <= conditionRecord.end) { - let currentRecord = { + let record = { conditionsNames: headers, strategyIndex: conditionRecord.strategyIndex, stopLossPhase: conditionRecord.stopLossPhase, @@ -502,7 +502,7 @@ formulaValues: conditionRecord.formulaValues }; - sendRecordInfoToDesignerSpace(currentRecord) + sendRecordInfoToDesignerSpace(record) } } @@ -512,15 +512,15 @@ } } - function sendRecordInfoToDesignerSpace(currentRecord) { + function sendRecordInfoToDesignerSpace(record) { - if (currentRecord === undefined) { return; } - if (currentRecord.conditionsNames === undefined) { return; } + if (record === undefined) { return; } + if (record.conditionsNames === undefined) { return; } if (canvas.designSpace.workspace === undefined) { return; } /* We will get now the designer trading system */ let designerTradingSystem - let fileTradingSystem = currentRecord.conditionsNames; + let fileTradingSystem = record.conditionsNames; for (let i = 0; i < canvas.designSpace.workspace.workspaceNode.rootNodes.length; i++) { let rootNode = canvas.designSpace.workspace.workspaceNode.rootNodes[i] @@ -565,7 +565,7 @@ let strategy = fileTradingSystem.strategies[j]; designerTradingSystem.strategies[j].payload.uiObject.setErrorMessage(strategy.error) - if (currentRecord.strategyIndex === j) { + if (record.strategyIndex === j) { designerTradingSystem.strategies[j].payload.uiObject.isExecuting = true } else { designerTradingSystem.strategies[j].payload.uiObject.isExecuting = false @@ -650,7 +650,7 @@ for (let p = 0; p < initialDefinition.stopLoss.phases.length; p++) { - if (currentRecord.strategyIndex === j && currentRecord.stopLossPhase === p) { + if (record.strategyIndex === j && record.stopLossPhase === p) { designerTradingSystem.strategies[j].openStage.initialDefinition.stopLoss.phases[p].payload.uiObject.isExecuting = true } else { designerTradingSystem.strategies[j].openStage.initialDefinition.stopLoss.phases[p].payload.uiObject.isExecuting = false @@ -662,15 +662,15 @@ if (phase.formula !== undefined) { designerTradingSystem.strategies[j].openStage.initialDefinition.stopLoss.phases[p].formula.payload.uiObject.setErrorMessage(openStage.initialDefinition.stopLoss.phases[p].formula.error) - if (currentRecord.formulaErrors[formulaErrorsIndex] !== "") { - if (currentRecord.strategyIndex === j && currentRecord.stopLossPhase === p) { - designerTradingSystem.strategies[j].openStage.initialDefinition.stopLoss.phases[p].formula.payload.uiObject.setErrorMessage(currentRecord.formulaErrors[formulaErrorsIndex]) + if (record.formulaErrors[formulaErrorsIndex] !== "") { + if (record.strategyIndex === j && record.stopLossPhase === p) { + designerTradingSystem.strategies[j].openStage.initialDefinition.stopLoss.phases[p].formula.payload.uiObject.setErrorMessage(record.formulaErrors[formulaErrorsIndex]) } } formulaErrorsIndex++ - if (currentRecord.strategyIndex === j && currentRecord.stopLossPhase === p) { - designerTradingSystem.strategies[j].openStage.initialDefinition.stopLoss.phases[p].formula.payload.uiObject.setValue(currentRecord.formulaValues[formulaValuesIndex]) + if (record.strategyIndex === j && record.stopLossPhase === p) { + designerTradingSystem.strategies[j].openStage.initialDefinition.stopLoss.phases[p].formula.payload.uiObject.setValue(record.formulaValues[formulaValuesIndex]) } formulaValuesIndex++ } @@ -735,7 +735,7 @@ for (let p = 0; p < initialDefinition.takeProfit.phases.length; p++) { - if (currentRecord.strategyIndex === j && currentRecord.takeProfitPhase === p) { + if (record.strategyIndex === j && record.takeProfitPhase === p) { designerTradingSystem.strategies[j].openStage.initialDefinition.takeProfit.phases[p].payload.uiObject.isExecuting = true } else { designerTradingSystem.strategies[j].openStage.initialDefinition.takeProfit.phases[p].payload.uiObject.isExecuting = false @@ -747,15 +747,15 @@ if (phase.formula !== undefined) { designerTradingSystem.strategies[j].openStage.initialDefinition.takeProfit.phases[p].formula.payload.uiObject.setErrorMessage(openStage.initialDefinition.takeProfit.phases[p].formula.error) - if (currentRecord.formulaErrors[formulaErrorsIndex] !== "") { - if (currentRecord.strategyIndex === j && currentRecord.takeProfitPhase === p) { - designerTradingSystem.strategies[j].openStage.initialDefinition.takeProfit.phases[p].formula.payload.uiObject.setErrorMessage(currentRecord.formulaErrors[formulaErrorsIndex]) + if (record.formulaErrors[formulaErrorsIndex] !== "") { + if (record.strategyIndex === j && record.takeProfitPhase === p) { + designerTradingSystem.strategies[j].openStage.initialDefinition.takeProfit.phases[p].formula.payload.uiObject.setErrorMessage(record.formulaErrors[formulaErrorsIndex]) } } formulaErrorsIndex++ - if (currentRecord.strategyIndex === j && currentRecord.takeProfitPhase === p) { - designerTradingSystem.strategies[j].openStage.initialDefinition.takeProfit.phases[p].formula.payload.uiObject.setValue(currentRecord.formulaValues[formulaValuesIndex]) + if (record.strategyIndex === j && record.takeProfitPhase === p) { + designerTradingSystem.strategies[j].openStage.initialDefinition.takeProfit.phases[p].formula.payload.uiObject.setValue(record.formulaValues[formulaValuesIndex]) } formulaValuesIndex++ } @@ -833,7 +833,7 @@ for (let p = 0; p < manageStage.stopLoss.phases.length; p++) { - if (currentRecord.strategyIndex === j && currentRecord.stopLossPhase - 1 === p) { + if (record.strategyIndex === j && record.stopLossPhase - 1 === p) { designerTradingSystem.strategies[j].manageStage.stopLoss.phases[p].payload.uiObject.isExecuting = true } else { designerTradingSystem.strategies[j].manageStage.stopLoss.phases[p].payload.uiObject.isExecuting = false @@ -845,14 +845,14 @@ if (phase.formula !== undefined) { designerTradingSystem.strategies[j].manageStage.stopLoss.phases[p].formula.payload.uiObject.setErrorMessage(manageStage.stopLoss.phases[p].formula.error) - if (currentRecord.formulaErrors[formulaErrorsIndex] !== "") { - if (currentRecord.strategyIndex === j && currentRecord.stopLossPhase - 1 === p) { - designerTradingSystem.strategies[j].manageStage.stopLoss.phases[p].formula.payload.uiObject.setErrorMessage(currentRecord.formulaErrors[formulaErrorsIndex]) + if (record.formulaErrors[formulaErrorsIndex] !== "") { + if (record.strategyIndex === j && record.stopLossPhase - 1 === p) { + designerTradingSystem.strategies[j].manageStage.stopLoss.phases[p].formula.payload.uiObject.setErrorMessage(record.formulaErrors[formulaErrorsIndex]) } } formulaErrorsIndex++ - if (currentRecord.strategyIndex === j && currentRecord.stopLossPhase - 1 === p) { - designerTradingSystem.strategies[j].manageStage.stopLoss.phases[p].formula.payload.uiObject.setValue(currentRecord.formulaValues[formulaValuesIndex]) + if (record.strategyIndex === j && record.stopLossPhase - 1 === p) { + designerTradingSystem.strategies[j].manageStage.stopLoss.phases[p].formula.payload.uiObject.setValue(record.formulaValues[formulaValuesIndex]) } formulaValuesIndex++ } @@ -917,7 +917,7 @@ for (let p = 0; p < manageStage.takeProfit.phases.length; p++) { - if (currentRecord.strategyIndex === j && currentRecord.takeProfitPhase - 1 === p) { + if (record.strategyIndex === j && record.takeProfitPhase - 1 === p) { designerTradingSystem.strategies[j].manageStage.takeProfit.phases[p].payload.uiObject.isExecuting = true } else { designerTradingSystem.strategies[j].manageStage.takeProfit.phases[p].payload.uiObject.isExecuting = false @@ -929,15 +929,15 @@ if (phase.formula !== undefined) { designerTradingSystem.strategies[j].manageStage.takeProfit.phases[p].formula.payload.uiObject.setErrorMessage(manageStage.takeProfit.phases[p].formula.error) - if (currentRecord.formulaErrors[formulaErrorsIndex] !== "") { - if (currentRecord.strategyIndex === j && currentRecord.takeProfitPhase - 1 === p) { - designerTradingSystem.strategies[j].manageStage.takeProfit.phases[p].formula.payload.uiObject.setErrorMessage(currentRecord.formulaErrors[formulaErrorsIndex]) + if (record.formulaErrors[formulaErrorsIndex] !== "") { + if (record.strategyIndex === j && record.takeProfitPhase - 1 === p) { + designerTradingSystem.strategies[j].manageStage.takeProfit.phases[p].formula.payload.uiObject.setErrorMessage(record.formulaErrors[formulaErrorsIndex]) } } formulaErrorsIndex++ - if (currentRecord.strategyIndex === j && currentRecord.takeProfitPhase - 1 === p) { - designerTradingSystem.strategies[j].manageStage.takeProfit.phases[p].formula.payload.uiObject.setValue(currentRecord.formulaValues[formulaValuesIndex]) + if (record.strategyIndex === j && record.takeProfitPhase - 1 === p) { + designerTradingSystem.strategies[j].manageStage.takeProfit.phases[p].formula.payload.uiObject.setValue(record.formulaValues[formulaValuesIndex]) } formulaValuesIndex++ } @@ -1029,7 +1029,7 @@ } } - if (currentRecord.conditionsValues[conditionIndex] === 1) { + if (record.conditionsValues[conditionIndex] === 1) { condition.payload.uiObject.highlight() } else { highlightSituation = false diff --git a/SimulationExecution.js b/SimulationExecution.js index 9db58a633..cecae899f 100644 --- a/SimulationExecution.js +++ b/SimulationExecution.js @@ -342,7 +342,7 @@ function plotChart() { try { - let currentRecord + let record let point = { x: 0, @@ -358,7 +358,7 @@ for (let i = 0; i < history.length; i++) { record = history[i]; - currentRecord = record + record = record let timestamp = record.date // Math.trunc(record.date / timeFrame) * timeFrame + timeFrame / 2; @@ -427,7 +427,7 @@ point2.y = point2.y - diff; point3.y = point3.y - diff; - currentRecord.timeFrame = diff + record.timeFrame = diff point2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(point2); point3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(point3); @@ -502,7 +502,7 @@ point2.y = point2.y + diff; point3.y = point3.y + diff; - currentRecord.timeFrame = diff + record.timeFrame = diff point2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(point2); point3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(point3); @@ -575,7 +575,7 @@ point2.y = point2.y - diff; point3.y = point3.y - diff; - currentRecord.timeFrame = diff + record.timeFrame = diff point2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(point2); point3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(point3); @@ -649,7 +649,7 @@ point2.y = point2.y + diff; point3.y = point3.y + diff; - currentRecord.timeFrame = diff + record.timeFrame = diff point2 = canvas.chartingSpace.viewport.fitIntoVisibleArea(point2); point3 = canvas.chartingSpace.viewport.fitIntoVisibleArea(point3); @@ -683,7 +683,7 @@ /* Send the current record to the panel */ if (userPositionDate >= record.date - 30000 && userPositionDate < record.date + 30000) { - thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentRecord); + thisObject.container.eventHandler.raiseEvent("Current Record Changed", record); } /* Circles */ diff --git a/SimulationExecutionPanel.js b/SimulationExecutionPanel.js index 48410e698..ad1e51b7b 100644 --- a/SimulationExecutionPanel.js +++ b/SimulationExecutionPanel.js @@ -19,7 +19,7 @@ function newTradingEnginesPlottersTradingSimulationSimulationExecutionSimulation container.frame.containerName = "Trading Execution"; - let currentRecord; + let record; let upDownButton return thisObject; @@ -30,7 +30,7 @@ function newTradingEnginesPlottersTradingSimulationSimulationExecutionSimulation thisObject.fitFunction = undefined thisObject.isVisible = undefined - currentRecord = undefined + record = undefined upDownButton.finalize() upDownButton = undefined } @@ -75,7 +75,7 @@ function newTradingEnginesPlottersTradingSimulationSimulationExecutionSimulation function onRecordChange(lastCurrentCandle) { - currentRecord = lastCurrentCandle; + record = lastCurrentCandle; } @@ -93,7 +93,7 @@ function newTradingEnginesPlottersTradingSimulationSimulationExecutionSimulation function plot() { - if (currentRecord === undefined) { return; } + if (record === undefined) { return; } const frameBodyHeight = thisObject.container.frame.getBodyHeight(); const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight; @@ -101,7 +101,7 @@ function newTradingEnginesPlottersTradingSimulationSimulationExecutionSimulation const X_AXIS = thisObject.container.frame.width / 2; const Y_AXIS = frameTitleHeight + frameBodyHeight / 2; - record = currentRecord + record = record point = { x: X_AXIS, @@ -395,28 +395,28 @@ function newTradingEnginesPlottersTradingSimulationSimulationExecutionSimulation browserCanvasContext.beginPath(); let y; - let recordDate = new Date(currentRecord.datetime) + let recordDate = new Date(record.datetime) printLabel('Market Rate', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05 / 2, '1'); - printLabel(currentRecord.marketRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10 / 2, '0.50'); + printLabel(record.marketRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10 / 2, '0.50'); printLabel('Sell Rate', X_AXIS, frameTitleHeight + frameBodyHeight * 0.15 / 2, '1'); - printLabel(currentRecord.lastSellRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.20 / 2, '0.50'); + printLabel(record.lastSellRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.20 / 2, '0.50'); printLabel('Sell Executed Rate', X_AXIS, frameTitleHeight + frameBodyHeight * 0.25 / 2, '1'); - printLabel(currentRecord.sellExecRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.30 / 2, '0.50'); + printLabel(record.sellExecRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.30 / 2, '0.50'); printLabel('Buy Rate', X_AXIS, frameTitleHeight + frameBodyHeight * 0.35 / 2, '1'); - printLabel(currentRecord.lastBuyRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.40 / 2, '0.40'); + printLabel(record.lastBuyRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.40 / 2, '0.40'); printLabel('Buy Executed Rate', X_AXIS, frameTitleHeight + frameBodyHeight * 0.45 / 2, '1'); - printLabel(currentRecord.buyExecRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.50 / 2, '0.50'); + printLabel(record.buyExecRate, X_AXIS, frameTitleHeight + frameBodyHeight * 0.50 / 2, '0.50'); printLabel('ROI Asset A', X_AXIS, frameTitleHeight + frameBodyHeight * (1 - 0.25 / 2), '1'); - printLabel((currentRecord.combinedProfitsB).toFixed(2) + '%', X_AXIS, frameTitleHeight + frameBodyHeight * (1 - 0.30 / 2), '0.50'); + printLabel((record.combinedProfitsB).toFixed(2) + '%', X_AXIS, frameTitleHeight + frameBodyHeight * (1 - 0.30 / 2), '0.50'); printLabel('ROI Asset B', X_AXIS, frameTitleHeight + frameBodyHeight * (1 - 0.15 / 2), '1'); - printLabel((currentRecord.combinedProfitsA).toFixed(2) + '%', X_AXIS, frameTitleHeight + frameBodyHeight * (1 - 0.20 / 2), '0.50'); + printLabel((record.combinedProfitsA).toFixed(2) + '%', X_AXIS, frameTitleHeight + frameBodyHeight * (1 - 0.20 / 2), '0.50'); printLabel('Datetime', X_AXIS, frameTitleHeight + frameBodyHeight * (1 - 0.05 / 2), '1'); printLabel(recordDate.toUTCString(), X_AXIS, frameTitleHeight + frameBodyHeight * (1 - 0.1 / 2), '0.50'); diff --git a/Strategies.js b/Strategies.js index 2e82c2267..c793f07ec 100644 --- a/Strategies.js +++ b/Strategies.js @@ -27,7 +27,7 @@ // Secondary functions and properties. - currentRecord: undefined + record: undefined }; /* this is part of the module template */ @@ -395,8 +395,8 @@ if (datetime.valueOf() >= record.begin && datetime.valueOf() <= record.end) { - thisObject.currentRecord = record; - thisObject.container.eventHandler.raiseEvent("Current Strategy Changed", thisObject.currentRecord); + thisObject.record = record; + thisObject.container.eventHandler.raiseEvent("Current Strategy Changed", thisObject.record); } } @@ -468,8 +468,8 @@ (record.begin >= coordinateSystem.min.x && record.end <= coordinateSystem.max.x) ) { - thisObject.currentRecord = record; - thisObject.container.eventHandler.raiseEvent("Current Strategy Changed", thisObject.currentRecord); + thisObject.record = record; + thisObject.container.eventHandler.raiseEvent("Current Strategy Changed", thisObject.record); } } @@ -609,9 +609,9 @@ if (userPositionDate >= record.begin && userPositionDate <= record.end) { - let currentRecord = { + let record = { }; - thisObject.container.eventHandler.raiseEvent("Current Strategy Record Changed", currentRecord); + thisObject.container.eventHandler.raiseEvent("Current Strategy Record Changed", record); } function drawStick(point1, point2) { diff --git a/Trades.js b/Trades.js index 9da7b37b6..dffb5e03b 100644 --- a/Trades.js +++ b/Trades.js @@ -27,7 +27,7 @@ // Secondary functions and properties. - currentRecord: undefined + record: undefined }; /* this is part of the module template */ @@ -381,8 +381,8 @@ if (datetime.valueOf() >= record.begin && datetime.valueOf() <= record.end) { - thisObject.currentRecord = record; - thisObject.container.eventHandler.raiseEvent("Current Trade Changed", thisObject.currentRecord); + thisObject.record = record; + thisObject.container.eventHandler.raiseEvent("Current Trade Changed", thisObject.record); } } @@ -447,8 +447,8 @@ if (datetime.valueOf() >= record.begin && datetime.valueOf() <= record.end) { - thisObject.currentRecord = record; - thisObject.container.eventHandler.raiseEvent("Current Trade Changed", thisObject.currentRecord); + thisObject.record = record; + thisObject.container.eventHandler.raiseEvent("Current Trade Changed", thisObject.record); } } @@ -478,9 +478,9 @@ if (userPositionDate >= record.begin && userPositionDate <= record.end) { - let currentRecord = { + let record = { }; - thisObject.container.eventHandler.raiseEvent("Current Trade Record Changed", currentRecord); + thisObject.container.eventHandler.raiseEvent("Current Trade Record Changed", record); } let recordPoint1 = { diff --git a/TradingSimulation.js b/TradingSimulation.js index 8f86d0886..da7c86a33 100644 --- a/TradingSimulation.js +++ b/TradingSimulation.js @@ -26,7 +26,7 @@ // Secondary functions and properties. - currentRecord: undefined + record: undefined }; /* this is part of the module template */ @@ -395,8 +395,8 @@ if (datetime.valueOf() >= record.begin && datetime.valueOf() <= record.end) { - thisObject.currentRecord = record; - thisObject.container.eventHandler.raiseEvent("Current Record Changed", thisObject.currentRecord); + thisObject.record = record; + thisObject.container.eventHandler.raiseEvent("Current Record Changed", thisObject.record); } } @@ -485,8 +485,8 @@ if (datetime.valueOf() >= record.begin && datetime.valueOf() <= record.end) { - thisObject.currentRecord = record; - thisObject.container.eventHandler.raiseEvent("Current Record Changed", thisObject.currentRecord); + thisObject.record = record; + thisObject.container.eventHandler.raiseEvent("Current Record Changed", thisObject.record); } } @@ -525,7 +525,7 @@ if (userPositionDate >= record.begin && userPositionDate <= record.end) { let eventRecords = { - currentRecord: record + record: record }; thisObject.container.eventHandler.raiseEvent("Current Record Changed", eventRecords); } diff --git a/TradingSimulationAssetBalancesPanel.js b/TradingSimulationAssetBalancesPanel.js index d9e69a743..90dd81025 100644 --- a/TradingSimulationAssetBalancesPanel.js +++ b/TradingSimulationAssetBalancesPanel.js @@ -19,7 +19,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul container.frame.containerName = "Simulation Asset Balances Panel"; - let currentRecord; + let record; let lastRecord; let upDownButton @@ -56,7 +56,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul thisObject.onRecordChange = undefined thisObject.isVisible = undefined - currentRecord = undefined + record = undefined lastRecord = undefined upDownButton = undefined @@ -89,7 +89,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul function onRecordChange(records) { - currentRecord = records.currentRecord; + record = records.record; lastRecord = records.lastRecord } @@ -117,7 +117,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul function plotCurrentRecordInfo() { - if (currentRecord === undefined) { return; } + if (record === undefined) { return; } const frameBodyHeight = thisObject.container.frame.getBodyHeight(); const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight; @@ -139,7 +139,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul let paramsArray = [] let positionTaken = false - if (currentRecord.positionSize > 0) { + if (record.positionSize > 0) { positionTaken = true } @@ -154,59 +154,59 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul return } - if (currentRecord.baseAsset === currentRecord.marketBaseAsset) { + if (record.baseAsset === record.marketBaseAsset) { params = {} - params.VALUE = currentRecord.balanceBaseAsset; - params.INIT_VALUE = currentRecord.initialBalanceA - params.MIN_VALUE = currentRecord.minimunBalanceA - params.MAX_VALUE = currentRecord.maximunBalanceA + params.VALUE = record.balanceBaseAsset; + params.INIT_VALUE = record.initialBalanceA + params.MIN_VALUE = record.minimunBalanceA + params.MAX_VALUE = record.maximunBalanceA params.ASSET_LABEL = 'Base' - params.ASSET_NAME = currentRecord.baseAsset + params.ASSET_NAME = record.baseAsset params.LEFT_OFFSET = X_AXIS params.POSITION_TAKEN = positionTaken - params.BASE_ASSET = currentRecord.baseAsset + params.BASE_ASSET = record.baseAsset params.DECIMALS = 4 paramsArray.push(params) params = {} - params.VALUE = currentRecord.balanceQuotedAsset; - params.MIN_VALUE = currentRecord.minimunBalanceB - params.INIT_VALUE = currentRecord.initialBalanceB - params.MAX_VALUE = currentRecord.maximunBalanceB + params.VALUE = record.balanceQuotedAsset; + params.MIN_VALUE = record.minimunBalanceB + params.INIT_VALUE = record.initialBalanceB + params.MAX_VALUE = record.maximunBalanceB params.ASSET_LABEL = 'Quoted' - params.ASSET_NAME = currentRecord.quotedAsset + params.ASSET_NAME = record.quotedAsset params.LEFT_OFFSET = X_AXIS params.POSITION_TAKEN = positionTaken - params.BASE_ASSET = currentRecord.baseAsset + params.BASE_ASSET = record.baseAsset params.DECIMALS = 2 paramsArray.push(params) } else { params = {} - params.VALUE = currentRecord.balanceQuotedAsset; - params.INIT_VALUE = currentRecord.initialBalanceB - params.MIN_VALUE = currentRecord.minimunBalanceB - params.MAX_VALUE = currentRecord.maximunBalanceB + params.VALUE = record.balanceQuotedAsset; + params.INIT_VALUE = record.initialBalanceB + params.MIN_VALUE = record.minimunBalanceB + params.MAX_VALUE = record.maximunBalanceB params.ASSET_LABEL = 'Base' - params.ASSET_NAME = currentRecord.baseAsset + params.ASSET_NAME = record.baseAsset params.LEFT_OFFSET = X_AXIS params.POSITION_TAKEN = positionTaken - params.BASE_ASSET = currentRecord.baseAsset + params.BASE_ASSET = record.baseAsset params.DECIMALS = 4 paramsArray.push(params) params = {} - params.VALUE = currentRecord.balanceBaseAsset; - params.MIN_VALUE = currentRecord.minimunBalanceA - params.INIT_VALUE = currentRecord.initialBalanceA - params.MAX_VALUE = currentRecord.maximunBalanceA + params.VALUE = record.balanceBaseAsset; + params.MIN_VALUE = record.minimunBalanceA + params.INIT_VALUE = record.initialBalanceA + params.MAX_VALUE = record.maximunBalanceA params.ASSET_LABEL = 'Quoted' - params.ASSET_NAME = currentRecord.quotedAsset + params.ASSET_NAME = record.quotedAsset params.LEFT_OFFSET = X_AXIS params.POSITION_TAKEN = positionTaken - params.BASE_ASSET = currentRecord.baseAsset + params.BASE_ASSET = record.baseAsset params.DECIMALS = 2 paramsArray.push(params) diff --git a/TradingSimulationCurrentPositionPanel.js b/TradingSimulationCurrentPositionPanel.js index 6fc1ab6f5..1856c69d9 100644 --- a/TradingSimulationCurrentPositionPanel.js +++ b/TradingSimulationCurrentPositionPanel.js @@ -21,7 +21,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul container.frame.containerName = "Simulation Current Position Panel"; - let currentRecord; + let record; let lastRecord; let upDownButton @@ -54,7 +54,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul thisObject.onRecordChange = undefined thisObject.isVisible = undefined - currentRecord = undefined + record = undefined lastRecord = undefined upDownButton = undefined } @@ -84,7 +84,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul function onRecordChange(records) { - currentRecord = records.currentRecord; + record = records.record; lastRecord = records.lastRecord } @@ -112,7 +112,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul function plotCurrentRecordInfo() { - if (currentRecord === undefined) { return; } + if (record === undefined) { return; } const frameBodyHeight = thisObject.container.frame.getBodyHeight(); const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight; @@ -133,32 +133,32 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul y = y + increment; printLabel('Size', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.positionSize, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.positionSize, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Rate', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.sellRate, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.sellRate, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Stop', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.stopLoss, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.stopLoss, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Take Profit', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.takeProfit, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.takeProfit, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Periods', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel((currentRecord.positionPeriods), X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel((record.positionPeriods), X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Days', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel((currentRecord.positionDays).toFixed(2), X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel((record.positionDays).toFixed(2), X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; y = y + increment; @@ -167,12 +167,12 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul y = y + increment; printLabel('Profit / Loss', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel((currentRecord.lastTradeProfitLoss), X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel((record.lastTradeProfitLoss), X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('ROI', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel((currentRecord.lastTradeROI).toFixed(2) + ' % ', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel((record.lastTradeROI).toFixed(2) + ' % ', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); } } diff --git a/TradingSimulationPartialResultsPanel.js b/TradingSimulationPartialResultsPanel.js index 3a1f4f8e2..a6f50a3c5 100644 --- a/TradingSimulationPartialResultsPanel.js +++ b/TradingSimulationPartialResultsPanel.js @@ -19,7 +19,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul container.frame.containerName = "Simulation Partial Results Panel"; - let currentRecord; + let record; let lastRecord; let upDownButton @@ -52,7 +52,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul thisObject.onRecordChange = undefined thisObject.isVisible = undefined - currentRecord = undefined + record = undefined lastRecord = undefined upDownButton = undefined } @@ -82,7 +82,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul function onRecordChange(records) { - currentRecord = records.currentRecord; + record = records.record; lastRecord = records.lastRecord } @@ -110,7 +110,7 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul function plotCurrentRecordInfo() { - if (currentRecord === undefined) { return; } + if (record === undefined) { return; } const frameBodyHeight = thisObject.container.frame.getBodyHeight(); const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight; @@ -131,47 +131,47 @@ function newTradingEnginesPlottersTradingSimulationTradingSimulationTradingSimul y = y + increment; printLabel('Profit / Loss', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.accumulatedProfitLoss, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.accumulatedProfitLoss, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Trades', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.tradesCount, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.tradesCount, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Hits', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.hits, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.hits, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Fails', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.fails, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.fails, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Hit Ratio', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel((currentRecord.hitRatio * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel((record.hitRatio * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('ROI', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel((currentRecord.ROI * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel((record.ROI * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Periods', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.periods, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.periods, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Days', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel(currentRecord.days, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(record.days, X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; printLabel('Anualized Rate of Return', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); y = y + increment; - printLabel((currentRecord.anualizedRateOfReturn * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel((record.anualizedRateOfReturn * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction); } }