Update strategies to new Strategy interface
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
This Git repo contains free buy/sell strategies for [Freqtrade](https://github.com/freqtrade/freqtrade).
|
||||
|
||||
All strategies should work with a freqtrade version of 2022.4 or newer.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
These strategies are for educational purposes only. Do not risk money
|
||||
@@ -31,7 +33,7 @@ bot.
|
||||
## Free trading strategies
|
||||
|
||||
Value below are result from backtesting from 2018-01-10 to 2018-01-30 and
|
||||
`ask_strategy.sell_profit_only` enabled. More detail on each strategy
|
||||
`exit_profit_only` enabled. More detail on each strategy
|
||||
page.
|
||||
|
||||
| Strategy | Buy count | AVG profit % | Total profit | AVG duration | Backtest period |
|
||||
|
||||
@@ -77,7 +77,7 @@ class GodStraHo(IHyperOpt):
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
@@ -119,11 +119,11 @@ class GodStraHo(IHyperOpt):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
return populate_entry_trend
|
||||
|
||||
@ staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
@@ -149,7 +149,7 @@ class GodStraHo(IHyperOpt):
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
@@ -192,8 +192,8 @@ class GodStraHo(IHyperOpt):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell']=1
|
||||
'exit_long']=1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
return populate_exit_trend
|
||||
|
||||
@@ -53,16 +53,16 @@ class BreakEven(IStrategy):
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
),
|
||||
'buy'] = 0
|
||||
'enter_long'] = 0
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
),
|
||||
'sell'] = 0
|
||||
'exit_long'] = 0
|
||||
return dataframe
|
||||
|
||||
@@ -121,7 +121,7 @@ class Diamond(IStrategy):
|
||||
# dataframe['{...}'] = ta.{...}(dataframe, timeperiod={...})
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = []
|
||||
conditions.append(
|
||||
qtpylib.crossed_above
|
||||
@@ -134,11 +134,11 @@ class Diamond(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy']=1
|
||||
'enter_long']=1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = []
|
||||
conditions.append(
|
||||
qtpylib.crossed_below
|
||||
@@ -150,5 +150,5 @@ class Diamond(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell']=1
|
||||
'exit_long']=1
|
||||
return dataframe
|
||||
|
||||
@@ -93,7 +93,7 @@ class GodStra(IStrategy):
|
||||
# dataframe.to_csv("df.csv", index=True)
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = list()
|
||||
# /5: Cuz We have 5 Group of variables inside buy_param
|
||||
for i in range(self.dna_size(self.buy_params)):
|
||||
@@ -132,11 +132,11 @@ class GodStra(IStrategy):
|
||||
print(conditions)
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = list()
|
||||
for i in range(self.dna_size(self.sell_params)):
|
||||
OPR = self.sell_params[f'sell-oper-{i}']
|
||||
@@ -172,6 +172,6 @@ class GodStra(IStrategy):
|
||||
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -87,7 +87,7 @@ class Heracles(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
@@ -108,13 +108,13 @@ class Heracles(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy']=1
|
||||
'enter_long']=1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
dataframe.loc[:, 'sell'] = 0
|
||||
dataframe.loc[:, 'exit_long'] = 0
|
||||
return dataframe
|
||||
|
||||
@@ -85,19 +85,19 @@ class HourBasedStrategy(IStrategy):
|
||||
dataframe['hour'] = dataframe['date'].dt.hour
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['hour'].between(self.buy_hour_min.value, self.buy_hour_max.value))
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['hour'].between(self.sell_hour_min.value, self.sell_hour_max.value))
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -46,14 +46,14 @@ class InformativeSample(IStrategy):
|
||||
ta_on_candle = False
|
||||
|
||||
# Experimental settings (configuration will overide these if set)
|
||||
use_sell_signal = True
|
||||
sell_profit_only = True
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = True
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
# Optional order type mapping
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class InformativeSample(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -111,11 +111,11 @@ class InformativeSample(IStrategy):
|
||||
# stake/USDT above sma(stake/USDT, 20)
|
||||
(dataframe['close_15m'] > dataframe['sma20_15m'])
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -127,5 +127,5 @@ class InformativeSample(IStrategy):
|
||||
# stake/USDT below sma(stake/USDT, 20)
|
||||
(dataframe['close_15m'] < dataframe['sma20_15m'])
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -69,7 +69,7 @@ class MultiMa(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = []
|
||||
# I used range(self.buy_ma_count.value) instade of self.buy_ma_count.range
|
||||
# Cuz it returns range(7,8) but we need range(8) for all modes hyperopt, backtest and etc
|
||||
@@ -81,10 +81,10 @@ class MultiMa(IStrategy):
|
||||
conditions.append(dataframe[key] < dataframe[past_key])
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[reduce(lambda x, y: x & y, conditions), "buy"] = 1
|
||||
dataframe.loc[reduce(lambda x, y: x & y, conditions), "enter_long"] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = []
|
||||
|
||||
for ma_count in range(self.sell_ma_count.value):
|
||||
@@ -94,5 +94,5 @@ class MultiMa(IStrategy):
|
||||
conditions.append(dataframe[key] > dataframe[past_key])
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[reduce(lambda x, y: x | y, conditions), "sell"] = 1
|
||||
dataframe.loc[reduce(lambda x, y: x | y, conditions), "exit_long"] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -45,14 +45,14 @@ class Strategy001(IStrategy):
|
||||
process_only_new_candles = False
|
||||
|
||||
# Experimental settings (configuration will overide these if set)
|
||||
use_sell_signal = True
|
||||
sell_profit_only = True
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = True
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
# Optional order type mapping
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class Strategy001(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -101,11 +101,11 @@ class Strategy001(IStrategy):
|
||||
(dataframe['ha_close'] > dataframe['ema20']) &
|
||||
(dataframe['ha_open'] < dataframe['ha_close']) # green bar
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -117,5 +117,5 @@ class Strategy001(IStrategy):
|
||||
(dataframe['ha_close'] < dataframe['ema20']) &
|
||||
(dataframe['ha_open'] > dataframe['ha_close']) # red bar
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
+14
-13
@@ -9,15 +9,16 @@ from pandas import DataFrame
|
||||
import talib.abstract as ta
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
class Strategy001_custom_sell(IStrategy):
|
||||
|
||||
class Strategy001_custom_exit(IStrategy):
|
||||
|
||||
"""
|
||||
Strategy 001_custom_sell
|
||||
Strategy 001_custom_exit
|
||||
author@: Gerald Lonlas, froggleston
|
||||
github@: https://github.com/freqtrade/freqtrade-strategies
|
||||
|
||||
How to use it?
|
||||
> python3 ./freqtrade/main.py -s Strategy001_custom_sell
|
||||
> python3 ./freqtrade/main.py -s Strategy001_custom_exit
|
||||
"""
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
@@ -45,14 +46,14 @@ class Strategy001_custom_sell(IStrategy):
|
||||
process_only_new_candles = False
|
||||
|
||||
# Experimental settings (configuration will overide these if set)
|
||||
use_sell_signal = True
|
||||
sell_profit_only = True
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = True
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
# Optional order type mapping
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
@@ -91,7 +92,7 @@ class Strategy001_custom_sell(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -103,11 +104,11 @@ class Strategy001_custom_sell(IStrategy):
|
||||
(dataframe['ha_close'] > dataframe['ema20']) &
|
||||
(dataframe['ha_open'] < dataframe['ha_close']) # green bar
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -119,10 +120,10 @@ class Strategy001_custom_sell(IStrategy):
|
||||
(dataframe['ha_close'] < dataframe['ema20']) &
|
||||
(dataframe['ha_open'] > dataframe['ha_close']) # red bar
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def custom_sell(self, pair: str, trade: 'Trade', current_time: 'datetime', current_rate: float, current_profit: float, **kwargs):
|
||||
def custom_exit(self, pair: str, trade: 'Trade', current_time: 'datetime', current_rate: float, current_profit: float, **kwargs):
|
||||
"""
|
||||
Sell only when matching some criteria other than those used to generate the sell signal
|
||||
:return: str sell_reason, if any, otherwise None
|
||||
@@ -46,14 +46,14 @@ class Strategy002(IStrategy):
|
||||
process_only_new_candles = False
|
||||
|
||||
# Experimental settings (configuration will overide these if set)
|
||||
use_sell_signal = True
|
||||
sell_profit_only = True
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = True
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
# Optional order type mapping
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class Strategy002(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -116,11 +116,11 @@ class Strategy002(IStrategy):
|
||||
(dataframe['bb_lowerband'] > dataframe['close']) &
|
||||
(dataframe['CDLHAMMER'] == 100)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -131,5 +131,5 @@ class Strategy002(IStrategy):
|
||||
(dataframe['sar'] > dataframe['close']) &
|
||||
(dataframe['fisher_rsi'] > 0.3)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -46,14 +46,14 @@ class Strategy003(IStrategy):
|
||||
process_only_new_candles = False
|
||||
|
||||
# Experimental settings (configuration will overide these if set)
|
||||
use_sell_signal = True
|
||||
sell_profit_only = True
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = True
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
# Optional order type mapping
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class Strategy003(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -133,11 +133,11 @@ class Strategy003(IStrategy):
|
||||
(dataframe['fastd'] > dataframe['fastk']) &
|
||||
(dataframe['fastd'] > 0)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -148,5 +148,5 @@ class Strategy003(IStrategy):
|
||||
(dataframe['sar'] > dataframe['close']) &
|
||||
(dataframe['fisher_rsi'] > 0.3)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -45,14 +45,14 @@ class Strategy004(IStrategy):
|
||||
process_only_new_candles = False
|
||||
|
||||
# Experimental settings (configuration will overide these if set)
|
||||
use_sell_signal = True
|
||||
sell_profit_only = True
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = True
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
# Optional order type mapping
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
@@ -107,7 +107,7 @@ class Strategy004(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -133,11 +133,11 @@ class Strategy004(IStrategy):
|
||||
(dataframe['mean-volume'] > 0.75) &
|
||||
(dataframe['close'] > 0.00000100)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -150,5 +150,5 @@ class Strategy004(IStrategy):
|
||||
(dataframe['fastk-previous'] < dataframe['fastd-previous']) &
|
||||
(dataframe['close'] > dataframe['ema5'])
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -48,14 +48,14 @@ class Strategy005(IStrategy):
|
||||
process_only_new_candles = False
|
||||
|
||||
# Experimental settings (configuration will overide these if set)
|
||||
use_sell_signal = True
|
||||
sell_profit_only = True
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = True
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
# Optional order type mapping
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class Strategy005(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -159,11 +159,11 @@ class Strategy005(IStrategy):
|
||||
(dataframe['fastd'] > self.buy_fastd.value) &
|
||||
(dataframe['fisher_rsi_norma'] < self.buy_fishRsiNorma.value)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -180,6 +180,6 @@ class Strategy005(IStrategy):
|
||||
conditions.append(dataframe['fisher_rsi'] > self.sell_fishRsiNorma.value)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[reduce(lambda x, y: x & y, conditions), 'sell'] = 1
|
||||
dataframe.loc[reduce(lambda x, y: x & y, conditions), 'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -6,7 +6,7 @@ Supertrend strategy:
|
||||
* Author: @juankysoriano (Juan Carlos Soriano)
|
||||
* github: https://github.com/juankysoriano/
|
||||
|
||||
*** NOTE: This Supertrend strategy is just one of many possible strategies using `Supertrend` as indicator. It should on any case used at your own risk.
|
||||
*** NOTE: This Supertrend strategy is just one of many possible strategies using `Supertrend` as indicator. It should on any case used at your own risk.
|
||||
It comes with at least a couple of caveats:
|
||||
1. The implementation for the `supertrend` indicator is based on the following discussion: https://github.com/freqtrade/freqtrade-strategies/issues/30 . Concretelly https://github.com/freqtrade/freqtrade-strategies/issues/30#issuecomment-853042401
|
||||
2. The implementation for `supertrend` on this strategy is not validated; meaning this that is not proven to match the results by the paper where it was originally introduced or any other trusted academic resources
|
||||
@@ -22,7 +22,7 @@ import numpy as np
|
||||
class Supertrend(IStrategy):
|
||||
# Buy params, Sell params, ROI, Stoploss and Trailing Stop are values generated by 'freqtrade hyperopt --strategy Supertrend --hyperopt-loss ShortTradeDurHyperOptLoss --timerange=20210101- --timeframe=1h --spaces all'
|
||||
# It's encourage you find the values that better suites your needs and risk management strategies
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
"buy_m1": 4,
|
||||
@@ -105,7 +105,7 @@ class Supertrend(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe[f'supertrend_1_buy_{self.buy_m1.value}_{self.buy_p1.value}'] == 'up') &
|
||||
@@ -113,11 +113,11 @@ class Supertrend(IStrategy):
|
||||
(dataframe[f'supertrend_3_buy_{self.buy_m3.value}_{self.buy_p3.value}'] == 'up') & # The three indicators are 'up' for the current candle
|
||||
(dataframe['volume'] > 0) # There is at least some trading volume
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe[f'supertrend_1_sell_{self.sell_m1.value}_{self.sell_p1.value}'] == 'down') &
|
||||
@@ -125,7 +125,7 @@ class Supertrend(IStrategy):
|
||||
(dataframe[f'supertrend_3_sell_{self.sell_m3.value}_{self.sell_p3.value}'] == 'down') & # The three indicators are 'down' for the current candle
|
||||
(dataframe['volume'] > 0) # There is at least some trading volume
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
|
||||
@@ -87,24 +87,24 @@ class SwingHighToSky(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe[f'cci-{self.buy_cciTime.value}'] < self.buy_cci.value) &
|
||||
(dataframe[f'rsi-{self.buy_rsiTime.value}'] < self.buy_rsi.value)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe[f'cci-sell-{self.sell_cciTime.value}'] > self.sell_cci.value) &
|
||||
(dataframe[f'rsi-sell-{self.sell_rsiTime.value}'] > self.sell_rsi.value)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -43,7 +43,7 @@ class ADXMomentum(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['adx'] > 25) &
|
||||
@@ -52,10 +52,10 @@ class ADXMomentum(IStrategy):
|
||||
(dataframe['plus_di'] > dataframe['minus_di'])
|
||||
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['adx'] > 25) &
|
||||
@@ -64,5 +64,5 @@ class ADXMomentum(IStrategy):
|
||||
(dataframe['plus_di'] < dataframe['minus_di'])
|
||||
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -56,7 +56,7 @@ class ASDTSRockwellTrading(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -67,11 +67,11 @@ class ASDTSRockwellTrading(IStrategy):
|
||||
(dataframe['macd'] > 0) &
|
||||
(dataframe['macd'] > dataframe['macdsignal'])
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -81,5 +81,5 @@ class ASDTSRockwellTrading(IStrategy):
|
||||
(
|
||||
(dataframe['macd'] < dataframe['macdsignal'])
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -39,22 +39,22 @@ class AdxSmas(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['adx'] > 25) &
|
||||
(qtpylib.crossed_above(dataframe['short'], dataframe['long']))
|
||||
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['adx'] < 25) &
|
||||
(qtpylib.crossed_above(dataframe['long'], dataframe['short']))
|
||||
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -42,7 +42,7 @@ class AverageStrategy(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -56,11 +56,11 @@ class AverageStrategy(IStrategy):
|
||||
) &
|
||||
(dataframe['volume'] > 0)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -74,5 +74,5 @@ class AverageStrategy(IStrategy):
|
||||
) &
|
||||
(dataframe['volume'] > 0)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -43,7 +43,7 @@ class AwesomeMacd(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['macd'] > 0) &
|
||||
@@ -51,10 +51,10 @@ class AwesomeMacd(IStrategy):
|
||||
(dataframe['ao'].shift() < 0)
|
||||
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['macd'] < 0) &
|
||||
@@ -62,5 +62,5 @@ class AwesomeMacd(IStrategy):
|
||||
(dataframe['ao'].shift() > 0)
|
||||
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -43,21 +43,21 @@ class BbandRsi(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['rsi'] < 30) &
|
||||
(dataframe['close'] < dataframe['bb_lowerband'])
|
||||
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['rsi'] > 70)
|
||||
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -54,7 +54,8 @@ class BinHV27(IStrategy):
|
||||
dataframe['delta'] = dataframe['fastsma'] - dataframe['fastsma'].shift()
|
||||
dataframe['slowingdown'] = dataframe['delta'].lt(dataframe['delta'].shift())
|
||||
return dataframe
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
dataframe['slowsma'].gt(0) &
|
||||
dataframe['close'].lt(dataframe['highsma']) &
|
||||
@@ -89,9 +90,10 @@ class BinHV27(IStrategy):
|
||||
dataframe['emarsi'].le(25)
|
||||
)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(
|
||||
@@ -131,5 +133,5 @@ class BinHV27(IStrategy):
|
||||
dataframe['slowsma'].gt(0)
|
||||
)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -50,7 +50,7 @@ class BinHV45(IStrategy):
|
||||
dataframe['tail'] = (dataframe['close'] - dataframe['low']).abs()
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
dataframe['lower'].shift().gt(0) &
|
||||
@@ -60,12 +60,12 @@ class BinHV45(IStrategy):
|
||||
dataframe['close'].lt(dataframe['lower'].shift()) &
|
||||
dataframe['close'].le(dataframe['close'].shift())
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
no sell signal
|
||||
"""
|
||||
dataframe.loc[:, 'sell'] = 0
|
||||
dataframe.loc[:, 'exit_long'] = 0
|
||||
return dataframe
|
||||
|
||||
@@ -41,7 +41,7 @@ class CCIStrategy(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -59,11 +59,11 @@ class CCIStrategy(IStrategy):
|
||||
& (dataframe['resample_long'] < dataframe['close'])
|
||||
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -78,7 +78,7 @@ class CCIStrategy(IStrategy):
|
||||
& (dataframe['resample_medium'] < dataframe['resample_short'])
|
||||
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def chaikin_mf(self, df, periods=20):
|
||||
|
||||
@@ -23,8 +23,8 @@ class CMCWinner(IStrategy):
|
||||
|
||||
You must keep:
|
||||
- the lib in the section "Do not remove these libs"
|
||||
- the prototype for the methods: minimal_roi, stoploss, populate_indicators, populate_buy_trend,
|
||||
populate_sell_trend, hyperopt_space, buy_strategy_generator
|
||||
- the prototype for the methods: minimal_roi, stoploss, populate_indicators, populate_entry_trend,
|
||||
populate_exit_trend, hyperopt_space, buy_strategy_generator
|
||||
"""
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
@@ -63,7 +63,7 @@ class CMCWinner(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -75,11 +75,11 @@ class CMCWinner(IStrategy):
|
||||
(dataframe['mfi'].shift(1) < 20) &
|
||||
(dataframe['cmo'].shift(1) < -50)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -91,5 +91,5 @@ class CMCWinner(IStrategy):
|
||||
(dataframe['mfi'].shift(1) > 80) &
|
||||
(dataframe['cmo'].shift(1) > 50)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -53,7 +53,7 @@ class ClucMay72018(IStrategy):
|
||||
dataframe['ema100'] = ta.EMA(dataframe, timeperiod=50)
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -65,11 +65,11 @@ class ClucMay72018(IStrategy):
|
||||
(dataframe['close'] < 0.985 * dataframe['bb_lowerband']) &
|
||||
(dataframe['volume'] < (dataframe['volume'].rolling(window=30).mean().shift(1) * 20))
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -79,5 +79,5 @@ class ClucMay72018(IStrategy):
|
||||
(
|
||||
(dataframe['close'] > dataframe['bb_middleband'])
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -13,7 +13,7 @@ class CofiBitStrategy(IStrategy):
|
||||
"""
|
||||
taken from slack by user CofiBit
|
||||
"""
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
"buy_fastx": 25,
|
||||
@@ -56,7 +56,7 @@ class CofiBitStrategy(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -70,11 +70,11 @@ class CofiBitStrategy(IStrategy):
|
||||
(dataframe['fastd'] < self.buy_fastx.value) &
|
||||
(dataframe['adx'] > self.buy_adx.value)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -88,6 +88,6 @@ class CofiBitStrategy(IStrategy):
|
||||
(qtpylib.crossed_above(dataframe['fastk'], self.sell_fastx.value)) |
|
||||
(qtpylib.crossed_above(dataframe['fastd'], self.sell_fastx.value))
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -26,9 +26,9 @@ class CombinedBinHAndCluc(IStrategy):
|
||||
stoploss = -0.05
|
||||
timeframe = '5m'
|
||||
|
||||
use_sell_signal = True
|
||||
sell_profit_only = True
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = True
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# strategy BinHV45
|
||||
@@ -46,7 +46,7 @@ class CombinedBinHAndCluc(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
( # strategy BinHV45
|
||||
dataframe['lower'].shift().gt(0) &
|
||||
@@ -61,15 +61,15 @@ class CombinedBinHAndCluc(IStrategy):
|
||||
(dataframe['close'] < 0.985 * dataframe['bb_lowerband']) &
|
||||
(dataframe['volume'] < (dataframe['volume_mean_slow'].shift(1) * 20))
|
||||
),
|
||||
'buy'
|
||||
'enter_long'
|
||||
] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
"""
|
||||
dataframe.loc[
|
||||
(dataframe['close'] > dataframe['bb_middleband']),
|
||||
'sell'
|
||||
'exit_long'
|
||||
] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -29,16 +29,16 @@ class DoesNothingStrategy(IStrategy):
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -59,7 +59,7 @@ class EMASkipPump(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
dataframe.loc[
|
||||
(dataframe['volume'] < (dataframe['volume'].rolling(window=30).mean().shift(1) * 20)) &
|
||||
@@ -67,19 +67,19 @@ class EMASkipPump(IStrategy):
|
||||
(dataframe['close'] < dataframe['ema_{}'.format(self.EMA_MEDIUM_TERM)]) &
|
||||
(dataframe['close'] == dataframe['min']) &
|
||||
(dataframe['close'] <= dataframe['bb_lowerband']),
|
||||
'buy'
|
||||
'enter_long'
|
||||
] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
dataframe.loc[
|
||||
(dataframe['close'] > dataframe['ema_{}'.format(self.EMA_SHORT_TERM)]) &
|
||||
(dataframe['close'] > dataframe['ema_{}'.format(self.EMA_MEDIUM_TERM)]) &
|
||||
(dataframe['close'] >= dataframe['max']) &
|
||||
(dataframe['close'] >= dataframe['bb_upperband']),
|
||||
'sell'
|
||||
'exit_long'
|
||||
] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -31,19 +31,19 @@ class Freqtrade_backtest_validation_freqtrade1(IStrategy):
|
||||
dataframe['slowMA'] = ta.SMA(dataframe, timeperiod=28)
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['fastMA'] > dataframe['slowMA'])
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['fastMA'] < dataframe['slowMA'])
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -79,7 +79,7 @@ class Low_BB(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -92,11 +92,11 @@ class Low_BB(IStrategy):
|
||||
|
||||
)
|
||||
,
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -104,5 +104,5 @@ class Low_BB(IStrategy):
|
||||
"""
|
||||
dataframe.loc[
|
||||
(),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -70,7 +70,7 @@ class MACDStrategy(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -82,11 +82,11 @@ class MACDStrategy(IStrategy):
|
||||
(dataframe['cci'] <= self.buy_cci.value) &
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -98,6 +98,6 @@ class MACDStrategy(IStrategy):
|
||||
(dataframe['cci'] >= self.sell_cci.value) &
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -46,7 +46,7 @@ class MACDStrategy_crossed(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -57,11 +57,11 @@ class MACDStrategy_crossed(IStrategy):
|
||||
qtpylib.crossed_above(dataframe['macd'], dataframe['macdsignal']) &
|
||||
(dataframe['cci'] <= -50.0)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -72,6 +72,6 @@ class MACDStrategy_crossed(IStrategy):
|
||||
qtpylib.crossed_below(dataframe['macd'], dataframe['macdsignal']) &
|
||||
(dataframe['cci'] >= 100.0)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -50,21 +50,21 @@ class MultiRSI(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
# must be bearish
|
||||
(dataframe['sma5'] >= dataframe['sma200']) &
|
||||
(dataframe['rsi'] < (dataframe['resample_{}_rsi'.format(self.get_ticker_indicator() * 8)] - 20))
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['rsi'] > dataframe['resample_{}_rsi'.format(self.get_ticker_indicator()*2)]) &
|
||||
(dataframe['rsi'] > dataframe['resample_{}_rsi'.format(self.get_ticker_indicator()*8)])
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -54,7 +54,7 @@ class Quickie(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['adx'] > 30) &
|
||||
@@ -63,15 +63,15 @@ class Quickie(IStrategy):
|
||||
(dataframe['sma_200'] > dataframe['close'])
|
||||
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['adx'] > 70) &
|
||||
(dataframe['tema'] > dataframe['bb_middleband']) &
|
||||
(dataframe['tema'] < dataframe['tema'].shift(1))
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -43,9 +43,9 @@ class ReinforcedAverageStrategy(IStrategy):
|
||||
process_only_new_candles = False
|
||||
|
||||
# Experimental settings (configuration will overide these if set)
|
||||
use_sell_signal = True
|
||||
sell_profit_only = False
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = False
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
@@ -64,7 +64,7 @@ class ReinforcedAverageStrategy(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -77,11 +77,11 @@ class ReinforcedAverageStrategy(IStrategy):
|
||||
(dataframe['close'] > dataframe[f'resample_{self.resample_interval}_sma']) &
|
||||
(dataframe['volume'] > 0)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -92,5 +92,5 @@ class ReinforcedAverageStrategy(IStrategy):
|
||||
qtpylib.crossed_above(dataframe['maMedium'], dataframe['maShort']) &
|
||||
(dataframe['volume'] > 0)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -93,7 +93,7 @@ class ReinforcedQuickie(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -134,11 +134,11 @@ class ReinforcedQuickie(IStrategy):
|
||||
)
|
||||
)
|
||||
,
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
@@ -167,7 +167,7 @@ class ReinforcedQuickie(IStrategy):
|
||||
(dataframe['rsi'] > 70)
|
||||
)
|
||||
,
|
||||
'sell'
|
||||
'exit_long'
|
||||
] = 1
|
||||
return dataframe
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class ReinforcedSmoothScalp(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
conditions = []
|
||||
if self.buy_mfi_enabled.value:
|
||||
@@ -104,11 +104,11 @@ class ReinforcedSmoothScalp(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
conditions = []
|
||||
|
||||
@@ -132,6 +132,6 @@ class ReinforcedSmoothScalp(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -47,7 +47,7 @@ class Scalp(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['open'] < dataframe['ema_low']) &
|
||||
@@ -58,10 +58,10 @@ class Scalp(IStrategy):
|
||||
(qtpylib.crossed_above(dataframe['fastk'], dataframe['fastd']))
|
||||
)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['open'] >= dataframe['ema_high'])
|
||||
@@ -70,5 +70,5 @@ class Scalp(IStrategy):
|
||||
(qtpylib.crossed_above(dataframe['fastk'], 70)) |
|
||||
(qtpylib.crossed_above(dataframe['fastd'], 70))
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -52,7 +52,7 @@ class Simple(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(
|
||||
@@ -62,14 +62,14 @@ class Simple(IStrategy):
|
||||
& (dataframe['rsi'] > 70) # optional filter, need to investigate
|
||||
)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# different strategy used for sell points, due to be able to duplicate it to 100%
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['rsi'] > 80)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -101,7 +101,7 @@ class SmoothOperator(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
|
||||
@@ -167,11 +167,11 @@ class SmoothOperator(IStrategy):
|
||||
# ensure we have an overall uptrend
|
||||
(dataframe['close'] > dataframe['close'].shift())
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# different strategy used for sell points, due to be able to duplicate it to 100%
|
||||
dataframe.loc[
|
||||
(
|
||||
@@ -200,7 +200,7 @@ class SmoothOperator(IStrategy):
|
||||
)
|
||||
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class SmoothScalp(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(
|
||||
@@ -78,10 +78,10 @@ class SmoothScalp(IStrategy):
|
||||
)
|
||||
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(
|
||||
@@ -97,5 +97,5 @@ class SmoothScalp(IStrategy):
|
||||
) & (dataframe['cci'] > 150)
|
||||
)
|
||||
,
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -39,14 +39,14 @@ class TDSequentialStrategy(IStrategy):
|
||||
timeframe = '1h'
|
||||
|
||||
# These values can be overridden in the "ask_strategy" section in the config.
|
||||
use_sell_signal = True
|
||||
sell_profit_only = False
|
||||
ignore_roi_if_buy_signal = False
|
||||
use_exit_signal = True
|
||||
exit_profit_only = False
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
# Optional order type mapping
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'limit',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
@@ -56,8 +56,8 @@ class TDSequentialStrategy(IStrategy):
|
||||
|
||||
# Optional time in force for orders
|
||||
order_time_in_force = {
|
||||
'buy': 'gtc',
|
||||
'sell': 'gtc',
|
||||
'entry': 'gtc',
|
||||
'exit': 'gtc',
|
||||
}
|
||||
|
||||
def informative_pairs(self):
|
||||
@@ -123,29 +123,29 @@ class TDSequentialStrategy(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe["buy"] = 0
|
||||
dataframe["enter_long"] = 0
|
||||
dataframe.loc[((dataframe['exceed_low']) &
|
||||
(dataframe['seq_buy'] > 8))
|
||||
, 'buy'] = 1
|
||||
, 'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy columnNA / NaN values
|
||||
"""
|
||||
dataframe["sell"] = 0
|
||||
dataframe["exit_long"] = 0
|
||||
dataframe.loc[((dataframe['exceed_high']) |
|
||||
(dataframe['seq_sell'] > 8))
|
||||
, 'sell'] = 1
|
||||
, 'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -19,7 +19,7 @@ class TechnicalExampleStrategy(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(
|
||||
@@ -27,14 +27,14 @@ class TechnicalExampleStrategy(IStrategy):
|
||||
|
||||
)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# different strategy used for sell points, due to be able to duplicate it to 100%
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['cmf'] > 0)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -21,7 +21,7 @@ class CustomStoplossWithPSAR(IStrategy):
|
||||
you are supposed to take the `custom_stoploss()` and `populate_indicators()`
|
||||
parts and adapt it to your own strategy
|
||||
|
||||
the populate_buy_trend() function is pretty nonsencial
|
||||
the populate_entry_trend() function is pretty nonsencial
|
||||
"""
|
||||
timeframe = '1h'
|
||||
stoploss = -0.2
|
||||
@@ -64,7 +64,7 @@ class CustomStoplossWithPSAR(IStrategy):
|
||||
# dataframe['rsi'] = ta.RSI(dataframe)
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Placeholder Strategy: buys when SAR is smaller then candle before
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
@@ -75,11 +75,11 @@ class CustomStoplossWithPSAR(IStrategy):
|
||||
(
|
||||
(dataframe['sar'] < dataframe['sar'].shift())
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Placeholder Strategy: does nothing
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
@@ -87,5 +87,5 @@ class CustomStoplossWithPSAR(IStrategy):
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
# Deactivated sell signal to allow the strategy to work correctly
|
||||
dataframe.loc[:, 'sell'] = 0
|
||||
dataframe.loc[:, 'exit_long'] = 0
|
||||
return dataframe
|
||||
|
||||
@@ -96,7 +96,7 @@ class FixedRiskRewardLoss(IStrategy):
|
||||
# dataframe['rsi'] = ta.RSI(dataframe)
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Placeholder Strategy: buys when SAR is smaller then candle before
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
@@ -104,10 +104,10 @@ class FixedRiskRewardLoss(IStrategy):
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
# Allways buys
|
||||
dataframe.loc[:, 'buy'] = 1
|
||||
dataframe.loc[:, 'enter_long'] = 1
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Placeholder Strategy: does nothing
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
@@ -116,5 +116,5 @@ class FixedRiskRewardLoss(IStrategy):
|
||||
"""
|
||||
|
||||
# Never sells
|
||||
dataframe.loc[:, 'sell'] = 0
|
||||
dataframe.loc[:, 'exit_long'] = 0
|
||||
return dataframe
|
||||
|
||||
@@ -44,27 +44,27 @@ class hlhb(IStrategy):
|
||||
process_only_new_candles = True
|
||||
|
||||
# These values can be overridden in the "ask_strategy" section in the config.
|
||||
use_sell_signal = True
|
||||
sell_profit_only = False
|
||||
ignore_roi_if_buy_signal = True
|
||||
use_exit_signal = True
|
||||
exit_profit_only = False
|
||||
ignore_roi_if_entry_signal = True
|
||||
|
||||
# Number of candles the strategy requires before producing valid signals
|
||||
startup_candle_count: int = 30
|
||||
|
||||
# Optional order type mapping.
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'entry': 'limit',
|
||||
'exit': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
|
||||
# Optional order time in force.
|
||||
order_time_in_force = {
|
||||
'buy': 'gtc',
|
||||
'sell': 'gtc'
|
||||
'entry': 'gtc',
|
||||
'exit': 'gtc'
|
||||
}
|
||||
|
||||
|
||||
plot_config = {
|
||||
# Main plot indicators (Moving averages, ...)
|
||||
'main_plot': {
|
||||
@@ -81,7 +81,7 @@ class hlhb(IStrategy):
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def informative_pairs(self):
|
||||
return []
|
||||
|
||||
@@ -103,7 +103,7 @@ class hlhb(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(dataframe['rsi'], 50)) &
|
||||
@@ -111,11 +111,11 @@ class hlhb(IStrategy):
|
||||
(dataframe['adx'] > 25) &
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_below(dataframe['rsi'], 50)) &
|
||||
@@ -123,6 +123,6 @@ class hlhb(IStrategy):
|
||||
(dataframe['adx'] > 25) &
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
|
||||
|
||||
@@ -582,7 +582,7 @@ class DevilStra(IStrategy):
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
pairs = self.dp.current_whitelist()
|
||||
pairs_len = len(pairs)
|
||||
@@ -646,13 +646,13 @@ class DevilStra(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy']=1
|
||||
'enter_long']=1
|
||||
|
||||
# print(len(dataframe.keys()))
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
pairs = self.dp.current_whitelist()
|
||||
pairs_len = len(pairs)
|
||||
@@ -716,5 +716,5 @@ class DevilStra(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell']=1
|
||||
'exit_long']=1
|
||||
return dataframe
|
||||
|
||||
@@ -539,7 +539,7 @@ class GodStraNew(IStrategy):
|
||||
'''
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
conditions = list()
|
||||
|
||||
@@ -587,13 +587,13 @@ class GodStraNew(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy']=1
|
||||
'enter_long']=1
|
||||
|
||||
# print(len(dataframe.keys()))
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
conditions = list()
|
||||
# TODO: Its not dry code!
|
||||
@@ -639,5 +639,5 @@ class GodStraNew(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell']=1
|
||||
'exit_long']=1
|
||||
return dataframe
|
||||
|
||||
@@ -103,7 +103,7 @@ class Zeus(IStrategy):
|
||||
dataframe['trend_kst_diff'] = (tkd-tkd.min())/(tkd.max()-tkd.min())
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = []
|
||||
IND = 'trend_ichimoku_base'
|
||||
REAL = self.buy_real.value
|
||||
@@ -120,11 +120,11 @@ class Zeus(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
conditions = []
|
||||
IND = 'trend_kst_diff'
|
||||
REAL = self.sell_real.value
|
||||
@@ -142,6 +142,6 @@ class Zeus(IStrategy):
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -128,7 +128,7 @@ class wtc(IStrategy):
|
||||
dataframe['wt1'], dataframe['wt2'], dataframe['def'], dataframe['slowk'] = 0, 10, 100, 1000
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(dataframe['wt1'], dataframe['wt2']))
|
||||
@@ -138,11 +138,11 @@ class wtc(IStrategy):
|
||||
|
||||
),
|
||||
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# print(dataframe['slowk']/dataframe['wt1'])
|
||||
dataframe.loc[
|
||||
(
|
||||
@@ -152,5 +152,5 @@ class wtc(IStrategy):
|
||||
& (dataframe['def'].between(self.sell_min.value, self.sell_max.value))
|
||||
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
@@ -63,7 +63,7 @@ class mabStra(IStrategy):
|
||||
timeperiod=self.sell_slow_ma_timeframe.value)
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
|
||||
dataframe.loc[
|
||||
(
|
||||
@@ -76,11 +76,11 @@ class mabStra(IStrategy):
|
||||
(dataframe['buy-fastMA'].div(dataframe['buy-slowMA'])
|
||||
< self.buy_div_max.value)
|
||||
),
|
||||
'buy'] = 1
|
||||
'enter_long'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['sell-fastMA'].div(dataframe['sell-mojoMA'])
|
||||
@@ -92,5 +92,5 @@ class mabStra(IStrategy):
|
||||
(dataframe['sell-slowMA'].div(dataframe['sell-fastMA'])
|
||||
< self.sell_div_max.value)
|
||||
),
|
||||
'sell'] = 1
|
||||
'exit_long'] = 1
|
||||
return dataframe
|
||||
|
||||
Reference in New Issue
Block a user