latests objects cleaned

This commit is contained in:
Luis Fernando Molina committed 2019-10-10 16:18:12 +02:00
1 parent 91ceec5f35
commit ac720b1032
2 files changed
+5 -40

No files matched your search

+2 -35
View File
@@ -60,7 +60,6 @@
let conditionsArray = [];
let strategiesArray = [];
let tradesArray = [];
let lastObjectsArray = [];
let tradingSystem = bot.DEFINITION.tradingSystem;
@@ -633,38 +632,7 @@
controlLoop();
return
}
}
let lastObjects = {
candle: clone(candle),
//LRC: clone(LRC),
bollingerBand: clone(bollingerBand),
percentageBandwidth: clone(percentageBandwidth),
bollingerChannel: clone(bollingerChannel),
bollingerSubChannel: clone(bollingerSubChannel)
}
function clone(obj) {
if (null == obj || "object" != typeof obj) return obj;
var copy = obj.constructor();
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
}
return copy;
}
lastObjects.candle.previous = undefined;
//lastObjects.LRC.previous = undefined;
lastObjects.bollingerBand.previous = undefined;
lastObjects.percentageBandwidth.previous = undefined;
lastObjects.bollingerChannel.previous = undefined;
lastObjects.bollingerSubChannel.previous = undefined;
lastObjectsArray.push(lastObjects);
if (lastObjectsArray.length > 5) {
lastObjectsArray.splice(0, 1);
}
}
let conditions = new Map; // Here we store the conditions values that will be use in the simulator for decision making.
let formulas = new Map;
@@ -2789,10 +2757,9 @@
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] runSimulation -> callback -> recordsArray.length = " + recordsArray.length); }
callback(tradingSystem, recordsArray, conditionsArray, strategiesArray, tradesArray, lastObjectsArray);
callback(tradingSystem, recordsArray, conditionsArray, strategiesArray, tradesArray);
}
function getElement(pArray, currentCandle, datasetName) {
try {