Started the "User Examples" docs

This commit is contained in:
cozed-gh committed 2021-03-09 12:13:46 +01:00
1 parent aa0f66a53a
commit 0805284d5a
2 files changed
+90

No files matched your search

@@ -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
}
]
}
@@ -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
}
]
}