diff --git a/Projects/Superalgos/Schemas/Docs-Nodes/close-stage.json b/Projects/Superalgos/Schemas/Docs-Nodes/close-stage.json index 6062294a9..8c36f2243 100644 --- a/Projects/Superalgos/Schemas/Docs-Nodes/close-stage.json +++ b/Projects/Superalgos/Schemas/Docs-Nodes/close-stage.json @@ -8,9 +8,32 @@ "style": "Block", "text": "Content" }, + { + "style": "Title", + "text": "Optionality", + "updated": 1615101975045 + }, + { + "style": "Note", + "text": "The Close Stage is optional. That means that if you don't need it you can just delete this node and everything should work just fine. " + }, { "style": "Text", - "text": "The close stage is opened when either the stop loss or take profit targets are hit." + "text": "There are situations where users might want to execute both buy and sell orders from within the Open Stage. In those situations they might want to delete the Manage Stage and the Close Stage so that they don't execute at all. That is possible because both are optional. This is how optionality looks like at the code:", + "updated": 1615102048658 + }, + { + "style": "Javascript", + "text": "/*\nThe system allows the user not to define a close stage, because the close stage is optional.\nHere we are goint to see if that is the case and if it is, we will inmidiatelly consider \nthe close stage as closed.\n*/\nif (tradingSystem.tradingStrategies[tradingEngine.tradingCurrent.strategy.index.value].closeStage === undefined) {\n changeStageStatus('Close Stage', 'Closed', 'Close Stage Undefined')\n return\n}", + "updated": 1615102065680 + }, + { + "style": "Title", + "text": "Close Stage Concept" + }, + { + "style": "Text", + "text": "The close stage is opened when either the stop loss or take profit targets are hit. It is also opened after the position is opened if the Manage Stage is undefined." }, { "style": "Text", diff --git a/Projects/Superalgos/Schemas/Docs-Nodes/manage-stage.json b/Projects/Superalgos/Schemas/Docs-Nodes/manage-stage.json index 6d483c564..1f1c65360 100644 --- a/Projects/Superalgos/Schemas/Docs-Nodes/manage-stage.json +++ b/Projects/Superalgos/Schemas/Docs-Nodes/manage-stage.json @@ -8,6 +8,30 @@ "style": "Block", "text": "Content" }, + { + "style": "Title", + "text": "Optionality", + "updated": 1615101510181 + }, + { + "style": "Note", + "text": "This Stage is optional. That means that if you do not want to deal with Stop Loss or Take Profits at your strategy, you can just delete this node and everything will continue working just fine. If you do remove this node, what will happen at runtime is that as soon as the position is triggered, the system will detect that that the Manage Stage is undefined, and it will jump it by opening the Close Stage (if it exists, because it is also optional)" + }, + { + "style": "Text", + "text": "This is how optionality looks like at the code:", + "updated": 1615101627343 + }, + { + "style": "Javascript", + "text": "/* Opening Status Procedure */\nif (tradingEngine.tradingCurrent.strategyManageStage.status.value === 'Opening') {\n /*\n The system allows the user not to define a Manage Stage, because the Manage Stage is optional.\n Here we are going to see if that is the case and if it is, we will inmidiatelly consider \n the Manage Stage as closed.\n */\n if (tradingSystem.tradingStrategies[tradingEngine.tradingCurrent.strategy.index.value].manageStage === undefined) {\n changeStageStatus('Manage Stage', 'Closed', 'Manage Stage Undefined')\n changeStageStatus('Close Stage', 'Opening')\n return\n }\n\n /* Now we switch to the Open status. */\n changeStageStatus('Manage Stage', 'Open')\n}", + "updated": 1615101667889 + }, + { + "style": "Title", + "text": "Manage Stage Concept", + "updated": 1615101706028 + }, { "style": "Text", "text": "The first and foremost rule of trading is to preserve capital and its main goal is to increase it." diff --git a/Projects/Superalgos/Schemas/Docs-Nodes/size-filled.json b/Projects/Superalgos/Schemas/Docs-Nodes/size-filled.json index f819b575f..3b639832d 100644 --- a/Projects/Superalgos/Schemas/Docs-Nodes/size-filled.json +++ b/Projects/Superalgos/Schemas/Docs-Nodes/size-filled.json @@ -1,7 +1,8 @@ { "type": "Size Filled", "definition": { - "text": "Size filled is the amount of the order that has been filled at the exchange." + "text": "Size filled is the amount of the order that has been filled at the exchange. It can also represent the cumulative Size Filled of the Open or Close Stages.", + "updated": 1615100388371 }, "paragraphs": [ { diff --git a/Projects/Superalgos/Schemas/Docs-Topics/frequently-asked-questions-001-why-my-stage-is-not-closing.json b/Projects/Superalgos/Schemas/Docs-Topics/frequently-asked-questions-001-why-my-stage-is-not-closing.json index edd9dd674..9ead986d4 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/frequently-asked-questions-001-why-my-stage-is-not-closing.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/frequently-asked-questions-001-why-my-stage-is-not-closing.json @@ -3,14 +3,14 @@ "pageNumber": 1, "type": "Why My Stage is not Closing?", "definition": { - "text": "One of the most common questions asked by users is why the open or close stage are not closing after the order was filled?", - "updated": 1615053580910 + "text": "One of the most common questions asked by users is why the open or close stage are not closing after the order was filled.", + "updated": 1615100269026 }, "paragraphs": [ { "style": "Note", - "text": "The shot answer is becasue the Stage Filled Size did not reach the value of the Stage Target Size. ", - "updated": 1615053684185 + "text": "The shot answer is becasue the Stage Size Filled did not reach the value of the Stage Target Size.", + "updated": 1615100332173 }, { "style": "Text", 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 158ba86d5..df0e92cae 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 @@ -410,7 +410,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) { if (tradingEngine.tradingCurrent.strategyManageStage.status.value === 'Opening') { /* The system allows the user not to define a Manage Stage, because the Manage Stage is optional. - Here we are goint to see if that is the case and if it is, we will inmidiatelly consider + Here we are going to see if that is the case and if it is, we will inmidiatelly consider the Manage Stage as closed. */ if (tradingSystem.tradingStrategies[tradingEngine.tradingCurrent.strategy.index.value].manageStage === undefined) { @@ -979,7 +979,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) { case 'Base Asset': { if ( tradingEngineStage.stageBaseAsset.sizeFilled.value - * + * ROUNDING_ERROR_CORRECTION_FACTOR + ABSOLUTE_DUST_IN_BASE_ASSET @@ -995,7 +995,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) { case 'Quoted Asset': { if ( tradingEngineStage.stageQuotedAsset.sizeFilled.value - * + * ROUNDING_ERROR_CORRECTION_FACTOR + ABSOLUTE_DUST_IN_QUOTED_ASSET