Merge pull request #7 from vertti/parabolic-sar
Use Parabolic SAR indicator to only buy when bullish trend
This commit is contained in:
commit
1dc1018356
@ -1,5 +1,14 @@
|
|||||||
FROM python:3.6.2
|
FROM python:3.6.2
|
||||||
|
|
||||||
|
RUN pip install numpy
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get -y install build-essential
|
||||||
|
RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
|
||||||
|
RUN tar zxvf ta-lib-0.4.0-src.tar.gz
|
||||||
|
RUN cd ta-lib && ./configure && make && make install
|
||||||
|
RUN pip install TA-Lib
|
||||||
|
ENV LD_LIBRARY_PATH /usr/local/lib
|
||||||
|
|
||||||
RUN mkdir -p /freqtrade
|
RUN mkdir -p /freqtrade
|
||||||
WORKDIR /freqtrade
|
WORKDIR /freqtrade
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ import arrow
|
|||||||
import requests
|
import requests
|
||||||
from pandas.io.json import json_normalize
|
from pandas.io.json import json_normalize
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
# from stockstats import StockDataFrame
|
|
||||||
import talib.abstract as ta
|
import talib.abstract as ta
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG,
|
logging.basicConfig(level=logging.DEBUG,
|
||||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -46,6 +46,8 @@ def get_ticker_dataframe(pair: str) -> DataFrame:
|
|||||||
dataframe['close_30_ema'] = ta.EMA(dataframe, timeperiod=30)
|
dataframe['close_30_ema'] = ta.EMA(dataframe, timeperiod=30)
|
||||||
dataframe['close_90_ema'] = ta.EMA(dataframe, timeperiod=90)
|
dataframe['close_90_ema'] = ta.EMA(dataframe, timeperiod=90)
|
||||||
|
|
||||||
|
dataframe['sar'] = ta.SAR(dataframe, 0.02, 0.2)
|
||||||
|
|
||||||
# calculate StochRSI
|
# calculate StochRSI
|
||||||
stochrsi = ta.STOCHRSI(dataframe)
|
stochrsi = ta.STOCHRSI(dataframe)
|
||||||
dataframe['stochrsi'] = stochrsi['fastd'] # values between 0-100, not 0-1
|
dataframe['stochrsi'] = stochrsi['fastd'] # values between 0-100, not 0-1
|
||||||
@ -73,7 +75,8 @@ def populate_trends(dataframe: DataFrame) -> DataFrame:
|
|||||||
"""
|
"""
|
||||||
dataframe.loc[
|
dataframe.loc[
|
||||||
(dataframe['stochrsi'] < 20)
|
(dataframe['stochrsi'] < 20)
|
||||||
& (dataframe['macd'] > dataframe['macds']),
|
& (dataframe['macd'] > dataframe['macds'])
|
||||||
|
& (dataframe['close'] > dataframe['sar']),
|
||||||
'underpriced'
|
'underpriced'
|
||||||
] = 1
|
] = 1
|
||||||
dataframe.loc[dataframe['underpriced'] == 1, 'buy'] = dataframe['close']
|
dataframe.loc[dataframe['underpriced'] == 1, 'buy'] = dataframe['close']
|
||||||
|
Loading…
Reference in New Issue
Block a user