From 1b5cb3427e36498efa85e0bf432b3238b34cb78d Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 8 Oct 2020 08:09:55 +0200 Subject: [PATCH 1/4] Fix example R calculation in edge documentation --- docs/edge.md | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/docs/edge.md b/docs/edge.md index 500c3c833..7b6a6d8e8 100644 --- a/docs/edge.md +++ b/docs/edge.md @@ -82,20 +82,33 @@ Risk Reward Ratio ($R$) is a formula used to measure the expected gains of a giv $$ R = \frac{\text{potential_profit}}{\text{potential_loss}} $$ ???+ Example "Worked example of $R$ calculation" - Let's say that you think that the price of *stonecoin* today is $10.0. You believe that, because they will start mining stonecoin, it will go up to $15.0 tomorrow. There is the risk that the stone is too hard, and the GPUs can't mine it, so the price might go to $0 tomorrow. You are planning to invest $100.
- Your potential profit is calculated as:
+ Let's say that you think that the price of *stonecoin* today is $10.0. You believe that, because they will start mining stonecoin, it will go up to $15.0 tomorrow. There is the risk that the stone is too hard, and the GPUs can't mine it, so the price might go to $0 tomorrow. You are planning to invest $100. + + Your potential profit is calculated as: + $\begin{aligned} - \text{potential_profit} &= (\text{potential_price} - \text{cost_per_unit}) * \frac{\text{investment}}{\text{cost_per_unit}} \\ - &= (15 - 10) * \frac{100}{15}\\ - &= 33.33 - \end{aligned}$
- Since the price might go to $0, the $100 dolars invested could turn into 0. We can compute the Risk Reward Ratio as follows:
+ \text{potential_profit} &= (\text{potential_price} - \text{entry_price}) * \text{investment} \\ + &= (15 - 10) * 100\\ + &= 500 + \end{aligned}$ + + Since the price might go to $0, the $100 dollars invested could turn into 0. + + We do however use a stoploss of 15% - so in the worst case, we'll sell 15% below entry price (or at 8.5). + + $\begin{aligned} + \text{risk} &= (\text{entry_price} - \text{stoploss}) * \text{investment} \\ + &= (10 - (10 * (1 - 0.15))) * 100\\ + &= 150 + \end{aligned}$ + + We can compute the Risk Reward Ratio as follows:
$\begin{aligned} R &= \frac{\text{potential_profit}}{\text{potential_loss}}\\ - &= \frac{33.33}{100}\\ - &= 0.333... + &= \frac{500}{150}\\ + &= 3.33 \end{aligned}$
- What it effectivelly means is that the strategy have the potential to make $0.33 for each $1 invested. + What it effectively means is that the strategy have the potential to make 3$ for each $1 invested. On a long horizon, that is, on many trades, we can calculate the risk reward by dividing the strategy' average profit on winning trades by the strategy' average loss on losing trades. We can calculate the average profit, $\mu_{win}$, as follows: From 48750b0ef85c3c52cc20c5431bee13c68ab619ba Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 8 Oct 2020 08:23:56 +0200 Subject: [PATCH 2/4] Improve wording in formula --- docs/edge.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/edge.md b/docs/edge.md index 7b6a6d8e8..0891a851e 100644 --- a/docs/edge.md +++ b/docs/edge.md @@ -93,11 +93,11 @@ $$ R = \frac{\text{potential_profit}}{\text{potential_loss}} $$ \end{aligned}$ Since the price might go to $0, the $100 dollars invested could turn into 0. - + We do however use a stoploss of 15% - so in the worst case, we'll sell 15% below entry price (or at 8.5). $\begin{aligned} - \text{risk} &= (\text{entry_price} - \text{stoploss}) * \text{investment} \\ + \text{potential_loss} &= (\text{entry_price} - \text{stoploss}) * \text{investment} \\ &= (10 - (10 * (1 - 0.15))) * 100\\ &= 150 \end{aligned}$ From 6bb045f5655959c01455d4a886ac6485f17e354b Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 8 Oct 2020 08:30:30 +0200 Subject: [PATCH 3/4] Simplify stoploss calculation --- docs/edge.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/edge.md b/docs/edge.md index 0891a851e..d3a6af8ba 100644 --- a/docs/edge.md +++ b/docs/edge.md @@ -94,11 +94,11 @@ $$ R = \frac{\text{potential_profit}}{\text{potential_loss}} $$ Since the price might go to $0, the $100 dollars invested could turn into 0. - We do however use a stoploss of 15% - so in the worst case, we'll sell 15% below entry price (or at 8.5). + We do however use a stoploss of 15% - so in the worst case, we'll sell 15% below entry price (or at 8.5$). $\begin{aligned} \text{potential_loss} &= (\text{entry_price} - \text{stoploss}) * \text{investment} \\ - &= (10 - (10 * (1 - 0.15))) * 100\\ + &= (10 - 8.5) * 100\\ &= 150 \end{aligned}$ @@ -108,7 +108,7 @@ $$ R = \frac{\text{potential_profit}}{\text{potential_loss}} $$ &= \frac{500}{150}\\ &= 3.33 \end{aligned}$
- What it effectively means is that the strategy have the potential to make 3$ for each $1 invested. + What it effectively means is that the strategy have the potential to make 3.33$ for each $1 invested. On a long horizon, that is, on many trades, we can calculate the risk reward by dividing the strategy' average profit on winning trades by the strategy' average loss on losing trades. We can calculate the average profit, $\mu_{win}$, as follows: From 7f0afe12446fa879463b91ad1dda3611caec7948 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 8 Oct 2020 10:24:52 +0200 Subject: [PATCH 4/4] Fix calculation to not show losses > initial investment --- docs/edge.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/edge.md b/docs/edge.md index d3a6af8ba..7442f1927 100644 --- a/docs/edge.md +++ b/docs/edge.md @@ -82,14 +82,14 @@ Risk Reward Ratio ($R$) is a formula used to measure the expected gains of a giv $$ R = \frac{\text{potential_profit}}{\text{potential_loss}} $$ ???+ Example "Worked example of $R$ calculation" - Let's say that you think that the price of *stonecoin* today is $10.0. You believe that, because they will start mining stonecoin, it will go up to $15.0 tomorrow. There is the risk that the stone is too hard, and the GPUs can't mine it, so the price might go to $0 tomorrow. You are planning to invest $100. + Let's say that you think that the price of *stonecoin* today is $10.0. You believe that, because they will start mining stonecoin, it will go up to $15.0 tomorrow. There is the risk that the stone is too hard, and the GPUs can't mine it, so the price might go to $0 tomorrow. You are planning to invest $100, which will give you 10 shares (100 / 10). Your potential profit is calculated as: $\begin{aligned} - \text{potential_profit} &= (\text{potential_price} - \text{entry_price}) * \text{investment} \\ - &= (15 - 10) * 100\\ - &= 500 + \text{potential_profit} &= (\text{potential_price} - \text{entry_price}) * \frac{\text{investment}}{\text{entry_price}} \\ + &= (15 - 10) * (100 / 10) \\ + &= 50 \end{aligned}$ Since the price might go to $0, the $100 dollars invested could turn into 0. @@ -97,15 +97,16 @@ $$ R = \frac{\text{potential_profit}}{\text{potential_loss}} $$ We do however use a stoploss of 15% - so in the worst case, we'll sell 15% below entry price (or at 8.5$). $\begin{aligned} - \text{potential_loss} &= (\text{entry_price} - \text{stoploss}) * \text{investment} \\ - &= (10 - 8.5) * 100\\ - &= 150 + \text{potential_loss} &= (\text{entry_price} - \text{stoploss}) * \frac{\text{investment}}{\text{entry_price}} \\ + &= (10 - 8.5) * (100 / 10)\\ + &= 15 \end{aligned}$ - We can compute the Risk Reward Ratio as follows:
+ We can compute the Risk Reward Ratio as follows: + $\begin{aligned} R &= \frac{\text{potential_profit}}{\text{potential_loss}}\\ - &= \frac{500}{150}\\ + &= \frac{50}{15}\\ &= 3.33 \end{aligned}$
What it effectively means is that the strategy have the potential to make 3.33$ for each $1 invested.