Merge pull request #3842 from freqtrade/edge_docs
Fix example R calculation in edge documentation
This commit is contained in:
commit
028dd8be3e
34
docs/edge.md
34
docs/edge.md
@ -82,20 +82,34 @@ Risk Reward Ratio ($R$) is a formula used to measure the expected gains of a giv
|
|||||||
$$ R = \frac{\text{potential_profit}}{\text{potential_loss}} $$
|
$$ R = \frac{\text{potential_profit}}{\text{potential_loss}} $$
|
||||||
|
|
||||||
???+ Example "Worked example of $R$ calculation"
|
???+ 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.<br>
|
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:<br>
|
|
||||||
|
Your potential profit is calculated as:
|
||||||
|
|
||||||
$\begin{aligned}
|
$\begin{aligned}
|
||||||
\text{potential_profit} &= (\text{potential_price} - \text{cost_per_unit}) * \frac{\text{investment}}{\text{cost_per_unit}} \\
|
\text{potential_profit} &= (\text{potential_price} - \text{entry_price}) * \frac{\text{investment}}{\text{entry_price}} \\
|
||||||
&= (15 - 10) * \frac{100}{15}\\
|
&= (15 - 10) * (100 / 10) \\
|
||||||
&= 33.33
|
&= 50
|
||||||
\end{aligned}$<br>
|
\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:<br>
|
|
||||||
|
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{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:
|
||||||
|
|
||||||
$\begin{aligned}
|
$\begin{aligned}
|
||||||
R &= \frac{\text{potential_profit}}{\text{potential_loss}}\\
|
R &= \frac{\text{potential_profit}}{\text{potential_loss}}\\
|
||||||
&= \frac{33.33}{100}\\
|
&= \frac{50}{15}\\
|
||||||
&= 0.333...
|
&= 3.33
|
||||||
\end{aligned}$<br>
|
\end{aligned}$<br>
|
||||||
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.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:
|
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:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user