Merge branch 'master' into addMinimalRoi
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# --- Do not remove these libs ---
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
from pandas import DataFrame
|
||||
# --------------------------------
|
||||
|
||||
|
||||
class BreakEven(IStrategy):
|
||||
"""
|
||||
author@: lenik
|
||||
|
||||
Sometimes I want to close the bot ASAP, but not have the positions floating around.
|
||||
|
||||
I can "/stopbuy" and wait for the positions to get closed by the bot rules, which is
|
||||
waiting for some profit, etc -- this usually takes too long...
|
||||
|
||||
What I would prefer is to close everything that is over 0% profit to avoid the losses.
|
||||
|
||||
Here's a simple strategy with empty buy/sell signals and "minimal_roi = { 0 : 0 }" that
|
||||
sells everything already at profit and wait until the positions at loss will come to break
|
||||
even point (or the small profit you provide in ROI table).
|
||||
|
||||
You may restart the bot with the new strategy as a command-line parameter.
|
||||
|
||||
Another way would be to specify the original strategy in the config file, then change to
|
||||
this one and simply "/reload_config" from the Telegram bot.
|
||||
|
||||
"""
|
||||
|
||||
# This attribute will be overridden if the config file contains "minimal_roi"
|
||||
minimal_roi = {
|
||||
"0": 0.01, # at least 1% at first
|
||||
"10": 0 # after 10min, everything goes
|
||||
}
|
||||
|
||||
# This is more radical version that sells everything above the profit level
|
||||
# minimal_roi = {
|
||||
# "0": 0
|
||||
# }
|
||||
|
||||
# And this is basically "/forcesell all", that sells no matter what profit
|
||||
# minimal_roi = {
|
||||
# "0": -1
|
||||
# }
|
||||
|
||||
# Optimal stoploss designed for the strategy
|
||||
stoploss = -0.05
|
||||
|
||||
# Optimal timeframe for the strategy
|
||||
timeframe = '5m'
|
||||
|
||||
# don't generate any buy or sell signals, everything is handled by ROI and stop_loss
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
),
|
||||
'buy'] = 0
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe.loc[
|
||||
(
|
||||
),
|
||||
'sell'] = 0
|
||||
return dataframe
|
||||
@@ -2,6 +2,7 @@
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
import talib.abstract as ta
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
from freqtrade.strategy import IntParameter
|
||||
from pandas import DataFrame
|
||||
|
||||
|
||||
@@ -12,6 +13,17 @@ class CofiBitStrategy(IStrategy):
|
||||
"""
|
||||
taken from slack by user CofiBit
|
||||
"""
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
"buy_fastx": 25,
|
||||
"buy_adx": 25,
|
||||
}
|
||||
|
||||
# Sell hyperspace params:
|
||||
sell_params = {
|
||||
"sell_fastx": 75,
|
||||
}
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "minimal_roi"
|
||||
@@ -29,6 +41,10 @@ class CofiBitStrategy(IStrategy):
|
||||
# Optimal timeframe for the strategy
|
||||
timeframe = '5m'
|
||||
|
||||
buy_fastx = IntParameter(20, 30, default=25)
|
||||
buy_adx = IntParameter(20, 30, default=25)
|
||||
sell_fastx = IntParameter(70, 80, default=75)
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
stoch_fast = ta.STOCHF(dataframe, 5, 3, 0, 3, 0)
|
||||
dataframe['fastd'] = stoch_fast['fastd']
|
||||
@@ -50,10 +66,9 @@ class CofiBitStrategy(IStrategy):
|
||||
(
|
||||
(dataframe['open'] < dataframe['ema_low']) &
|
||||
(qtpylib.crossed_above(dataframe['fastk'], dataframe['fastd'])) &
|
||||
# (dataframe['fastk'] > dataframe['fastd']) &
|
||||
(dataframe['fastk'] < 30) &
|
||||
(dataframe['fastd'] < 30) &
|
||||
(dataframe['adx'] > 30)
|
||||
(dataframe['fastk'] < self.buy_fastx.value) &
|
||||
(dataframe['fastd'] < self.buy_fastx.value) &
|
||||
(dataframe['adx'] > self.buy_adx.value)
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
@@ -70,10 +85,8 @@ class CofiBitStrategy(IStrategy):
|
||||
(dataframe['open'] >= dataframe['ema_high'])
|
||||
) |
|
||||
(
|
||||
# (dataframe['fastk'] > 70) &
|
||||
# (dataframe['fastd'] > 70)
|
||||
(qtpylib.crossed_above(dataframe['fastk'], 70)) |
|
||||
(qtpylib.crossed_above(dataframe['fastd'], 70))
|
||||
(qtpylib.crossed_above(dataframe['fastk'], self.sell_fastx.value)) |
|
||||
(qtpylib.crossed_above(dataframe['fastd'], self.sell_fastx.value))
|
||||
),
|
||||
'sell'] = 1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Author: @Mablue (Masoud Azizi)
|
||||
# github: https://github.com/mablue/
|
||||
# IMPORTANT: DO NOT USE IT WITHOUT HYPEROPT:
|
||||
# freqtrade hyperopt --hyperopt mabStraHo --hyperopt-loss SharpeHyperOptLoss --spaces all --strategy mabStra --config config.json -e 100
|
||||
# freqtrade hyperopt --hyperopt-loss SharpeHyperOptLoss --spaces all --strategy mabStra --config config.json -e 100
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from freqtrade.strategy.hyper import IntParameter, DecimalParameter
|
||||
@@ -11,10 +11,10 @@ from pandas import DataFrame
|
||||
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class mabStra(IStrategy):
|
||||
|
||||
# #################### RESULTS PASTE PLACE ####################
|
||||
# ROI table:
|
||||
minimal_roi = {
|
||||
|
||||
Reference in New Issue
Block a user