Add link between stoploss_from_open and custom_stop documentation

This commit is contained in:
Matthias 2021-03-18 06:46:08 +01:00
parent 983c0ef118
commit b6e9e74a8b
2 changed files with 3 additions and 4 deletions

View File

@ -178,10 +178,9 @@ class AwesomeStrategy(IStrategy):
return -0.15
```
#### Calculating stoploss relative to open price
Stoploss values returned from `custom_stoploss()` always specify a percentage relative to `current_rate`. In order to set a stoploss relative to the *open* price, we need to use `current_profit` to calculate what percentage relative to the `current_rate` will give you the same result as if the percentage was specified from the open price.
Stoploss values returned from `custom_stoploss()` always specify a percentage relative to `current_rate`. In order to set a stoploss relative to the *open* price, we need to use `current_profit` to calculate what percentage relative to the `current_rate` will give you the same result as if the percentage was specified from the open price.
The helper function [`stoploss_from_open()`](strategy-customization.md#stoploss_from_open) can be used to convert from an open price relative stop, to a current price relative stop which can be returned from `custom_stoploss()`.
@ -189,7 +188,6 @@ The helper function [`stoploss_from_open()`](strategy-customization.md#stoploss_
Use the initial stoploss until the profit is above 4%, then use a trailing stoploss of 50% of the current profit with a minimum of 2.5% and a maximum of 5%.
``` python
from datetime import datetime, timedelta
from freqtrade.persistence import Trade

View File

@ -600,9 +600,9 @@ Stoploss values returned from `custom_stoploss` must specify a percentage relati
``` python
from freqtrade.strategy import IStrategy, stoploss_from_open
from datetime import datetime
from freqtrade.persistence import Trade
from freqtrade.strategy import IStrategy, stoploss_from_open
class AwesomeStrategy(IStrategy):
@ -621,6 +621,7 @@ Stoploss values returned from `custom_stoploss` must specify a percentage relati
```
Full examples can be found in the [Custom stoploss](strategy-advanced.md#custom-stoploss) section of the Documentation.
## Additional data (Wallets)