Closed tarantula3535 closed 3 years ago
here is the code..i hope this is not wrong..
def TKEi(dataframe, length=14, emaperiod=5):
"""
The calculation is simple:
TKE=(RSI+STOCHASTIC+ULTIMATE OSCILLATOR+MFI+WIILIAMS %R+MOMENTUM+CCI)/7
Buy signal: when TKE crosses above 20 value
Oversold region: under 20 value
Overbought region: over 80 value
Another usage of TKE is with its EMA ,
the default value is defined as 5 bars of EMA of the TKE line,
Go long: when TKE crosses above EMALine
Go short: when TKE crosses below EMALine
"""
import talib.abstract as ta
df = dataframe.copy()
# TKE=(RSI+STOCHASTIC+ULTIMATE OSCILLATOR+MFI+WIILIAMS %R+MOMENTUM+CCI)/7
df["rsi"] = ta.RSI(df, timeperiod=length)
df['stoch'] = 100*(df['close']-df['low'].rolling(window=length).min())/(df['high'].rolling(window=length).max()-df['low'].rolling(window=length).min())
df["ultosc"] = ta.ULTOSC(df,timeperiod1=7, timeperiod2=14, timeperiod3=28)
df["mfi"] = ta.MFI(df, timeperiod=length)
df["willr"] = ta.WILLR(df, timeperiod=length)
df["mom"] = ta.MOM(df, timeperiod=length)
df["cci"] = ta.CCI(df, timeperiod=length)
df["TKE"] = (df["rsi"]+df["stoch"]+df["ultosc"]+df["mfi"]+df["willr"]+df["mom"]+df["cci"]) / 7
df["TKEema"] = ta.EMA(df["TKE"],timeperiod=emaperiod)
return df["TKE"],df["TKEema"]
The code itself seems solid.
But this doesn't seem to be a very well known indicator ... the only references i found is the link you posted above - and the twitter-link (which is in the link above).
hi guys in the explaniton MOM indicator is misundurstanding.. for this reason wron datas return.. can we change df["mom"] = ta.MOM(df, timeperiod=length) this line with this df["mom"] = ta.ROCR100(df, timeperiod=length)
feel free to do a PR ;)
you're right, using MOM does not correspond do the pinescript code in the link...
hi i want to write this indicator here is the link https://tr.tradingview.com/v/Pcbvo0zG/ good entry points give it.. when crossabove 0 or 20 is it buy signal ..