rename to buy_tag

This commit is contained in:
kevinjulian
2021-07-21 20:05:35 +07:00
parent db1e676639
commit 49886874aa
15 changed files with 47 additions and 47 deletions

View File

@@ -114,7 +114,7 @@ class AwesomeStrategy(IStrategy):
See [Dataframe access](#dataframe-access) for more information about dataframe use in strategy callbacks.
## Buy Signal Name
## Buy Tag
When your strategy has multiple buy signal, you can name it.
Then you can access you buy signal on `custom_sell`
@@ -126,7 +126,7 @@ def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
(dataframe['rsi'] < 35) &
(dataframe['volume'] > 0)
),
['buy', 'buy_signal_name']] = 1, 'buy_signal_rsi'
['buy', 'buy_tag']] = 1, 'buy_signal_rsi'
return dataframe
@@ -134,7 +134,7 @@ def custom_sell(self, pair: str, trade: Trade, current_time: datetime, current_r
current_profit: float, **kwargs):
dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
last_candle = dataframe.iloc[-1].squeeze()
if trade.buy_signal_name == 'buy_signal_rsi' and last_candle['rsi'] > 80:
if trade.buy_tag == 'buy_signal_rsi' and last_candle['rsi'] > 80:
return 'sell_signal_rsi'
return None