Add very simple short logic to test-strategy

This commit is contained in:
Matthias
2021-09-22 20:36:03 +02:00
parent 5928ba9c88
commit 4c6b1cd55b
2 changed files with 18 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
from datetime import datetime
import talib.abstract as ta
from pandas import DataFrame
@@ -138,7 +139,11 @@ class StrategyTestV3(IStrategy):
(dataframe['plus_di'] > self.buy_plusdi.value)
),
'enter_long'] = 1
# TODO-lev: Add short logic
dataframe.loc[
(
qtpylib.crossed_below(dataframe['rsi'], self.sell_rsi.value)
),
'enter_short'] = 1
return dataframe
@@ -158,6 +163,12 @@ class StrategyTestV3(IStrategy):
),
'exit_long'] = 1
dataframe.loc[
(
qtpylib.crossed_above(dataframe['rsi'], self.buy_rsi.value)
),
'exit_short'] = 1
# TODO-lev: Add short logic
return dataframe