-
Notifications
You must be signed in to change notification settings - Fork 76
/
ADX_15M_USDT.py
62 lines (49 loc) · 2.02 KB
/
ADX_15M_USDT.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# --- Do not remove these libs ---
from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
# --------------------------------
class ADX_15M_USDT(IStrategy):
ticker_interval = '15m'
# ROI table:
minimal_roi = {
"0": 0.26552,
"30": 0.10255,
"210": 0.03545,
"540": 0
}
# Stoploss:
stoploss = -0.1255
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['adx'] = ta.ADX(dataframe, timeperiod=14)
dataframe['plus_di'] = ta.PLUS_DI(dataframe, timeperiod=25)
dataframe['minus_di'] = ta.MINUS_DI(dataframe, timeperiod=25)
dataframe['sar'] = ta.SAR(dataframe)
dataframe['mom'] = ta.MOM(dataframe, timeperiod=14)
dataframe['sell-adx'] = ta.ADX(dataframe, timeperiod=14)
dataframe['sell-plus_di'] = ta.PLUS_DI(dataframe, timeperiod=25)
dataframe['sell-minus_di'] = ta.MINUS_DI(dataframe, timeperiod=25)
dataframe['sell-sar'] = ta.SAR(dataframe)
dataframe['sell-mom'] = ta.MOM(dataframe, timeperiod=14)
return dataframe
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['adx'] > 16) &
(dataframe['minus_di'] > 4) &
(dataframe['plus_di'] > 20) &
(qtpylib.crossed_above( dataframe['plus_di'],dataframe['minus_di']))
),
'buy'] = 1
return dataframe
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['adx'] > 43) &
(dataframe['minus_di'] > 22) &
(dataframe['plus_di'] > 20) &
(qtpylib.crossed_above(dataframe['sell-minus_di'], dataframe['sell-plus_di']))
),
'sell'] = 1
return dataframe