本文整理匯總了Python中talib.MIN屬性的典型用法代碼示例。如果您正苦於以下問題:Python talib.MIN屬性的具體用法?Python talib.MIN怎麽用?Python talib.MIN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類talib
的用法示例。
在下文中一共展示了talib.MIN屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: donchian
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def donchian(candles: np.ndarray, period=20, sequential=False) -> DonchianChannel:
"""
Donchian Channels
:param candles: np.ndarray
:param period: int - default: 20
:param sequential: bool - default=False
:return: DonchianChannel(upperband, middleband, lowerband)
"""
if not sequential and len(candles) > 240:
candles = candles[-240:]
UC = talib.MAX(candles[:, 3], timeperiod=period)
LC = talib.MIN(candles[:, 4], timeperiod=period)
MC = ((UC + LC) / 2)
if sequential:
return DonchianChannel(UC, MC, LC)
else:
return DonchianChannel(UC[-1], MC[-1], LC[-1])
示例2: QSDD
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def QSDD(dataframe, SHORT=12, LONG=26, M=9):
"""
1.line_mid向上突破line_long,買入信號參考。
2.line_mid向下跌破line_long,賣出信號參考。
"""
OPEN = dataframe.open
HIGH = dataframe.high
LOW = dataframe.low
CLOSE = dataframe.close
# QSDD策略
# A = talib.MA(-100 * (talib.MAX(HIGH, 34) - CLOSE) / (talib.MAX(HIGH, 34) - talib.MIN(LOW, 34)), 19)
# B = -100 * (talib.MAX(HIGH, 14) - CLOSE) / (talib.MAX(HIGH, 14) - talib.MIN(LOW, 14))
# D = talib.EMA(-100 * (talib.MAX(HIGH, 34) - CLOSE) / (talib.MAX(HIGH, 34) - talib.MIN(LOW, 34)), 4)
A = QA.MA(-100 * (QA.HHV(HIGH, 34) - CLOSE) /
(QA.HHV(HIGH, 34) - QA.LLV(LOW, 34)), 19)
B = -100 * (QA.HHV(HIGH, 14) - CLOSE) / \
(QA.HHV(HIGH, 14) - QA.LLV(LOW, 14))
D = QA.EMA(-100 * (QA.HHV(HIGH, 34) - CLOSE) /
(QA.HHV(HIGH, 34) - QA.LLV(LOW, 34)), 4)
line_long = A + 100
line_short = B + 100
line_mid = D + 100 # 信號線
CROSS_JC = QA.CROSS(line_mid, line_long)
CROSS_SC = QA.CROSS(line_long, line_mid)
return pd.DataFrame({'line_mid': line_mid, 'line_long': line_long, 'CROSS_JC': CROSS_JC, 'CROSS_SC': CROSS_SC})
# create account
示例3: calculate_cmi_indicator
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def calculate_cmi_indicator(df): # RSI
cmi_period = 30
cmi_ma_period = 10
roc = df['close'].diff(cmi_period)
h1 = ta.MAX(df['high'], cmi_period) - ta.MIN(df['low'], cmi_period)
cmi = abs(roc / h1) * 100
cmi_ma = ta.MA(cmi, cmi_ma_period) # rolling.
return cmi_ma
示例4: donchian
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def donchian(self, n, array=False):
"""
Donchian Channel.
"""
up = talib.MAX(self.high, n)
down = talib.MIN(self.low, n)
if array:
return up, down
return up[-1], down[-1]
示例5: MINMAX
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def MINMAX(series, n=30):
return _series_to_frame(series, ['MIN', 'MAX'], talib.MINMAX, n)
示例6: MIN
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def MIN(series, n=30):
return _series_to_series(series, talib.MIN, n)
示例7: MIN
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def MIN(data, **kwargs):
_check_talib_presence()
prices = _extract_series(data)
return talib.MIN(prices, **kwargs)
示例8: getLowest
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def getLowest(self, price, length):
if (not isinstance(price, np.ndarray) and not isinstance(price, list)) or len(price) == 0:
return np.array([])
arr = np.array(price) if isinstance(price, list) else price
if length <= 1:
return arr
return talib.MIN(arr, length)
示例9: handle_data
# 需要導入模塊: import talib [as 別名]
# 或者: from talib import MIN [as 別名]
def handle_data(context):
MA1 = talib.MA(Close(), timeperiod=p)
MA2 = talib.MIN(Low(), timeperiod=p)
MA3 = talib.MAX(High(), timeperiod=p)
#LogInfo(MA2)
#LogInfo(MA3)
MA4 = talib.MA(Close(), timeperiod=N1)
MA5 = talib.MA(Close(), timeperiod=N2)
if len(MA2) < 55 or len(MA3) < 67:
return
if MarketPosition() == 0:
if (Close()[-1] > MA1[-1]) and (MA5[-1] > MA4[-1]) and (Close()[-1] > MA3[-N0]):
Buy(1, Close()[-1])
elif (MA1[-1] > Close()[-1]) and (MA5[-1] < MA4[-1]) and (Close()[-1] < MA4[-1]):
SellShort(1, Close()[-1])
else:
pass
else:
if Close()[-1] < MA2[-N]:
Sell(1, Close()[-1])
elif Close()[-1] > MA3[-N0]:
BuyToCover(1,Close()[-1]) #買平倉
else:
pass