From 5edc510c2cebdb8ba8a4256679be0f23224f33a3 Mon Sep 17 00:00:00 2001 From: Philip Love Date: Fri, 21 May 2021 21:52:32 -0400 Subject: [PATCH] Fixed: Bug where checkUserDefinedCode called even if stage didn't exist --- .../Trading-Bot/Low-Frequency-Trading/TradingStages.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingStages.js b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingStages.js index 62f4f6a44..5501ba4f2 100644 --- a/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingStages.js +++ b/Projects/Superalgos/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingStages.js @@ -1255,7 +1255,8 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) { function checkUserDefinedCode(stage, status, when) { let tradingSystemStage = getTradingSystemStage(stage); - if (tradingSystemStage.userDefinedCode !== undefined) { + if (tradingSystemStage !== undefined && + tradingSystemStage.userDefinedCode !== undefined) { if (status === 'Running' && when !== tradingSystemStage.userDefinedCode.config.whileAtStageWhenToRun) { return; } switch(status) {