From 27d2c35e789f50198b5feaaf326302fa0cee40e3 Mon Sep 17 00:00:00 2001 From: cozed-gh <76752164+cozed-gh@users.noreply.github.com> Date: Tue, 9 Mar 2021 12:19:10 +0100 Subject: [PATCH] Started the User Examples --- ...trailing-stop-loss-percentage-of-rate.json | 44 ++++++++++++++++++ ...top-loss-risk-of-total-quoted-balance.json | 46 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 Projects/Superalgos/Schemas/Docs-Topics/user-examples-for-stop-loss-001-trailing-stop-loss-percentage-of-rate.json create mode 100644 Projects/Superalgos/Schemas/Docs-Topics/user-examples-for-stop-loss-002-trailing-stop-loss-risk-of-total-quoted-balance.json diff --git a/Projects/Superalgos/Schemas/Docs-Topics/user-examples-for-stop-loss-001-trailing-stop-loss-percentage-of-rate.json b/Projects/Superalgos/Schemas/Docs-Topics/user-examples-for-stop-loss-001-trailing-stop-loss-percentage-of-rate.json new file mode 100644 index 000000000..e371d17ca --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/user-examples-for-stop-loss-001-trailing-stop-loss-percentage-of-rate.json @@ -0,0 +1,44 @@ +{ + "topic": "User Examples for Stop Loss ", + "pageNumber": 1, + "type": " Trailing Stop Loss - Percentage of Rate", + "definition": { + "text": "A Trailing Stop Loss tracks the rate and sets the Stop Loss a given distance away from it", + "updated": 1615285882641 + }, + "paragraphs": [ + { + "style": "Note", + "text": "Change the \"trailingStopLoss\" value to what you see fit.", + "updated": 1615286541864 + }, + { + "style": "Subtitle", + "text": "Trailing Stop Loss for a Long Position" + }, + { + "style": "Javascript", + "text": "\nlet trailingStopLoss = 3 // Set the percentage you wish your Trailing Stop Loss to trail\n\nif ( chart.at01min.candle.close * ( 1 - (trailingStopLoss / 100) ) > tradingEngine.tradingCurrent.position.stopLoss.value ) {\nchart.at01min.candle.close * ( 1 - (trailingStopLoss / 100) )\n}\nelse {\ntradingEngine.tradingCurrent.position.stopLoss.value\n}", + "updated": 1615286314820 + }, + { + "style": "Important", + "text": "For a Long Position we want our Stop Loss below the actual rate", + "updated": 1615286643236 + }, + { + "style": "Subtitle", + "text": "Trailing Stop Loss for a Short Position" + }, + { + "style": "Javascript", + "text": "\nlet trailingStopLoss = 3 // Set the percentage you wish your Trailing Stop Loss to trail\n\nif ( chart.at01min.candle.close * ( 1 + (trailingStopLoss / 100) ) > tradingEngine.tradingCurrent.position.stopLoss.value ) {\nchart.at01min.candle.close * ( 1 + (trailingStopLoss / 100) )\n}\nelse {\ntradingEngine.tradingCurrent.position.stopLoss.value\n}", + "updated": 1615286314820 + }, + { + "style": "Important", + "text": "For a Short Position we want our Stop Loss above the actual rate", + "updated": 1615286643236 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/user-examples-for-stop-loss-002-trailing-stop-loss-risk-of-total-quoted-balance.json b/Projects/Superalgos/Schemas/Docs-Topics/user-examples-for-stop-loss-002-trailing-stop-loss-risk-of-total-quoted-balance.json new file mode 100644 index 000000000..84fe43f85 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/user-examples-for-stop-loss-002-trailing-stop-loss-risk-of-total-quoted-balance.json @@ -0,0 +1,46 @@ +{ + "topic": "User Examples for Stop Loss ", + "pageNumber": 2, + "type": " Trailing Stop Loss - Risk of Total Quoted Balance", + "definition": { + "text": "This Trailing Stop Loss sets the Stop Loss according to the percentage you are willing to risk out of your Total Quoted Balance", + "updated": 1615287509462 + }, + "paragraphs": [ + { + "style": "Note", + "text": "Change the \"riskPercentage\" value to what you see fit", + "updated": 1615288038247 + }, + { + "style": "Title", + "text": "Risk of Total Quoted Balance" + }, + { + "style": "Text", + "text": "The idea is based upon that with each position you take, you only want to risk a certain percentage out of your total balance." + }, + { + "style": "Text", + "text": "Given that you might take several positions, this code sets the stop loss at the point where the loss would be equal to the Risk Percentage out of your Total Quoted Balance." + }, + { + "style": "Subtitle", + "text": "Example for a Long Position" + }, + { + "style": "Javascript", + "text": "\nlet riskPercentage = 2\n\nif ( tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 - (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value)) > tradingEngine.tradingCurrent.position.stopLoss.value ) \n\n{\ntradingEngine.tradingCurrent.position.entryTargetRate.value * (1 - (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value))\n}\n\nelse {\ntradingEngine.tradingCurrent.position.stopLoss.value\n}", + "updated": 1615287799360 + }, + { + "style": "Subtitle", + "text": "Example for a Short Position" + }, + { + "style": "Javascript", + "text": "\nlet riskPercentage = 2\n\nif ( tradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value)) > tradingEngine.tradingCurrent.position.stopLoss.value ) \n\n{\ntradingEngine.tradingCurrent.position.entryTargetRate.value * (1 + (( tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value * (riskPercentage / 100)) / tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value))\n}\n\nelse {\ntradingEngine.tradingCurrent.position.stopLoss.value\n}", + "updated": 1615287799360 + } + ] +} \ No newline at end of file