indicators.py
import talib
"""
単純移動平均(SMA: Simple Moving Average)
60日単純移動平均
timeperiod=60
"""
def SMA(price):
sma = talib.SMA(price)
return sma
"""加重移動平均(WMA: Weighted Moving Average)"""
def WMA(price):
wma = talib.WMA(price)
return wma
"""指数移動平均(EMA: Exponential Moving Average)"""
def EMA(price):
ema = talib.EMA(price)
return ema
"""2重指数移動平均(DEMA: Double Exponential Moving Average)"""
def DEMA(price):
dema = talib.DEMA(price)
return dema
"""3重指数移動平均(TEMA: Triple Exponential Moving Average)"""
def TEMA(price):
tema = talib.T3(price)
return tema
"""三角移動平均(TMA: Triangular Moving Average)"""
def TRIMA(price):
trima = talib.TRIMA(price)
return trima
"""Kaufmanの適応型移動平均(KAMA: Kaufman Adaptive Moving Average)"""
def KAMA(price):
kama = talib.KAMA(price)
return kama
"""MESAの適応型移動平均(MAMA: MESA Adaptive Moving Average)"""
def MAMA(price):
mama, fama = talib.MAMA(price)
return mama, fama
"""トレンドライン(Hilbert Transform - Instantaneous Trendline)"""
def TRENDLINE(price):
trendline = talib.HT_TRENDLINE(price)
return trendline
"""
ボリンジャー・バンド(Bollinger Bands)
15日ボリンジャー・バンド
timeperiod=15, nbdevup=2, nbdevdn=2, matype=0
"""
def BBANDS(price):
upperband, middleband, lowerband = talib.BBANDS(price, timeperiod=20, nbdevup=2, nbdevdn=2, matype=0)
return upperband, middleband, lowerband
"""MidPoint over period"""
def MIDPOINT(price):
midpoint = talib.MIDPOINT(price)
return midpoint
"""変化率(ROC: Rate of change Percentage)"""
def ROC(price):
roc = talib.ROCP(price)
return roc
"""モメンタム(Momentum)"""
def MOM(price):
mom = talib.MOM(price)
return mom
"""
RSI: Relative Strength Index
21日RSI
timeperiod=21
"""
def RSI(price):
rsi = talib.RSI(price)
return rsi
"""MACD: Moving Average Convergence/Divergence"""
def MACD(price):
macd, signal, hist = talib.MACD(price)
return macd, signal, hist
"""APO: Absolute Price Oscillator"""
def APO(price):
apo = talib.APO(price)
return apo
"""PPO: Percentage Price Oscillator"""
def PPO(price):
ppo = talib.PPO(price)
return ppo
"""CMO: Chande Momentum Oscillator"""
def CMO(price):
cmo = talib.CMO(price)
return cmo
"""ヒルベルト変換 - Dominant Cycle Period"""
def DCPERIOD(price):
dcperiod = talib.HT_DCPERIOD(price)
return dcperiod
"""ヒルベルト変換 - Dominant Cycle Phase"""
def DCPHASE(price):
dcphase = talib.HT_DCPHASE(price)
return dcphase
"""ヒルベルト変換 - Phasor Components"""
def PHASOR(price):
inphase, quadrature = talib.HT_PHASOR(price)
return inphase, quadrature
"""ヒルベルト変換 - SineWave"""
def SINE(price):
sine, leadsine = talib.HT_SINE(price)
return sine, leadsine
"""ヒルベルト変換 - Trend vs Cycle Mode"""
def TRENDMODE(price):
trendmode = talib.HT_TRENDMODE(price)
return trendmode