Merge pull request #1078 from Smidy13/develop

Bug Fix: Display Error if Trading System Formula Evaluates as Undefined
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-06-05 09:03:55 -04:00
commit cfa0a51fca
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
}
}