diff --git a/.env b/.env index 5f94ea3bd..8ff145004 100644 --- a/.env +++ b/.env @@ -23,6 +23,7 @@ CONSOLE_LOG=false CONSOLE_ERROR_LOG=true LOG_FILE_CONTENT=false +REQUIRED_PROJECTS_PATH=../Projects PROJECTS_PATH=./Projects PATH_TO_UI=./UI PATH_TO_DATA_FILES=./UI/Data-Files/src diff --git a/TaskServer/.env b/TaskServer/.env index cde9d6e81..e86403577 100644 --- a/TaskServer/.env +++ b/TaskServer/.env @@ -1,6 +1,8 @@ INTER_PROCESS_FILES_PATH=../Inter-Process-Files STORAGE_PATH=../Data-Storage + +REQUIRED_PROJECTS_PATH=../Projects PROJECTS_PATH=../Projects USE_KEYVAULT=false diff --git a/TaskServer/Globals.js b/TaskServer/Globals.js index 56974864d..ef0ce0105 100644 --- a/TaskServer/Globals.js +++ b/TaskServer/Globals.js @@ -38,36 +38,6 @@ exports.newGlobals = function newGlobals() { global.EXECUTION_DATETIME = new Date(); - /* Time Frames Definitions. */ - - global.marketFilesPeriods = - '[' + - '[' + 24 * 60 * 60 * 1000 + ',' + '"24-hs"' + ']' + ',' + - '[' + 12 * 60 * 60 * 1000 + ',' + '"12-hs"' + ']' + ',' + - '[' + 8 * 60 * 60 * 1000 + ',' + '"08-hs"' + ']' + ',' + - '[' + 6 * 60 * 60 * 1000 + ',' + '"06-hs"' + ']' + ',' + - '[' + 4 * 60 * 60 * 1000 + ',' + '"04-hs"' + ']' + ',' + - '[' + 3 * 60 * 60 * 1000 + ',' + '"03-hs"' + ']' + ',' + - '[' + 2 * 60 * 60 * 1000 + ',' + '"02-hs"' + ']' + ',' + - '[' + 1 * 60 * 60 * 1000 + ',' + '"01-hs"' + ']' + ']'; - - global.marketFilesPeriods = JSON.parse(global.marketFilesPeriods); - - global.dailyFilePeriods = - '[' + - '[' + 45 * 60 * 1000 + ',' + '"45-min"' + ']' + ',' + - '[' + 40 * 60 * 1000 + ',' + '"40-min"' + ']' + ',' + - '[' + 30 * 60 * 1000 + ',' + '"30-min"' + ']' + ',' + - '[' + 20 * 60 * 1000 + ',' + '"20-min"' + ']' + ',' + - '[' + 15 * 60 * 1000 + ',' + '"15-min"' + ']' + ',' + - '[' + 10 * 60 * 1000 + ',' + '"10-min"' + ']' + ',' + - '[' + 05 * 60 * 1000 + ',' + '"05-min"' + ']' + ',' + - '[' + 04 * 60 * 1000 + ',' + '"04-min"' + ']' + ',' + - '[' + 03 * 60 * 1000 + ',' + '"03-min"' + ']' + ',' + - '[' + 02 * 60 * 1000 + ',' + '"02-min"' + ']' + ',' + - '[' + 01 * 60 * 1000 + ',' + '"01-min"' + ']' + ']'; - - global.dailyFilePeriods = JSON.parse(global.dailyFilePeriods); global.ROOT_DIR = './'; diff --git a/TaskServer/LearningSession.js b/TaskServer/LearningSession.js index 82d4cbe17..e392d44af 100644 --- a/TaskServer/LearningSession.js +++ b/TaskServer/LearningSession.js @@ -410,18 +410,18 @@ exports.newLearningSession = function newLearningSession(bot, parentLogger) { function getTimeFrameFromLabel(timeFrameLabel) { - for (let i = 0; i < global.marketFilesPeriods.length; i++) { - let value = global.marketFilesPeriods[i][0] - let label = global.marketFilesPeriods[i][1] + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; i++) { + let value = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[i][0] + let label = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[i][1] if (timeFrameLabel === label) { return value } } - for (let i = 0; i < global.dailyFilePeriods.length; i++) { - let value = global.dailyFilePeriods[i][0] - let label = global.dailyFilePeriods[i][1] + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; i++) { + let value = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[i][0] + let label = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[i][1] if (timeFrameLabel === label) { return value diff --git a/TaskServer/LowFrequencyTrading/TradingOutput.js b/TaskServer/LowFrequencyTrading/TradingOutput.js index 7cd76c81c..49b944cda 100644 --- a/TaskServer/LowFrequencyTrading/TradingOutput.js +++ b/TaskServer/LowFrequencyTrading/TradingOutput.js @@ -30,7 +30,7 @@ exports.newTradingOutput = function newTradingOutput(bot, logger, tradingEngineM async function start(chart, timeFrame, timeFrameLabel, tradingProcessDate) { try { - if (timeFrame > global.dailyFilePeriods[0][0]) { + if (timeFrame > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) { bot.processingDailyFiles = false } else { bot.processingDailyFiles = true diff --git a/TaskServer/LowFrequencyTrading/TradingProcess.js b/TaskServer/LowFrequencyTrading/TradingProcess.js index 9a481b213..3171879a5 100644 --- a/TaskServer/LowFrequencyTrading/TradingProcess.js +++ b/TaskServer/LowFrequencyTrading/TradingProcess.js @@ -365,15 +365,15 @@ We will iterate through all posible timeFrames. */ - for (let n = 0; n < global.marketFilesPeriods.length; n++) { - const timeFrame = global.marketFilesPeriods[n][0]; - const timeFrameLabel = global.marketFilesPeriods[n][1]; + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; n++) { + const timeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0]; + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; dataFiles = new Map(); if (bot.TRADING_SESSION.tradingParameters.timeFrame.config.label === timeFrameLabel) { - currentTimeFrame = global.marketFilesPeriods[n][0]; - currentTimeFrameLabel = global.marketFilesPeriods[n][1]; + currentTimeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0]; + currentTimeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; } for (let dependencyIndex = 0; dependencyIndex < dataDependenciesModule.nodeArray.length; dependencyIndex++) { let dependency = dataDependenciesModule.nodeArray[dependencyIndex]; @@ -439,7 +439,7 @@ } } - let mapKey = global.marketFilesPeriods[n][1]; + let mapKey = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; multiPeriodDataFiles.set(mapKey, dataFiles) } return true @@ -453,9 +453,9 @@ /* We will iterate through all posible timeFrames. */ - for (let n = 0; n < global.dailyFilePeriods.length; n++) { - const timeFrame = global.dailyFilePeriods[n][0]; - const timeFrameLabel = global.dailyFilePeriods[n][1]; + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; n++) { + const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0]; + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]; if (processConfig.framework.validtimeFrames !== undefined) { let validPeriod = false; @@ -469,8 +469,8 @@ } if (bot.TRADING_SESSION.tradingParameters.timeFrame.config.label === timeFrameLabel) { - currentTimeFrame = global.dailyFilePeriods[n][0]; - currentTimeFrameLabel = global.dailyFilePeriods[n][1]; + currentTimeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0]; + currentTimeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]; } dataFiles = new Map(); @@ -516,7 +516,7 @@ dataFiles.set(dependency.id, dataFile); } - let mapKey = global.dailyFilePeriods[n][1]; + let mapKey = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]; multiPeriodDataFiles.set(mapKey, dataFiles) } return true @@ -569,8 +569,8 @@ if (commons.validateOutputDatasets(outputDatasets, callBackFunction) !== true) { return } /* The second phase is about transforming the inputs into a format that can be used to apply the user defined code. */ - for (let j = 0; j < global.marketFilesPeriods.length; j++) { - let timeFrameLabel = marketFilesPeriods[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; j++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[j][1] let dataFiles = multiPeriodDataFiles.get(timeFrameLabel) let products = {} @@ -582,8 +582,8 @@ } } - for (let j = 0; j < global.dailyFilePeriods.length; j++) { - let timeFrameLabel = global.dailyFilePeriods[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; j++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[j][1] let dataFiles = multiPeriodDataFiles.get(timeFrameLabel) let products = {} @@ -629,7 +629,7 @@ await writeTimeFramesFiles(currentTimeFrame, currentTimeFrameLabel) await writeDataRanges() - if (currentTimeFrame > global.dailyFilePeriods[0][0]) { + if (currentTimeFrame > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) { await writeMarketStatusReport(currentTimeFrameLabel) } else { await writeDailyStatusReport(currentTimeFrameLabel) diff --git a/TaskServer/LowFrequencyTrading/TradingSimulation.js b/TaskServer/LowFrequencyTrading/TradingSimulation.js index e3452019c..3ecb71540 100644 --- a/TaskServer/LowFrequencyTrading/TradingSimulation.js +++ b/TaskServer/LowFrequencyTrading/TradingSimulation.js @@ -318,8 +318,8 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, tradin /* Finding the Current Element on Market Files */ if (bot.processingDailyFiles) { - for (let j = 0; j < global.dailyFilePeriods.length; j++) { - let mapKey = dailyFilePeriods[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; j++) { + let mapKey = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[j][1] let propertyName = 'at' + mapKey.replace('-', '') let thisChart = chart[propertyName] @@ -339,8 +339,8 @@ exports.newTradingSimulation = function newTradingSimulation(bot, logger, tradin } /* Finding the Current Element on Market Files */ - for (let j = 0; j < global.marketFilesPeriods.length; j++) { - let mapKey = marketFilesPeriods[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; j++) { + let mapKey = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[j][1] let propertyName = 'at' + mapKey.replace('-', '') let thisChart = chart[propertyName] diff --git a/TaskServer/MultiPeriodDaily.js b/TaskServer/MultiPeriodDaily.js index 8a151ceee..5bbca2277 100644 --- a/TaskServer/MultiPeriodDaily.js +++ b/TaskServer/MultiPeriodDaily.js @@ -199,7 +199,7 @@ */ bootstrappingTheProcess = true - for (let i = 0; i < global.dailyFilePeriods.length; i++) { + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; i++) { let emptyObject = {}; interExecutionMemoryArray.push(emptyObject) } @@ -275,8 +275,8 @@ function timeFramesLoopBody() { - const timeFrame = global.dailyFilePeriods[n][0] - const timeFrameLabel = global.dailyFilePeriods[n][1] + const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0] + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1] /* Check Time Frames Filter */ if (bot.dailyTimeFrames !== undefined) { @@ -448,7 +448,7 @@ function timeFramesControlLoop() { n++ - if (n < global.dailyFilePeriods.length) { + if (n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length) { timeFramesLoopBody() } else { n = 0; @@ -516,8 +516,8 @@ function writeTimeFramesFile(productCodeName, callBack) { let timeFramesArray = [] - for (let n = 0; n < global.dailyFilePeriods.length; n++) { - let timeFrameLabel = global.dailyFilePeriods[n][1] + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; n++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1] /* Check Time Frames Filter */ if (bot.dailyTimeFrames !== undefined) { diff --git a/TaskServer/MultiPeriodMarket.js b/TaskServer/MultiPeriodMarket.js index c15592590..2ad1acfb8 100644 --- a/TaskServer/MultiPeriodMarket.js +++ b/TaskServer/MultiPeriodMarket.js @@ -56,8 +56,8 @@ } function timeFramesLoopBody() { - const timeFrame = global.marketFilesPeriods[n][0] - const timeFrameLabel = global.marketFilesPeriods[n][1] + const timeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0] + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1] /* Check Time Frames Filter */ if (bot.marketTimeFrames !== undefined) { @@ -129,7 +129,7 @@ function timeFramesControlLoop() { n++; - if (n < global.marketFilesPeriods.length) { + if (n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length) { timeFramesLoopBody() } else { writeTimeFramesFiles(onTimeFrameFilesWritten) @@ -163,8 +163,8 @@ function writeTimeFramesFile(productCodeName, callBack) { let timeFramesArray = [] - for (let n = 0; n < global.marketFilesPeriods.length; n++) { - let timeFrameLabel = global.marketFilesPeriods[n][1] + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; n++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1] /* Check Time Frames Filter */ if (bot.marketTimeFrames !== undefined) { diff --git a/TaskServer/ReinforcementLearning/LearningProcess.js b/TaskServer/ReinforcementLearning/LearningProcess.js index 0b9f05cf4..c4e195cd0 100644 --- a/TaskServer/ReinforcementLearning/LearningProcess.js +++ b/TaskServer/ReinforcementLearning/LearningProcess.js @@ -365,15 +365,15 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) We will iterate through all posible timeFrames. */ - for (let n = 0; n < global.marketFilesPeriods.length; n++) { - const timeFrame = global.marketFilesPeriods[n][0]; - const timeFrameLabel = global.marketFilesPeriods[n][1]; + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; n++) { + const timeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0]; + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; dataFiles = new Map(); if (bot.TRADING_SESSION.tradingParameters.timeFrame.config.label === timeFrameLabel) { - currentTimeFrame = global.marketFilesPeriods[n][0]; - currentTimeFrameLabel = global.marketFilesPeriods[n][1]; + currentTimeFrame = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][0]; + currentTimeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; } for (let dependencyIndex = 0; dependencyIndex < dataDependenciesModule.nodeArray.length; dependencyIndex++) { let dependency = dataDependenciesModule.nodeArray[dependencyIndex]; @@ -439,7 +439,7 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) } } - let mapKey = global.marketFilesPeriods[n][1]; + let mapKey = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[n][1]; multiPeriodDataFiles.set(mapKey, dataFiles) } return true @@ -453,9 +453,9 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) /* We will iterate through all posible timeFrames. */ - for (let n = 0; n < global.dailyFilePeriods.length; n++) { - const timeFrame = global.dailyFilePeriods[n][0]; - const timeFrameLabel = global.dailyFilePeriods[n][1]; + for (let n = 0; n < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; n++) { + const timeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0]; + const timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]; if (processConfig.framework.validtimeFrames !== undefined) { let validPeriod = false; @@ -469,8 +469,8 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) } if (bot.TRADING_SESSION.tradingParameters.timeFrame.config.label === timeFrameLabel) { - currentTimeFrame = global.dailyFilePeriods[n][0]; - currentTimeFrameLabel = global.dailyFilePeriods[n][1]; + currentTimeFrame = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][0]; + currentTimeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]; } dataFiles = new Map(); @@ -516,7 +516,7 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) dataFiles.set(dependency.id, dataFile); } - let mapKey = global.dailyFilePeriods[n][1]; + let mapKey = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[n][1]; multiPeriodDataFiles.set(mapKey, dataFiles) } return true @@ -569,8 +569,8 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) if (commons.validateOutputDatasets(outputDatasets, callBackFunction) !== true) { return } /* The second phase is about transforming the inputs into a format that can be used to apply the user defined code. */ - for (let j = 0; j < global.marketFilesPeriods.length; j++) { - let timeFrameLabel = marketFilesPeriods[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; j++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[j][1] let dataFiles = multiPeriodDataFiles.get(timeFrameLabel) let products = {} @@ -582,8 +582,8 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) } } - for (let j = 0; j < global.dailyFilePeriods.length; j++) { - let timeFrameLabel = global.dailyFilePeriods[j][1] + for (let j = 0; j < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; j++) { + let timeFrameLabel = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[j][1] let dataFiles = multiPeriodDataFiles.get(timeFrameLabel) let products = {} @@ -629,7 +629,7 @@ exports.newLearningProcess = function newLearningProcess(bot, logger, UTILITIES) await writeTimeFramesFiles(currentTimeFrame, currentTimeFrameLabel) await writeDataRanges() - if (currentTimeFrame > global.dailyFilePeriods[0][0]) { + if (currentTimeFrame > TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[0][0]) { await writeMarketStatusReport(currentTimeFrameLabel) } else { await writeDailyStatusReport(currentTimeFrameLabel) diff --git a/TaskServer/Task.js b/TaskServer/Task.js index 3849efe89..d90f20cb6 100644 --- a/TaskServer/Task.js +++ b/TaskServer/Task.js @@ -104,7 +104,7 @@ function setupUpTS() { if (projectDefinition.TS.utilities !== undefined) { for (let j = 0; j < projectDefinition.TS.utilities.length; j++) { let utilityDefinition = projectDefinition.TS.utilities[j] - let path = process.env.PROJECTS_PATH + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Utilities' + '/' + utilityDefinition.fileName + let path = process.env.REQUIRED_PROJECTS_PATH + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Utilities' + '/' + utilityDefinition.fileName let requiredObject = require(path) let requiredFunction = requiredObject[utilityDefinition.functionName] @@ -116,7 +116,7 @@ function setupUpTS() { if (projectDefinition.TS.globals !== undefined) { for (let j = 0; j < projectDefinition.TS.globals.length; j++) { let globalDefinition = projectDefinition.TS.globals[j] - let path = process.env.PROJECTS_PATH + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Globals' + '/' + globalDefinition.fileName + let path = process.env.REQUIRED_PROJECTS_PATH + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Globals' + '/' + globalDefinition.fileName let requiredObject = require(path) let requiredFunction = requiredObject[globalDefinition.functionName] @@ -128,7 +128,7 @@ function setupUpTS() { if (projectDefinition.TS.functionLibraries !== undefined) { for (let j = 0; j < projectDefinition.TS.functionLibraries.length; j++) { let functionLibraryDefinition = projectDefinition.TS.functionLibraries[j] - let path = process.env.PROJECTS_PATH + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Function-Libraries' + '/' + functionLibraryDefinition.fileName + let path = process.env.REQUIRED_PROJECTS_PATH + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Function-Libraries' + '/' + functionLibraryDefinition.fileName let requiredObject = require(path) let requiredFunction = requiredObject[functionLibraryDefinition.functionName] @@ -140,7 +140,7 @@ function setupUpTS() { if (projectDefinition.TS.botClasses !== undefined) { for (let j = 0; j < projectDefinition.TS.botClasses.length; j++) { let botClassDefinition = projectDefinition.TS.botClasses[j] - let path = process.env.PROJECTS_PATH + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Bot-Classes' + '/' + botClassDefinition.fileName + let path = process.env.REQUIRED_PROJECTS_PATH + '/' + projectDefinition.name + '/' + 'TS' + '/' + 'Bot-Classes' + '/' + botClassDefinition.fileName let requiredObject = require(path) let requiredFunction = requiredObject[botClassDefinition.functionName] diff --git a/TaskServer/TradingSession.js b/TaskServer/TradingSession.js index 428ac09fd..1ffe7a8fb 100644 --- a/TaskServer/TradingSession.js +++ b/TaskServer/TradingSession.js @@ -410,18 +410,18 @@ function getTimeFrameFromLabel(timeFrameLabel) { - for (let i = 0; i < global.marketFilesPeriods.length; i++) { - let value = global.marketFilesPeriods[i][0] - let label = global.marketFilesPeriods[i][1] + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.marketFilesPeriods().length; i++) { + let value = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[i][0] + let label = TS.projects.superalgos.globals.timeFrames.marketFilesPeriods()[i][1] if (timeFrameLabel === label) { return value } } - for (let i = 0; i < global.dailyFilePeriods.length; i++) { - let value = global.dailyFilePeriods[i][0] - let label = global.dailyFilePeriods[i][1] + for (let i = 0; i < TS.projects.superalgos.globals.timeFrames.dailyFilePeriods().length; i++) { + let value = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[i][0] + let label = TS.projects.superalgos.globals.timeFrames.dailyFilePeriods()[i][1] if (timeFrameLabel === label) { return value