Update samples in the documentation

This commit is contained in:
Matthias
2023-08-14 16:16:23 +02:00
parent bef5e191a4
commit 6e32f172be
4 changed files with 24 additions and 15 deletions

View File

@@ -901,7 +901,8 @@ Stoploss values returned from `custom_stoploss` must specify a percentage relati
use_custom_stoploss = True
def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime,
current_rate: float, current_profit: float, **kwargs) -> float:
current_rate: float, current_profit: float, after_fill: bool,
**kwargs) -> float:
# once the profit has risen above 10%, keep the stoploss at 7% above the open price
if current_profit > 0.10:
@@ -943,7 +944,8 @@ In some situations it may be confusing to deal with stops relative to current ra
return dataframe
def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime,
current_rate: float, current_profit: float, **kwargs) -> float:
current_rate: float, current_profit: float, after_fill: bool,
**kwargs) -> float:
dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
candle = dataframe.iloc[-1].squeeze()
return stoploss_from_absolute(current_rate - (candle['atr'] * 2), current_rate, is_short=trade.is_short)