Zeus_8_3_2_B_4_2 test Paliers
This commit is contained in:
29
Zeus_8_1d.py
29
Zeus_8_1d.py
@@ -29,6 +29,8 @@ from datetime import timezone, timedelta
|
||||
from scipy.signal import savgol_filter
|
||||
from ta.trend import SMAIndicator, EMAIndicator, MACD, ADXIndicator
|
||||
from collections import Counter
|
||||
from scipy.signal import savgol_filter
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -571,12 +573,14 @@ class Zeus_8_1d(IStrategy):
|
||||
dataframe['haclose'] = heikinashi['close']
|
||||
dataframe['hapercent'] = (dataframe['haclose'] - dataframe['haopen']) / dataframe['haclose']
|
||||
dataframe['hapercent3'] = (dataframe['haclose'] - dataframe['haopen'].shift(3)) / dataframe['haclose'].shift(3)
|
||||
dataframe['mid'] = dataframe['haopen'] + (dataframe['haclose'] - dataframe['haopen']) / 2
|
||||
|
||||
dataframe['sma5'] = dataframe["mid"].rolling(window=5).mean() #talib.SMA(informative, timeperiod=5)
|
||||
dataframe['sma5'] = talib.SMA(dataframe, timeperiod=5)
|
||||
self.calculeDerivees(dataframe, 'sma5', horizon=10)
|
||||
dataframe['sma10'] = talib.SMA(dataframe, timeperiod=10)
|
||||
dataframe['sma10'] = dataframe["mid"].rolling(window=10).mean() #dataframe['sma10'] = talib.SMA(dataframe, timeperiod=10)
|
||||
self.calculeDerivees(dataframe, 'sma10', horizon=10)
|
||||
dataframe['sma20'] = talib.SMA(dataframe, timeperiod=20)
|
||||
dataframe['sma20'] = dataframe["mid"].rolling(window=20).mean() #dataframe['sma20'] = talib.SMA(dataframe, timeperiod=20)
|
||||
self.calculeDerivees(dataframe, 'sma20', horizon=20)
|
||||
|
||||
dataframe["percent"] = (dataframe["close"] - dataframe["open"]) / dataframe["open"]
|
||||
@@ -719,8 +723,8 @@ class Zeus_8_1d(IStrategy):
|
||||
informative['haclose'] = heikinashi['close']
|
||||
informative['hapercent'] = (informative['haclose'] - informative['haopen']) / informative['haclose']
|
||||
informative = self.calculateDerivation(informative, window=5, suffixe="_5")
|
||||
informative['sma5'] = talib.SMA(informative, timeperiod=5)
|
||||
informative['sma20'] = talib.SMA(informative, timeperiod=20)
|
||||
informative['sma5'] = informative["mid"].rolling(window=5).mean() #talib.SMA(informative, timeperiod=5)
|
||||
informative['sma20'] = informative["mid"].rolling(window=20).mean() #talib.SMA(informative, timeperiod=20)
|
||||
informative['max60'] = talib.MAX(informative['close'], timeperiod=60)
|
||||
informative['min60'] = talib.MIN(informative['close'], timeperiod=60)
|
||||
|
||||
@@ -731,6 +735,23 @@ class Zeus_8_1d(IStrategy):
|
||||
self.calculateProbabilite2Index(informative, futur_cols, indic_1, indic_2)
|
||||
dataframe = merge_informative_pair(dataframe, informative, self.timeframe, "1d", ffill=True)
|
||||
|
||||
# --- pente brute ---
|
||||
dataframe['slope'] = dataframe['sma20'].diff()
|
||||
|
||||
# --- lissage EMA ---
|
||||
dataframe['slope_smooth'] = dataframe['slope'].ewm(span=10, adjust=False).mean()
|
||||
|
||||
# --- normalisation relative ---
|
||||
dataframe['slope_norm'] = 100 * dataframe['slope_smooth'] / dataframe['close']
|
||||
# df['slope_norm'].fillna(0, inplace=True)
|
||||
dataframe['slope_norm'] = dataframe['slope_norm'].fillna(0)
|
||||
|
||||
# EMA plus réactive (span=5)
|
||||
dataframe["ema5"] = dataframe["mid_smooth_5"].ewm(span=5, adjust=False).mean()
|
||||
|
||||
# EMA plus lissée (span=20)
|
||||
dataframe["ema20"] = dataframe["mid"].ewm(span=20, adjust=False).mean()
|
||||
|
||||
return dataframe
|
||||
|
||||
def calculeDerivees(self, dataframe, indic, factor_1=100, factor_2=10, horizon=5):
|
||||
|
||||
Reference in New Issue
Block a user