All nodes can be added via menu

This commit is contained in:
Luis Fernando Molina committed 2019-05-27 16:04:37 +02:00
1 parent 44dfc0f57e
commit 976dc22ab1
2 files changed
+25 -1

No files matched your search

@@ -153,7 +153,7 @@ function newNodeDeleter () {
let payload = node.payload
if (payload.parentNode !== undefined) {
switch (node.type) {
case 'Stop Loss': {
case 'Stop': {
payload.parentNode.stopLoss = undefined
break
}
@@ -4,6 +4,8 @@ function newPartsFromNodes () {
newStrategy: newStrategy,
addMissingStages: addMissingStages,
addMissingEvents: addMissingEvents,
addMissingItems: addMissingItems,
addInitialDefinition: addInitialDefinition,
addPhase: addPhase,
addSituation: addSituation,
addCondition: addCondition
@@ -282,6 +284,28 @@ function newPartsFromNodes () {
}
}
function addMissingItems (node) {
if (node.stopLoss === undefined) {
node.stopLoss = {
phases: []
}
createPart('Stop', '', node.stopLoss, node, node)
}
if (node.buyOrder === undefined) {
node.buyOrder = {
phases: []
}
createPart('Take Profit', '', node.buyOrder, node, node)
}
}
function addInitialDefinition (node) {
if (node.initialDefinition === undefined) {
node.initialDefinition = {}
createPart('Initial Definition', '', node.initialDefinition, node, node)
}
}
function addPhase (parentNode) {
let phaseParent = parentNode
let m = phaseParent.phases.length