Long strategy generates about 0.4% a trade, at an average time of 11min and a total returns of 0.01BTC over 20 days. Sell points are not perfect yet. It sell to early most of the time
This commit is contained in:
parent
57e6abc571
commit
df1295c74d
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,7 +6,6 @@ config.json
|
||||
.hyperopt
|
||||
logfile.txt
|
||||
hyperopt_trials.pickle
|
||||
user_data/
|
||||
freqtrade-plot.html
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
|
79
user_data/strategies/Long.py
Normal file
79
user_data/strategies/Long.py
Normal file
@ -0,0 +1,79 @@
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
from typing import Dict, List
|
||||
from hyperopt import hp
|
||||
from functools import reduce
|
||||
from pandas import DataFrame
|
||||
# --------------------------------
|
||||
|
||||
import talib.abstract as ta
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class Long(IStrategy):
|
||||
"""
|
||||
|
||||
author@: Gert Wohlgemuth
|
||||
|
||||
"""
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "minimal_roi"
|
||||
minimal_roi = {
|
||||
"60": 0.05,
|
||||
"30": 0.06,
|
||||
"20": 0.07,
|
||||
"0": 0.08
|
||||
}
|
||||
|
||||
# Optimal stoploss designed for the strategy
|
||||
# This attribute will be overridden if the config file contains "stoploss"
|
||||
stoploss = -0.15
|
||||
|
||||
# Optimal ticker interval for the strategy
|
||||
ticker_interval = 5
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
|
||||
|
||||
macd = ta.MACD(dataframe)
|
||||
dataframe['macd'] = macd['macd']
|
||||
dataframe['macdsignal'] = macd['macdsignal']
|
||||
dataframe['macdhist'] = macd['macdhist']
|
||||
dataframe['cci'] = ta.CCI(dataframe)
|
||||
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=50)
|
||||
|
||||
bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2)
|
||||
dataframe['bb_lowerband'] = bollinger['lower']
|
||||
dataframe['bb_middleband'] = bollinger['mid']
|
||||
dataframe['bb_upperband'] = bollinger['upper']
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['macd'] > dataframe['macdsignal']) &
|
||||
(dataframe['macd'] > 0) &
|
||||
(dataframe['cci'] <= 0.0)
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['tema'] < dataframe['close'])
|
||||
),
|
||||
'sell'] = 1
|
||||
return dataframe
|
99
user_data/strategies/Quickie.py
Normal file
99
user_data/strategies/Quickie.py
Normal file
@ -0,0 +1,99 @@
|
||||
# --- Do not remove these libs ---
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
from typing import Dict, List
|
||||
from hyperopt import hp
|
||||
from functools import reduce
|
||||
from pandas import DataFrame
|
||||
# --------------------------------
|
||||
|
||||
import talib.abstract as ta
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class Quickie(IStrategy):
|
||||
"""
|
||||
|
||||
author@: Gert Wohlgemuth
|
||||
|
||||
idea:
|
||||
momentum based strategie. The main idea is that it closes trades very quickly, while avoiding excessive losses. Hence a rather moderate stop loss in this case
|
||||
"""
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "minimal_roi"
|
||||
minimal_roi = {
|
||||
"60": 0.01,
|
||||
"30": 0.03,
|
||||
"20": 0.04,
|
||||
"0": 0.05
|
||||
}
|
||||
|
||||
# Optimal stoploss designed for the strategy
|
||||
# This attribute will be overridden if the config file contains "stoploss"
|
||||
stoploss = -0.3
|
||||
|
||||
# Optimal ticker interval for the strategy
|
||||
ticker_interval = 5
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
|
||||
macd = ta.MACD(dataframe)
|
||||
dataframe['macd'] = macd['macd']
|
||||
dataframe['macdsignal'] = macd['macdsignal']
|
||||
dataframe['macdhist'] = macd['macdhist']
|
||||
|
||||
dataframe['cci'] = ta.CCI(dataframe)
|
||||
dataframe['willr'] = ta.WILLR(dataframe)
|
||||
|
||||
dataframe['smaSlow'] = ta.SMA(dataframe, timeperiod=7)
|
||||
dataframe['smaFast'] = ta.SMA(dataframe, timeperiod=13)
|
||||
|
||||
# required for graphing
|
||||
bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2)
|
||||
dataframe['bb_lowerband'] = bollinger['lower']
|
||||
dataframe['bb_middleband'] = bollinger['mid']
|
||||
dataframe['bb_upperband'] = bollinger['upper']
|
||||
|
||||
bollinger2 = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=1.5)
|
||||
dataframe['bb_lowerband_2'] = bollinger['lower']
|
||||
dataframe['bb_middleband_2'] = bollinger['mid']
|
||||
dataframe['bb_upperband_2'] = bollinger['upper']
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
# we want to buy oversold assets
|
||||
(dataframe['cci'] <= -50)
|
||||
|
||||
# some basic trend should have been established
|
||||
& (dataframe['macd'] > dataframe['macdsignal'])
|
||||
|
||||
# which starts inside the band
|
||||
& (dataframe['open'] > dataframe['bb_lowerband'])
|
||||
)
|
||||
,
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(dataframe['close'] >= dataframe['bb_upperband']) |
|
||||
(
|
||||
(dataframe['macd'] < dataframe['macdsignal']) &
|
||||
(dataframe['cci'] >= 100)
|
||||
)
|
||||
,
|
||||
'sell'] = 1
|
||||
return dataframe
|
90
user_data/strategies/ZLC.py
Normal file
90
user_data/strategies/ZLC.py
Normal file
@ -0,0 +1,90 @@
|
||||
# --- Do not remove these libs ---
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
from typing import Dict, List
|
||||
from hyperopt import hp
|
||||
from functools import reduce
|
||||
from pandas import DataFrame
|
||||
# --------------------------------
|
||||
|
||||
import talib.abstract as ta
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class ZLC(IStrategy):
|
||||
"""
|
||||
|
||||
author@: Gert Wohlgemuth
|
||||
"""
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "minimal_roi"
|
||||
minimal_roi = {
|
||||
"60": 0.01,
|
||||
"30": 0.03,
|
||||
"20": 0.04,
|
||||
"0": 0.01
|
||||
}
|
||||
|
||||
# Optimal stoploss designed for the strategy
|
||||
# This attribute will be overridden if the config file contains "stoploss"
|
||||
stoploss = -0.3
|
||||
|
||||
# Optimal ticker interval for the strategy
|
||||
ticker_interval = 5
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
|
||||
dataframe['cci-slow'] = ta.CCI(dataframe, timeperiod=25)
|
||||
dataframe['cci-fast'] = ta.CCI(dataframe, timeperiod=50)
|
||||
dataframe['expo'] = ta.EMA(dataframe, timeperiod=35)
|
||||
|
||||
# required for graphing
|
||||
bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2)
|
||||
dataframe['bb_lowerband'] = bollinger['lower']
|
||||
dataframe['bb_middleband'] = bollinger['mid']
|
||||
dataframe['bb_upperband'] = bollinger['upper']
|
||||
|
||||
macd = ta.MACD(dataframe)
|
||||
dataframe['macd'] = macd['macd']
|
||||
dataframe['macdsignal'] = macd['macdsignal']
|
||||
dataframe['macdhist'] = macd['macdhist']
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
#don't buy on peak tops
|
||||
(dataframe['close'] < dataframe['bb_middleband'])
|
||||
# this is the main concept of evaluating buys
|
||||
& (dataframe['cci-fast'] > 0)
|
||||
& (dataframe['cci-slow'] > 0)
|
||||
& (dataframe['close'] > dataframe['expo'])
|
||||
|
||||
)
|
||||
,
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(dataframe['close'] >= dataframe['bb_upperband']) |
|
||||
(
|
||||
(dataframe['cci-fast'] < 0)
|
||||
& (dataframe['cci-slow'] < 0)
|
||||
& (dataframe['close'] < dataframe['expo'])
|
||||
|
||||
)
|
||||
,
|
||||
'sell'] = 0
|
||||
return dataframe
|
Loading…
Reference in New Issue
Block a user