Bug Fix: Display Error if Trading System Formula Evaluates as Undefined

This commit is contained in:
Smidy13 committed 2021-06-05 16:51:25 +12:00
1 parent 98cca71c5a
commit 68697c7280
2 files changed
+15 -2

No files matched your search

@@ -148,7 +148,7 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
function updateStopLossTakeProfitFinalValue(node) {
/*
We set the final value just before calcualting the new value, since the new calculated
We set the final value just before calculating the new value, since the new calculated
value is going to be discarded if the position is closed after it is calculated, but
during the same candle.
*/
@@ -158,7 +158,7 @@ exports.newSuperalgosBotModulesTradingPosition = function (processIndex) {
function updateStopLossTakeProfitBeginEnd(node) {
/*
Both the Stop Loss and the Take Profit have their own Begin and End.
Ther reason for this is because they represent targets to be checked
The reason for this is because they represent targets to be checked
at the next candle, so it does not apply that they share the begin and
end of the position itself.
*/
@@ -403,6 +403,19 @@ exports.newSuperalgosBotModulesTradingSystem = function (processIndex) {
tradingSystem.values.push([node.id, value])
tradingSystem.formulas.set(node.id, value)
} else {
docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Error - Formula Value Not A Number',
placeholder: {}
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, undefined, node.name, node.code, undefined, value)
tradingSystem.addError([node.id, 'Formula needs to return a numeric value.', docs])
return
}
}