Merge pull request #73 from gcarq/small_tweaks_to_strategy

Small tweaks to strategy
This commit is contained in:
Michael Egger 2017-10-15 18:08:18 +02:00 committed by GitHub
commit eff361a104
4 changed files with 26 additions and 25 deletions

View File

@ -30,11 +30,10 @@ in minutes and the value is the minimum ROI in percent.
See the example below: See the example below:
``` ```
"minimal_roi": { "minimal_roi": {
"2880": 0.005, # Sell after 48 hours if there is at least 0.5% profit "50": 0.0, # Sell after 30 minutes if the profit is not negative
"1440": 0.01, # Sell after 24 hours if there is at least 1% profit "40": 0.01, # Sell after 25 minutes if there is at least 1% profit
"720": 0.02, # Sell after 12 hours if there is at least 2% profit "30": 0.02, # Sell after 15 minutes if there is at least 2% profit
"360": 0.02, # Sell after 6 hours if there is at least 2% profit "0": 0.045 # Sell immediately if there is at least 4.5% profit
"0": 0.025 # Sell immediately if there is at least 2.5% profit
}, },
``` ```

View File

@ -4,10 +4,10 @@
"stake_amount": 0.05, "stake_amount": 0.05,
"dry_run": false, "dry_run": false,
"minimal_roi": { "minimal_roi": {
"60": 0.0, "50": 0.0,
"40": 0.01, "40": 0.01,
"20": 0.02, "30": 0.02,
"0": 0.03 "0": 0.045
}, },
"stoploss": -0.40, "stoploss": -0.40,
"bid_strategy": { "bid_strategy": {

View File

@ -31,15 +31,13 @@ def populate_indicators(dataframe: DataFrame) -> DataFrame:
""" """
Adds several different TA indicators to the given DataFrame Adds several different TA indicators to the given DataFrame
""" """
dataframe['sar'] = ta.SAR(dataframe, 0.02, 0.22)
dataframe['adx'] = ta.ADX(dataframe) dataframe['adx'] = ta.ADX(dataframe)
stoch = ta.STOCHF(dataframe) stoch = ta.STOCHF(dataframe)
dataframe['fastd'] = stoch['fastd'] dataframe['fastd'] = stoch['fastd']
dataframe['fastk'] = stoch['fastk'] dataframe['fastk'] = stoch['fastk']
dataframe['blower'] = ta.BBANDS(dataframe, nbdevup=2, nbdevdn=2)['lowerband'] dataframe['blower'] = ta.BBANDS(dataframe, nbdevup=2, nbdevdn=2)['lowerband']
dataframe['cci'] = ta.CCI(dataframe, timeperiod=5) dataframe['sma'] = ta.SMA(dataframe, timeperiod=30)
dataframe['sma'] = ta.SMA(dataframe, timeperiod=100) dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=4)
dataframe['mfi'] = ta.MFI(dataframe) dataframe['mfi'] = ta.MFI(dataframe)
return dataframe return dataframe
@ -50,14 +48,12 @@ def populate_buy_trend(dataframe: DataFrame) -> DataFrame:
:param dataframe: DataFrame :param dataframe: DataFrame
:return: DataFrame with buy column :return: DataFrame with buy column
""" """
dataframe.loc[ dataframe.loc[
(dataframe['close'] < dataframe['sma']) & (dataframe['close'] < dataframe['sma']) &
(dataframe['cci'] < -100) &
(dataframe['tema'] <= dataframe['blower']) & (dataframe['tema'] <= dataframe['blower']) &
(dataframe['mfi'] < 30) & (dataframe['mfi'] < 25) &
(dataframe['fastd'] < 20) & (dataframe['fastd'] < 25) &
(dataframe['adx'] > 20), (dataframe['adx'] > 30),
'buy'] = 1 'buy'] = 1
dataframe.loc[dataframe['buy'] == 1, 'buy_price'] = dataframe['close'] dataframe.loc[dataframe['buy'] == 1, 'buy_price'] = dataframe['close']
@ -120,20 +116,26 @@ def plot_dataframe(dataframe: DataFrame, pair: str) -> None:
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
# Two subplots sharing x axis # Two subplots sharing x axis
fig, (ax1, ax2) = plt.subplots(2, sharex=True) fig, (ax1, ax2, ax3) = plt.subplots(3, sharex=True)
fig.suptitle(pair, fontsize=14, fontweight='bold') fig.suptitle(pair, fontsize=14, fontweight='bold')
ax1.plot(dataframe.index.values, dataframe['sar'], 'g_', label='pSAR')
ax1.plot(dataframe.index.values, dataframe['close'], label='close') ax1.plot(dataframe.index.values, dataframe['close'], label='close')
# ax1.plot(dataframe.index.values, dataframe['sell'], 'ro', label='sell') # ax1.plot(dataframe.index.values, dataframe['sell'], 'ro', label='sell')
ax1.plot(dataframe.index.values, dataframe['sma'], '--', label='SMA') ax1.plot(dataframe.index.values, dataframe['sma'], '--', label='SMA')
ax1.plot(dataframe.index.values, dataframe['tema'], ':', label='TEMA')
ax1.plot(dataframe.index.values, dataframe['blower'], '-.', label='BB low')
ax1.plot(dataframe.index.values, dataframe['buy_price'], 'bo', label='buy') ax1.plot(dataframe.index.values, dataframe['buy_price'], 'bo', label='buy')
ax1.legend() ax1.legend()
# ax2.plot(dataframe.index.values, dataframe['adx'], label='ADX') ax2.plot(dataframe.index.values, dataframe['adx'], label='ADX')
ax2.plot(dataframe.index.values, dataframe['mfi'], label='MFI') ax2.plot(dataframe.index.values, dataframe['mfi'], label='MFI')
# ax2.plot(dataframe.index.values, [25] * len(dataframe.index.values)) # ax2.plot(dataframe.index.values, [25] * len(dataframe.index.values))
ax2.legend() ax2.legend()
ax3.plot(dataframe.index.values, dataframe['fastk'], label='k')
ax3.plot(dataframe.index.values, dataframe['fastd'], label='d')
ax3.plot(dataframe.index.values, [20] * len(dataframe.index.values))
ax3.legend()
# Fine-tune figure; make subplots close to each other and hide x ticks for # Fine-tune figure; make subplots close to each other and hide x ticks for
# all but bottom plot. # all but bottom plot.
fig.subplots_adjust(hspace=0) fig.subplots_adjust(hspace=0)

View File

@ -30,10 +30,10 @@ def pairs():
def conf(): def conf():
return { return {
"minimal_roi": { "minimal_roi": {
"60": 0.0, "50": 0.0,
"40": 0.01, "40": 0.01,
"20": 0.02, "30": 0.02,
"0": 0.03 "0": 0.045
}, },
"stoploss": -0.40 "stoploss": -0.40
} }