Update strategy-customization.md

This commit is contained in:
Stefano Ariestasia 2022-03-30 08:37:11 +09:00
parent c615e4fcc2
commit 4d5f6ed5e2
1 changed files with 17 additions and 17 deletions

View File

@ -236,24 +236,24 @@ def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFram
Please make sure to set [`can_short`]() appropriately on your strategy if you intend to short. Please make sure to set [`can_short`]() appropriately on your strategy if you intend to short.
```python ```python
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[ dataframe.loc[
( (
(qtpylib.crossed_above(dataframe['rsi'], 30)) & # Signal: RSI crosses above 30 (qtpylib.crossed_above(dataframe['rsi'], 30)) & # Signal: RSI crosses above 30
(dataframe['tema'] <= dataframe['bb_middleband']) & # Guard (dataframe['tema'] <= dataframe['bb_middleband']) & # Guard
(dataframe['tema'] > dataframe['tema'].shift(1)) & # Guard (dataframe['tema'] > dataframe['tema'].shift(1)) & # Guard
(dataframe['volume'] > 0) # Make sure Volume is not 0 (dataframe['volume'] > 0) # Make sure Volume is not 0
), ),
['enter_long', 'enter_tag']] = (1, 'rsi_cross') ['enter_long', 'enter_tag']] = (1, 'rsi_cross')
dataframe.loc[ dataframe.loc[
( (
(qtpylib.crossed_below(dataframe['rsi'], 70)) & # Signal: RSI crosses below 70 (qtpylib.crossed_below(dataframe['rsi'], 70)) & # Signal: RSI crosses below 70
(dataframe['tema'] > dataframe['bb_middleband']) & # Guard (dataframe['tema'] > dataframe['bb_middleband']) & # Guard
(dataframe['tema'] < dataframe['tema'].shift(1)) & # Guard (dataframe['tema'] < dataframe['tema'].shift(1)) & # Guard
(dataframe['volume'] > 0) # Make sure Volume is not 0 (dataframe['volume'] > 0) # Make sure Volume is not 0
), ),
['enter_short', 'enter_tag']] = (1, 'rsi_cross') ['enter_short', 'enter_tag']] = (1, 'rsi_cross')
return dataframe return dataframe
``` ```