See conditions dinamically

This commit is contained in:
Luis Fernando Molina committed 2019-03-06 18:05:13 +01:00
1 parent a935e2ad77
commit 07aedb0563
2 files changed
+37 -8

No files matched your search

+21 -6
View File
@@ -426,7 +426,8 @@
strategyPhase: undefined,
buyOrder: undefined,
stopLossPhase: undefined,
buyOrderPhase: undefined
buyOrderPhase: undefined,
conditions: undefined
};
record.begin = marketFile[i][0];
@@ -454,6 +455,11 @@
record.buyOrder = marketFile[i][22];
record.stopLossPhase = marketFile[i][23];
record.buyOrderPhase = marketFile[i][24];
record.conditions = marketFile[i][25];
if (i === 0) { // The first record contains headers needed to be printed.
records.push(record);
}
if (record.begin >= leftDate.valueOf() && record.end <= rightDate.valueOf()) {
@@ -875,11 +881,6 @@
/* highlight the current record */
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', 1)'; // Current record accroding to time
let currentRecord = {
innerRecord: record
};
thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentRecord);
}
}
@@ -1025,6 +1026,20 @@
}
}
/* Send the current record to the panel */
if (datetime !== undefined) {
let dateValue = datetime.valueOf();
if (dateValue >= record.begin && dateValue <= record.end) {
let currentRecord = {
conditionsNames: records[0].conditions,
conditionsValues: record.conditions,
innerRecord: record
};
thisObject.container.eventHandler.raiseEvent("Current Record Changed", currentRecord);
}
}
/* This is how we write the text */
+16 -2
View File
@@ -23,7 +23,7 @@ function newAAMastersPlottersTradingSimulationTradingSimulationTradingSimulation
function initialize() {
thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL;
thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * 1.5;
thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * 2;
thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 1;
thisObject.container.frame.position.y = viewPort.visibleArea.topRight.y;
@@ -166,7 +166,7 @@ function newAAMastersPlottersTradingSimulationTradingSimulationTradingSimulation
let y = 0;
let increment = 0.03;
let increment = 0.025;
y = y + increment;
printLabel('Balance A', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1');
@@ -248,6 +248,20 @@ function newAAMastersPlottersTradingSimulationTradingSimulationTradingSimulation
y = y + increment;
printLabel((currentRecord.innerRecord.anualizedRateOfReturn * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50');
y = y + increment;
y = y + increment;
for (let i = 0; i < currentRecord.conditionsNames.length; i++) {
y = y + increment;
let opacity;
if (currentRecord.conditionsValues[i] === 1) {
opacity = '1.00'
} else {
opacity = '0.50';
}
printLabel(currentRecord.conditionsNames[i], X_AXIS, frameTitleHeight + frameBodyHeight * y, opacity);
}
function printLabel(labelToPrint, x, y, opacity) {
let labelPoint;