Better buy and sell strategy:

Buy if at the low end of normal range and the price is increasing.
Buy into extreme gains regardless of if it's on the low part of the range.
Avoid buying when the price is on a long decrease even if it's low.
Sell anytime the price is above the top end of normal range and the momentum slows.
Sell on an extreme drop.
This commit is contained in:
Michael Smith 2017-11-23 22:33:41 +08:00
parent 21551b3c40
commit 5fce2c5712

View File

@ -61,6 +61,10 @@ def populate_indicators(dataframe: DataFrame) -> DataFrame:
hilbert = ta.HT_SINE(dataframe)
dataframe['htsine'] = hilbert['sine']
dataframe['htleadsine'] = hilbert['leadsine']
dataframe['plus_dm'] = ta.PLUS_DM(dataframe)
dataframe['plus_di'] = ta.PLUS_DI(dataframe)
dataframe['minus_dm'] = ta.MINUS_DM(dataframe)
dataframe['minus_di'] = ta.MINUS_DI(dataframe)
return dataframe
@ -71,10 +75,16 @@ def populate_buy_trend(dataframe: DataFrame) -> DataFrame:
:return: DataFrame with buy column
"""
dataframe.loc[
(dataframe['tema'] <= dataframe['blower']) &
(dataframe['rsi'] < 37) &
(dataframe['fastd'] < 48) &
(dataframe['adx'] > 31),
(
(dataframe['rsi'] < 35) &
(dataframe['fastd'] < 35) &
(dataframe['adx'] > 30) &
(dataframe['plus_di'] > 0.5)
) |
(
(dataframe['adx'] > 65) &
(dataframe['plus_di'] > 0.5)
),
'buy'] = 1
return dataframe
@ -86,9 +96,19 @@ def populate_sell_trend(dataframe: DataFrame) -> DataFrame:
:return: DataFrame with buy column
"""
dataframe.loc[
(crossed_above(dataframe['rsi'], 70)),
(
(
(crossed_above(dataframe['rsi'], 70)) |
(crossed_above(dataframe['fastd'], 70))
) &
(dataframe['adx'] > 10) &
(dataframe['minus_di'] > 0)
) |
(
(dataframe['adx'] > 70) &
(dataframe['minus_di'] > 0.5)
),
'sell'] = 1
return dataframe