Add few missing info on shorting setup

This commit is contained in:
Stefano Ariestasia
2022-03-29 10:51:36 +09:00
parent 7c2e8420af
commit 05db0067ee
3 changed files with 43 additions and 2 deletions

View File

@@ -235,7 +235,7 @@ def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFram
Short-trades need to be supported by your exchange and market configuration!
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:
dataframe.loc[
(
@@ -256,7 +256,26 @@ def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFram
['enter_short', 'enter_tag']] = (1, 'rsi_cross')
return dataframe
```
```
!!! Note
`enter_long` column must be set, even when your strategy is a shorting-only strategy. On other hand, enter_short is an optional column and don't need to be set if the strategy is a long-only strategy
```python
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[: ,'enter_long'] = 0
dataframe.loc[
(
(qtpylib.crossed_below(dataframe['rsi'], 70)) & # Signal: RSI crosses below 70
(dataframe['tema'] > dataframe['bb_middleband']) & # Guard
(dataframe['tema'] < dataframe['tema'].shift(1)) & # Guard
(dataframe['volume'] > 0) # Make sure Volume is not 0
),
['enter_short', 'enter_tag']] = (1, 'rsi_cross')
return dataframe
```
!!! Note
Buying requires sellers to buy from - therefore volume needs to be > 0 (`dataframe['volume'] > 0`) to make sure that the bot does not buy/sell in no-activity periods.