TA-Lib:修订间差异
无编辑摘要 |
无编辑摘要 |
||
(未显示同一用户的1个中间版本) | |||
第27行: | 第27行: | ||
{| class="wikitable sortable" style="width: 100%; | {| class="wikitable sortable" style="width: 100%; | ||
! 函数名 | ! 函数名 | ||
! 描述 | ! 描述 | ||
! 代码 | ! 代码 | ||
|- | |- | ||
| [[MA]] | | '''[[MA]]'''</code> <br \>Moving average | ||
| 移动平均线<br \>按照计算方法可分多种,一般指简单移动平均(SMA)。<br \> 参数:<br \>matype:默认0(简单移动平均),0=SMA,1=EMA,2=WMA,3=DEMA,4=TEMA,5=TRIMA,6=KAMA,7=MAMA,8=T3 | |||
| 移动平均线 | |||
| MA(close, timeperiod=30, matype=0) | | MA(close, timeperiod=30, matype=0) | ||
|- | |- | ||
| SMA | | '''SMA''' <br \>Simple Moving Average | ||
| 简单移动平均 | |||
| 简单移动平均 | |||
| SMA(close, timeperiod=30) | | SMA(close, timeperiod=30) | ||
|- | |- | ||
| [[EMA]] | | '''[[EMA]]''' <br \>Exponential Moving Average | ||
| 指数移动平均<br \>是以指数式递减加权的移动平均。 | |||
| 指数移动平均 | |||
| EMA(close, timeperiod=30) | | EMA(close, timeperiod=30) | ||
|- | |||
| '''WMA''' <br \>Weighted Moving Average | |||
| | |||
|WMA(close, timeperiod=30) | |||
|- | |||
| '''DEMA'''<br \>Double Exponential Moving Average | |||
| | |||
| DEMA(close, timeperiod=30) | |||
|- | |||
| '''TEMA''' <br \>Triple Exponential Moving Average | |||
| | |||
| TEMA(close, timeperiod=30) | |||
|- | |||
| '''TRIMA''' <br \>Triangular Moving Average | |||
| | |||
| TRIMA(close, timeperiod=30) | |||
|- | |||
| '''KAMA'''<br \>Kaufman Adaptive Moving Average | |||
| | |||
| KAMA(close, timeperiod=30) | |||
|- | |||
| '''MAMA'''<br \>MESA Adaptive Moving Average | |||
| | |||
| mama, fama = MAMA(close, fastlimit=0, slowlimit=0) | |||
|- | |||
| '''T3'''<br \>Triple Exponential Moving Average (T3) | |||
| | |||
| T3(close, timeperiod=5, vfactor=0) | |||
|- | |||
| '''BBANDS'''<br \>Bollinger Bands | |||
| | |||
| upperband, middleband, lowerband = BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0) | |||
|- | |||
| '''HT_TRENDLINE'''<br \>Hilbert Transform | |||
| | |||
| HT_TRENDLINE(close) | |||
|- | |||
| '''MAVP'''<br \>Moving average with variable period | |||
| | |||
| MAVP(close, periods, minperiod=2, maxperiod=30, matype=0) | |||
|- | |||
| '''MIDPOINT'''<br \>MidPoint over period | |||
| | |||
| MIDPOINT(close, timeperiod=14) | |||
|- | |||
| '''MIDPRICE'''<br \>Midpoint Price over period | |||
| | |||
| MIDPRICE(high, low, timeperiod=14) | |||
|- | |||
| '''[[SAR]]'''<br \>Parabolic SAR | |||
| | |||
| SAR(high, low, acceleration=0, maximum=0) | |||
|- | |||
| '''SAREXT'''<br \>Parabolic SAR | |||
| | |||
| SAREXT(high, low, startvalue=0, offsetonreverse=0, accelerationinitlong=0, accelerationlong=0, accelerationmaxlong=0, accelerationinitshort=0, accelerationshort=0, accelerationmaxshort=0) | |||
|} | |} | ||
{{了解更多 | {{了解更多 | ||
|[https://mrjbq7.github.io/ta-lib/func_groups/overlap_studies.html mrjbq7/ta-lib 文档:Overlap Studies] | |[https://mrjbq7.github.io/ta-lib/func_groups/overlap_studies.html mrjbq7/ta-lib 文档:Overlap Studies] | ||
|[https://github.com/mrjbq7/ta-lib/blob/master/talib/_common.pxi mrjbq7/ta-lib GitHub: ta-lib/talib/_common.pxi]}} | |[https://github.com/mrjbq7/ta-lib/blob/master/talib/_common.pxi mrjbq7/ta-lib GitHub: ta-lib/talib/_common.pxi]}} | ||
=== Momentum Indicator 动量指标 === | |||
{| class="wikitable sortable" style="width: 100%;" | |||
! 函数名 | |||
! 描述 | |||
! 代码 | |||
|- | |||
| '''ADX'''<br />Average Directional Movement Index | |||
| | |||
| ADX(high, low, close, timeperiod=14) | |||
|- | |||
| '''ADXR'''<br />Average Directional Movement Index Rating | |||
| | |||
| ADXR(high, low, close, timeperiod=14) | |||
|- | |||
| '''APO'''<br />Absolute Price Oscillator | |||
| | |||
| APO(close, fastperiod=12, slowperiod=26, matype=0) | |||
|- | |||
| '''AROON'''<br />Aroon | |||
| | |||
| oondown, aroonup = AROON(high, low, timeperiod=14) | |||
|- | |||
| '''AROONOSC'''<br />Aroon Oscillator | |||
| | |||
| AROONOSC(high, low, timeperiod=14) | |||
|- | |||
| '''BOP'''<br />Balance Of Power | |||
| | |||
| BOP(open, high, low, close) | |||
|- | |||
| '''CCI'''<br />Commodity Channel Index | |||
| | |||
| CCI(high, low, close, timeperiod=14) | |||
|- | |||
| '''CMO'''<br />Chande Momentum Oscillator | |||
| | |||
| CMO(close, timeperiod=14) | |||
|- | |||
| '''DX'''<br />Directional Movement Index | |||
| | |||
| DX(high, low, close, timeperiod=14) | |||
|- | |||
| '''MACD'''<br />Moving Average Convergence/Divergence | |||
| | |||
| macd, macdsignal, macdhist = MACD(close, fastperiod=12, slowperiod=26, signalperiod=9) | |||
|- | |||
| '''MACDEXT'''<br />MACD with controllable MA type | |||
| | |||
| macd, macdsignal, macdhist = MACDEXT(close, fastperiod=12, fastmatype=0, slowperiod=26, slowmatype=0, signalperiod=9, signalmatype=0) | |||
|- | |||
| '''MACDFIX'''<br />Moving Average Convergence/Divergence Fix 12/26 | |||
| | |||
| macd, macdsignal, macdhist = MACDFIX(close, signalperiod=9) | |||
|- | |||
| '''MFI'''<br />Money Flow Index | |||
| | |||
| MFI(high, low, close, volume, timeperiod=14) | |||
|- | |||
| '''MINUS_DI'''<br />Minus Directional Indicator | |||
| | |||
| MINUS_DI(high, low, close, timeperiod=14) | |||
|- | |||
| '''MINUS_DM'''<br />Minus Directional Movement | |||
| | |||
| MINUS_DM(high, low, timeperiod=14) | |||
|- | |||
| '''MOM'''<br />Momentum | |||
| | |||
| MOM(close, timeperiod=10) | |||
|- | |||
| '''PLUS_DI'''<br />Plus Directional Indicator | |||
| | |||
| PLUS_DI(high, low, close, timeperiod=14) | |||
|- | |||
| '''PLUS_DM'''<br />Plus Directional Movement | |||
| | |||
| PLUS_DM(high, low, timeperiod=14) | |||
|- | |||
| '''PPO'''<br />Percentage Price Oscillator | |||
| | |||
| PPO(close, fastperiod=12, slowperiod=26, matype=0) | |||
|- | |||
| '''ROC'''<br />Rate of change : ((price/prevPrice) | |||
| | |||
| ROC(close, timeperiod=10) | |||
|- | |||
| '''ROCP'''<br />Rate of change Percentage: (price | |||
| | |||
| ROCP(close, timeperiod=10) | |||
|- | |||
| '''ROCR'''<br />Rate of change ratio: (price/prevPrice) | |||
| | |||
| ROCR(close, timeperiod=10) | |||
|- | |||
| '''ROCR100'''<br />Rate of change ratio 100 scale: (price/prevPrice)*100 | |||
| | |||
| ROCR100(close, timeperiod=10) | |||
|- | |||
| '''RSI'''<br />Relative Strength Index | |||
| | |||
| RSI(close, timeperiod=14) | |||
|- | |||
| '''STOCH'''<br />Stochastic | |||
| | |||
| slowk, slowd = STOCH(high, low, close, fastk_period=5, slowk_period=3, slowk_matype=0, slowd_period=3, slowd_matype=0) | |||
|- | |||
| '''STOCHF'''<br />Stochastic Fast | |||
| | |||
| fastk, fastd = STOCHF(high, low, close, fastk_period=5, fastd_period=3, fastd_matype=0) | |||
|- | |||
| '''STOCHRSI'''<br />Stochastic Relative Strength Index | |||
| | |||
| fastk, fastd = STOCHRSI(close, timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=0) | |||
|- | |||
| '''TRIX'''<br />1-day Rate-Of-Change (ROC) of a Triple Smooth EMA | |||
| | |||
| TRIX(close, timeperiod=30) | |||
|- | |||
| '''ULTOSC'''<br />Ultimate Oscillator | |||
| | |||
| ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28) | |||
|- | |||
| '''WILLR'''<br />Williams' %R | |||
| | |||
| WILLR(high, low, close, timeperiod=14) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/momentum_indicators.html mrjbq7/ta-lib 文档:Momentum Indicator Functions]}} | |||
===Volume Indicators=== | |||
{| class="wikitable sortable" style="width: 100%; | |||
!函数名 | |||
!描述 | |||
!代码 | |||
|- | |||
| '''AD'''<br />Chaikin A/D Line | |||
| | |||
| AD(high, low, close, volume) | |||
|- | |||
| '''ADOSC'''<br />Chaikin A/D Oscillator | |||
| | |||
| ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10) | |||
|- | |||
| '''OBV'''<br />On Balance Volume | |||
| | |||
| OBV(close, volume) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/volume_indicators.html mrjbq7/ta-lib 文档:Volume Indicators]}} | |||
===Volatility Indicators=== | |||
{| class="wikitable sortable" style="width: 100%; | |||
!函数名 | |||
!描述 | |||
!代码 | |||
|- | |||
| '''ATR'''<br />Average True Range | |||
| | |||
| ATR(high, low, close, timeperiod=14) | |||
|- | |||
| '''NATR'''<br />Normalized Average True Range | |||
| | |||
| NATR(high, low, close, timeperiod=14) | |||
|- | |||
| '''TRANGE'''<br />True Range | |||
| | |||
| TRANGE(high, low, close) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/volatility_indicators.html mrjbq7/ta-lib 文档:Volatility Indicators]}} | |||
===Price Transform=== | |||
{| class="wikitable sortable" style="width: 100%; | |||
!函数名 | |||
!描述 | |||
!代码 | |||
|- | |||
| '''AVGPRICE'''<br />Average Price | |||
| | |||
| AVGPRICE(open, high, low, close) | |||
|- | |||
| '''MEDPRICE'''<br />Median Price | |||
| | |||
| MEDPRICE(high, low) | |||
|- | |||
| '''TYPPRICE'''<br />Typical Price | |||
| | |||
| TYPPRICE(high, low, close) | |||
|- | |||
| '''WCLPRICE'''<br />Weighted Close Price | |||
| | |||
| WCLPRICE(high, low, close) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/price_transform.html mrjbq7/ta-lib 文档:Price Transform]}} | |||
===Cycle Indicators=== | |||
{| class="wikitable sortable" style="width: 100%; | |||
!函数名 | |||
!描述 | |||
!代码 | |||
|- | |||
| '''HT_DCPERIOD'''<br />Hilbert Transform - Dominant Cycle Period | |||
| | |||
| HT_DCPERIOD(close) | |||
|- | |||
| '''HT_DCPHASE'''<br />Hilbert Transform - Dominant Cycle Phase | |||
| | |||
| HT_DCPHASE(close) | |||
|- | |||
| '''HT_PHASOR'''<br />Hilbert Transform - Phasor Components | |||
| | |||
| inphase, quadrature = HT_PHASOR(close) | |||
|- | |||
| '''HT_SINE'''<br />Hilbert Transform - SineWave | |||
| | |||
| sine, leadsine = HT_SINE(close) | |||
|- | |||
| '''HT_TRENDMODE'''<br />Hilbert Transform - Trend vs Cycle Mode | |||
| | |||
|HT_TRENDMODE(close) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/cycle_indicators.html mrjbq7/ta-lib 文档:Cycle Indicators]}} | |||
===Pattern Recognition=== | |||
{| class="wikitable sortable" style="width: 100%; | |||
!函数名 | |||
!描述 | |||
!代码 | |||
|- | |||
| '''CDL2CROWS'''<br />Two Crows | |||
| | |||
|CDL2CROWS(open, high, low, close) | |||
|- | |||
| '''CDL3BLACKCROWS'''<br />Three Black Crows | |||
| | |||
|CDL3BLACKCROWS(open, high, low, close) | |||
|- | |||
| '''CDL3INSIDE'''<br />Three Inside Up/Down | |||
| | |||
|CDL3INSIDE(open, high, low, close) | |||
|- | |||
| '''CDL3LINESTRIKE'''<br />Three-Line Strike | |||
| | |||
|CDL3LINESTRIKE(open, high, low, close) | |||
|- | |||
| '''CDL3OUTSIDE'''<br />Three Outside Up/Down | |||
| | |||
|CDL3OUTSIDE(open, high, low, close) | |||
|- | |||
| '''CDL3STARSINSOUTH'''<br />Three Stars In The South | |||
| | |||
|CDL3STARSINSOUTH(open, high, low, close) | |||
|- | |||
| '''CDL3WHITESOLDIERS'''<br />Three Advancing White Soldiers | |||
| | |||
|CDL3WHITESOLDIERS(open, high, low, close) | |||
|- | |||
| '''CDLABANDONEDBABY'''<br />Abandoned Baby | |||
| | |||
|CDLABANDONEDBABY(open, high, low, close, penetration=0) | |||
|- | |||
| '''CDLADVANCEBLOCK'''<br />Advance Block | |||
| | |||
|CDLADVANCEBLOCK(open, high, low, close) | |||
|- | |||
| '''CDLBELTHOLD'''<br />Belt-hold | |||
| | |||
|CDLBELTHOLD(open, high, low, close) | |||
|- | |||
| '''CDLBREAKAWAY'''<br />Breakaway | |||
| | |||
|CDLBREAKAWAY(open, high, low, close) | |||
|- | |||
| '''CDLCLOSINGMARUBOZU'''<br />Closing Marubozu | |||
| | |||
|CDLCLOSINGMARUBOZU(open, high, low, close) | |||
|- | |||
| '''CDLCONCEALBABYSWALL'''<br />Concealing Baby Swallow | |||
| | |||
|CDLCONCEALBABYSWALL(open, high, low, close) | |||
|- | |||
| '''CDLCOUNTERATTACK'''<br />Counterattack | |||
| | |||
|CDLCOUNTERATTACK(open, high, low, close) | |||
|- | |||
| '''CDLDARKCLOUDCOVER'''<br />Dark Cloud Cover | |||
| | |||
|CDLDARKCLOUDCOVER(open, high, low, close, penetration=0) | |||
|- | |||
| '''CDLDOJI'''<br />Doji | |||
| | |||
|CDLDOJI(open, high, low, close) | |||
|- | |||
| '''CDLDOJISTAR'''<br />Doji Star | |||
| | |||
|CDLDOJISTAR(open, high, low, close) | |||
|- | |||
| '''CDLDRAGONFLYDOJI'''<br />Dragonfly Doji | |||
| | |||
|CDLDRAGONFLYDOJI(open, high, low, close) | |||
|- | |||
| '''CDLENGULFING'''<br />Engulfing Pattern | |||
| | |||
|CDLENGULFING(open, high, low, close) | |||
|- | |||
| '''CDLEVENINGDOJISTAR'''<br />Evening Doji Star | |||
| | |||
|CDLEVENINGDOJISTAR(open, high, low, close, penetration=0) | |||
|- | |||
| '''CDLEVENINGSTAR'''<br />Evening Star | |||
| | |||
|CDLEVENINGSTAR(open, high, low, close, penetration=0) | |||
|- | |||
| '''CDLGAPSIDESIDEWHITE'''<br />Up/Down-gap side-by-side white lines | |||
| | |||
|CDLGAPSIDESIDEWHITE(open, high, low, close) | |||
|- | |||
| '''CDLGRAVESTONEDOJI'''<br />Gravestone Doji | |||
| | |||
|CDLGRAVESTONEDOJI(open, high, low, close) | |||
|- | |||
| '''CDLHAMMER'''<br />Hammer | |||
| | |||
|CDLHAMMER(open, high, low, close) | |||
|- | |||
| '''CDLHANGINGMAN'''<br />Hanging Man | |||
| | |||
|CDLHANGINGMAN(open, high, low, close) | |||
|- | |||
| '''CDLHARAMI'''<br />Harami Pattern | |||
| | |||
|CDLHARAMI(open, high, low, close) | |||
|- | |||
| '''CDLHARAMICROSS'''<br />Harami Cross Pattern | |||
| | |||
|CDLHARAMICROSS(open, high, low, close) | |||
|- | |||
| '''CDLHIGHWAVE'''<br />High-Wave Candle | |||
| | |||
|CDLHIGHWAVE(open, high, low, close) | |||
|- | |||
| '''CDLHIKKAKE'''<br />Hikkake Pattern | |||
| | |||
|CDLHIKKAKE(open, high, low, close) | |||
|- | |||
| '''CDLHIKKAKEMOD'''<br />Modified Hikkake Pattern | |||
| | |||
|CDLHIKKAKEMOD(open, high, low, close) | |||
|- | |||
| '''CDLHOMINGPIGEON'''<br />Homing Pigeon | |||
| | |||
|CDLHOMINGPIGEON(open, high, low, close) | |||
|- | |||
| '''CDLIDENTICAL3CROWS'''<br />Identical Three Crows | |||
| | |||
|CDLIDENTICAL3CROWS(open, high, low, close) | |||
|- | |||
| '''CDLINNECK'''<br />In-Neck Pattern | |||
| | |||
|CDLINNECK(open, high, low, close) | |||
|- | |||
| '''CDLINVERTEDHAMMER'''<br />Inverted Hammer | |||
| | |||
|CDLINVERTEDHAMMER(open, high, low, close) | |||
|- | |||
| '''CDLKICKING'''<br />Kicking | |||
| | |||
|CDLKICKING(open, high, low, close) | |||
|- | |||
| '''CDLKICKINGBYLENGTH'''<br />Kicking - bull/bear determined by the longer marubozu | |||
| | |||
|CDLKICKINGBYLENGTH(open, high, low, close) | |||
|- | |||
| '''CDLLADDERBOTTOM'''<br />Ladder Bottom | |||
| | |||
|CDLLADDERBOTTOM(open, high, low, close) | |||
|- | |||
| '''CDLLONGLEGGEDDOJI'''<br />Long Legged Doji | |||
| | |||
|CDLLONGLEGGEDDOJI(open, high, low, close) | |||
|- | |||
| '''CDLLONGLINE'''<br />Long Line Candle | |||
| | |||
|CDLLONGLINE(open, high, low, close) | |||
|- | |||
| '''CDLMARUBOZU'''<br />Marubozu | |||
| | |||
|CDLMARUBOZU(open, high, low, close) | |||
|- | |||
| '''CDLMATCHINGLOW'''<br />Matching Low | |||
| | |||
|CDLMATCHINGLOW(open, high, low, close) | |||
|- | |||
| '''CDLMATHOLD'''<br />Mat Hold | |||
| | |||
|CDLMATHOLD(open, high, low, close, penetration=0) | |||
|- | |||
| '''CDLMORNINGDOJISTAR'''<br />Morning Doji Star | |||
| | |||
|CDLMORNINGDOJISTAR(open, high, low, close, penetration=0) | |||
|- | |||
| '''CDLMORNINGSTAR'''<br />Morning Star | |||
| | |||
|CDLMORNINGSTAR(open, high, low, close, penetration=0) | |||
|- | |||
| '''CDLONNECK'''<br />On-Neck Pattern | |||
| | |||
|CDLONNECK(open, high, low, close) | |||
|- | |||
| '''CDLPIERCING'''<br />Piercing Pattern | |||
| | |||
|CDLPIERCING(open, high, low, close) | |||
|- | |||
| '''CDLRICKSHAWMAN'''<br />Rickshaw Man | |||
| | |||
|CDLRICKSHAWMAN(open, high, low, close) | |||
|- | |||
| '''CDLRISEFALL3METHODS'''<br />Rising/Falling Three Methods | |||
| | |||
|CDLRISEFALL3METHODS(open, high, low, close) | |||
|- | |||
| '''CDLSEPARATINGLINES'''<br />Separating Lines | |||
| | |||
|CDLSEPARATINGLINES(open, high, low, close) | |||
|- | |||
| '''CDLSHOOTINGSTAR'''<br />Shooting Star | |||
| | |||
|CDLSHOOTINGSTAR(open, high, low, close) | |||
|- | |||
| '''CDLSHORTLINE'''<br />Short Line Candle | |||
| | |||
|CDLSHORTLINE(open, high, low, close) | |||
|- | |||
| '''CDLSPINNINGTOP'''<br />Spinning Top | |||
| | |||
|CDLSPINNINGTOP(open, high, low, close) | |||
|- | |||
| '''CDLSTALLEDPATTERN'''<br />Stalled Pattern | |||
| | |||
|CDLSTALLEDPATTERN(open, high, low, close) | |||
|- | |||
| '''CDLSTICKSANDWICH'''<br />Stick Sandwich | |||
| | |||
|CDLSTICKSANDWICH(open, high, low, close) | |||
|- | |||
| '''CDLTAKURI'''<br />Takuri (Dragonfly Doji with very long lower shadow) | |||
| | |||
|CDLTAKURI(open, high, low, close) | |||
|- | |||
| '''CDLTASUKIGAP'''<br />Tasuki Gap | |||
| | |||
|CDLTASUKIGAP(open, high, low, close) | |||
|- | |||
| '''CDLTHRUSTING'''<br />Thrusting Pattern | |||
| | |||
|CDLTHRUSTING(open, high, low, close) | |||
|- | |||
| '''CDLTRISTAR'''<br />Tristar Pattern | |||
| | |||
|CDLTRISTAR(open, high, low, close) | |||
|- | |||
| '''CDLUNIQUE3RIVER'''<br />Unique 3 River | |||
| | |||
|CDLUNIQUE3RIVER(open, high, low, close) | |||
|- | |||
| '''CDLUPSIDEGAP2CROWS'''<br />Upside Gap Two Crows | |||
| | |||
|CDLUPSIDEGAP2CROWS(open, high, low, close) | |||
|- | |||
| '''CDLXSIDEGAP3METHODS'''<br />Upside/Downside Gap Three Methods | |||
| | |||
|CDLXSIDEGAP3METHODS(open, high, low, close) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/pattern_recognition.html mrjbq7/ta-lib 文档:Pattern Recognition]}} | |||
===Statistic Functions=== | |||
{| class="wikitable sortable" style="width: 100%; | |||
!函数名 | |||
!描述 | |||
!代码 | |||
|- | |||
| '''BETA'''<br />Beta | |||
| | |||
| BETA(high, low, timeperiod=5) | |||
|- | |||
| '''CORREL'''<br />Pearson's Correlation Coefficient (r) | |||
| | |||
| CORREL(high, low, timeperiod=30) | |||
|- | |||
| '''LINEARREG'''<br />Linear Regression | |||
| | |||
| LINEARREG(close, timeperiod=14) | |||
|- | |||
| '''LINEARREG_ANGLE'''<br />Linear Regression Angle | |||
| | |||
| LINEARREG_ANGLE(close, timeperiod=14) | |||
|- | |||
| '''LINEARREG_INTERCEPT'''<br />Linear Regression Intercept | |||
| | |||
| LINEARREG_INTERCEPT(close, timeperiod=14) | |||
|- | |||
| '''LINEARREG_SLOPE'''<br />Linear Regression Slope | |||
| | |||
| LINEARREG_SLOPE(close, timeperiod=14) | |||
|- | |||
| '''STDDEV'''<br />Standard Deviation | |||
| | |||
| STDDEV(close, timeperiod=5, nbdev=1) | |||
|- | |||
| '''TSF'''<br />Time Series Forecast | |||
| | |||
| TSF(close, timeperiod=14) | |||
|- | |||
| '''VAR'''<br />Variance | |||
| | |||
| VAR(close, timeperiod=5, nbdev=1) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/statistic_functions.html mrjbq7/ta-lib 文档:Statistic Functions]}} | |||
===Math Transform=== | |||
{| class="wikitable sortable" style="width: 100%; | |||
!函数名 | |||
!描述 | |||
!代码 | |||
|- | |||
| '''ACOS'''<br />Vector Trigonometric ACos | |||
| | |||
| ACOS(close) | |||
|- | |||
| '''ASIN'''<br />Vector Trigonometric ASin | |||
| | |||
| ASIN(close) | |||
|- | |||
| '''ATAN'''<br />Vector Trigonometric ATan | |||
| | |||
| ATAN(close) | |||
|- | |||
| '''CEIL'''<br />Vector Ceil | |||
| | |||
| CEIL(close) | |||
|- | |||
| '''COS'''<br />Vector Trigonometric Cos | |||
| | |||
| COS(close) | |||
|- | |||
| '''COSH'''<br />Vector Trigonometric Cosh | |||
| | |||
| COSH(close) | |||
|- | |||
| '''EXP'''<br />Vector Arithmetic Exp | |||
| | |||
| EXP(close) | |||
|- | |||
| '''FLOOR'''<br />Vector Floor | |||
| | |||
| FLOOR(close) | |||
|- | |||
| '''LN'''<br />Vector Log Natural | |||
| | |||
| LN(close) | |||
|- | |||
| '''LOG10'''<br />Vector Log10 | |||
| | |||
| LOG10(close) | |||
|- | |||
| '''SIN'''<br />Vector Trigonometric Sin | |||
| | |||
| SIN(close) | |||
|- | |||
| '''SINH'''<br />Vector Trigonometric Sinh | |||
| | |||
| SINH(close) | |||
|- | |||
| '''SQRT'''<br />Vector Square Root | |||
| | |||
| SQRT(close) | |||
|- | |||
| '''TAN'''<br />Vector Trigonometric Tan | |||
| | |||
| TAN(close) | |||
|- | |||
| '''TANH'''<br />Vector Trigonometric Tanh | |||
| | |||
| TANH(close) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/math_transform.html mrjbq7/ta-lib 文档:Math Transform]}} | |||
===Math Operators=== | |||
{| class="wikitable sortable" style="width: 100%; | |||
!函数名 | |||
!描述 | |||
!代码 | |||
|- | |||
| '''ADD'''<br />Vector Arithmetic Add | |||
| | |||
| ADD(high, low) | |||
|- | |||
| '''DIV'''<br />Vector Arithmetic Div | |||
| | |||
| DIV(high, low) | |||
|- | |||
| '''MAX'''<br />Highest value over a specified period | |||
| | |||
| MAX(close, timeperiod=30) | |||
|- | |||
| '''MAXINDEX'''<br />Index of highest value over a specified period | |||
| | |||
|MAXINDEX(close, timeperiod=30) | |||
|- | |||
| '''MIN'''<br />Lowest value over a specified period | |||
| | |||
| MIN(close, timeperiod=30) | |||
|- | |||
| '''MININDEX'''<br />Index of lowest value over a specified period | |||
| | |||
|MININDEX(close, timeperiod=30) | |||
|- | |||
| '''MINMAX'''<br />Lowest and highest values over a specified period | |||
| | |||
| min, max = MINMAX(close, timeperiod=30) | |||
|- | |||
| '''MINMAXINDEX'''<br />Indexes of lowest and highest values over a specified period | |||
| | |||
| minidx, maxidx = MINMAXINDEX(close, timeperiod=30) | |||
|- | |||
| '''MULT'''<br />Vector Arithmetic Mult | |||
| | |||
| MULT(high, low) | |||
|- | |||
| '''SUB'''<br />Vector Arithmetic Substraction | |||
| | |||
| SUB(high, low) | |||
|- | |||
| '''SUM'''<br />Summation | |||
| | |||
| SUM(close, timeperiod=30) | |||
|} | |||
{{了解更多 | |||
|[https://mrjbq7.github.io/ta-lib/func_groups/math_operators.html mrjbq7/ta-lib 文档:Math Operators]}} | |||
==资源== | ==资源== |
2021年1月22日 (五) 18:23的最新版本
TA-Lib(Technical Analysis Library)是一个多平台的技术分析库,多种编程语言的开源API,包括C/C++、Java、Perl、Python版等。包含200多个技术指标,如ADX、MACD、RSI、布林带等,还支持烛台模式识别。Ta-Lib使用BSD许可,允许将它集成到您自己的开源或商业应用程序中。
TA-Lib的Python版本是使用 SWIG 封装C/C++版本的API,难安装,速度稍慢。开源项目mrjbq7/ta-lib使用Cython和Numpy封装TA-Lib的C/C++版,速度比TA-Lib的Python版快,所以在Python中一般使用该版本。
简介
时间轴
安装
使用pip安装
mrjbq7/ta-lib有发布在PyPI上,可以使用pip安装:
pip install TA-Lib
了解更多 >> mrjbq7/ta-lib:安装
故障排除
了解更多 >> mrjbq7/ta-lib:故障排除
函数
Overlap Studies 重叠指标
函数名 | 描述 | 代码 |
---|---|---|
MA Moving average |
移动平均线 按照计算方法可分多种,一般指简单移动平均(SMA)。 参数: matype:默认0(简单移动平均),0=SMA,1=EMA,2=WMA,3=DEMA,4=TEMA,5=TRIMA,6=KAMA,7=MAMA,8=T3 |
MA(close, timeperiod=30, matype=0) |
SMA Simple Moving Average |
简单移动平均 | SMA(close, timeperiod=30) |
EMA Exponential Moving Average |
指数移动平均 是以指数式递减加权的移动平均。 |
EMA(close, timeperiod=30) |
WMA Weighted Moving Average |
WMA(close, timeperiod=30) | |
DEMA Double Exponential Moving Average |
DEMA(close, timeperiod=30) | |
TEMA Triple Exponential Moving Average |
TEMA(close, timeperiod=30) | |
TRIMA Triangular Moving Average |
TRIMA(close, timeperiod=30) | |
KAMA Kaufman Adaptive Moving Average |
KAMA(close, timeperiod=30) | |
MAMA MESA Adaptive Moving Average |
mama, fama = MAMA(close, fastlimit=0, slowlimit=0) | |
T3 Triple Exponential Moving Average (T3) |
T3(close, timeperiod=5, vfactor=0) | |
BBANDS Bollinger Bands |
upperband, middleband, lowerband = BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0) | |
HT_TRENDLINE Hilbert Transform |
HT_TRENDLINE(close) | |
MAVP Moving average with variable period |
MAVP(close, periods, minperiod=2, maxperiod=30, matype=0) | |
MIDPOINT MidPoint over period |
MIDPOINT(close, timeperiod=14) | |
MIDPRICE Midpoint Price over period |
MIDPRICE(high, low, timeperiod=14) | |
SAR Parabolic SAR |
SAR(high, low, acceleration=0, maximum=0) | |
SAREXT Parabolic SAR |
SAREXT(high, low, startvalue=0, offsetonreverse=0, accelerationinitlong=0, accelerationlong=0, accelerationmaxlong=0, accelerationinitshort=0, accelerationshort=0, accelerationmaxshort=0) |
Momentum Indicator 动量指标
函数名 | 描述 | 代码 |
---|---|---|
ADX Average Directional Movement Index |
ADX(high, low, close, timeperiod=14) | |
ADXR Average Directional Movement Index Rating |
ADXR(high, low, close, timeperiod=14) | |
APO Absolute Price Oscillator |
APO(close, fastperiod=12, slowperiod=26, matype=0) | |
AROON Aroon |
oondown, aroonup = AROON(high, low, timeperiod=14) | |
AROONOSC Aroon Oscillator |
AROONOSC(high, low, timeperiod=14) | |
BOP Balance Of Power |
BOP(open, high, low, close) | |
CCI Commodity Channel Index |
CCI(high, low, close, timeperiod=14) | |
CMO Chande Momentum Oscillator |
CMO(close, timeperiod=14) | |
DX Directional Movement Index |
DX(high, low, close, timeperiod=14) | |
MACD Moving Average Convergence/Divergence |
macd, macdsignal, macdhist = MACD(close, fastperiod=12, slowperiod=26, signalperiod=9) | |
MACDEXT MACD with controllable MA type |
macd, macdsignal, macdhist = MACDEXT(close, fastperiod=12, fastmatype=0, slowperiod=26, slowmatype=0, signalperiod=9, signalmatype=0) | |
MACDFIX Moving Average Convergence/Divergence Fix 12/26 |
macd, macdsignal, macdhist = MACDFIX(close, signalperiod=9) | |
MFI Money Flow Index |
MFI(high, low, close, volume, timeperiod=14) | |
MINUS_DI Minus Directional Indicator |
MINUS_DI(high, low, close, timeperiod=14) | |
MINUS_DM Minus Directional Movement |
MINUS_DM(high, low, timeperiod=14) | |
MOM Momentum |
MOM(close, timeperiod=10) | |
PLUS_DI Plus Directional Indicator |
PLUS_DI(high, low, close, timeperiod=14) | |
PLUS_DM Plus Directional Movement |
PLUS_DM(high, low, timeperiod=14) | |
PPO Percentage Price Oscillator |
PPO(close, fastperiod=12, slowperiod=26, matype=0) | |
ROC Rate of change : ((price/prevPrice) |
ROC(close, timeperiod=10) | |
ROCP Rate of change Percentage: (price |
ROCP(close, timeperiod=10) | |
ROCR Rate of change ratio: (price/prevPrice) |
ROCR(close, timeperiod=10) | |
ROCR100 Rate of change ratio 100 scale: (price/prevPrice)*100 |
ROCR100(close, timeperiod=10) | |
RSI Relative Strength Index |
RSI(close, timeperiod=14) | |
STOCH Stochastic |
slowk, slowd = STOCH(high, low, close, fastk_period=5, slowk_period=3, slowk_matype=0, slowd_period=3, slowd_matype=0) | |
STOCHF Stochastic Fast |
fastk, fastd = STOCHF(high, low, close, fastk_period=5, fastd_period=3, fastd_matype=0) | |
STOCHRSI Stochastic Relative Strength Index |
fastk, fastd = STOCHRSI(close, timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=0) | |
TRIX 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA |
TRIX(close, timeperiod=30) | |
ULTOSC Ultimate Oscillator |
ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28) | |
WILLR Williams' %R |
WILLR(high, low, close, timeperiod=14) |
Volume Indicators
函数名 | 描述 | 代码 |
---|---|---|
AD Chaikin A/D Line |
AD(high, low, close, volume) | |
ADOSC Chaikin A/D Oscillator |
ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10) | |
OBV On Balance Volume |
OBV(close, volume) |
Volatility Indicators
函数名 | 描述 | 代码 |
---|---|---|
ATR Average True Range |
ATR(high, low, close, timeperiod=14) | |
NATR Normalized Average True Range |
NATR(high, low, close, timeperiod=14) | |
TRANGE True Range |
TRANGE(high, low, close) |
Price Transform
函数名 | 描述 | 代码 |
---|---|---|
AVGPRICE Average Price |
AVGPRICE(open, high, low, close) | |
MEDPRICE Median Price |
MEDPRICE(high, low) | |
TYPPRICE Typical Price |
TYPPRICE(high, low, close) | |
WCLPRICE Weighted Close Price |
WCLPRICE(high, low, close) |
了解更多 >> mrjbq7/ta-lib 文档:Price Transform
Cycle Indicators
函数名 | 描述 | 代码 |
---|---|---|
HT_DCPERIOD Hilbert Transform - Dominant Cycle Period |
HT_DCPERIOD(close) | |
HT_DCPHASE Hilbert Transform - Dominant Cycle Phase |
HT_DCPHASE(close) | |
HT_PHASOR Hilbert Transform - Phasor Components |
inphase, quadrature = HT_PHASOR(close) | |
HT_SINE Hilbert Transform - SineWave |
sine, leadsine = HT_SINE(close) | |
HT_TRENDMODE Hilbert Transform - Trend vs Cycle Mode |
HT_TRENDMODE(close) |
Pattern Recognition
函数名 | 描述 | 代码 |
---|---|---|
CDL2CROWS Two Crows |
CDL2CROWS(open, high, low, close) | |
CDL3BLACKCROWS Three Black Crows |
CDL3BLACKCROWS(open, high, low, close) | |
CDL3INSIDE Three Inside Up/Down |
CDL3INSIDE(open, high, low, close) | |
CDL3LINESTRIKE Three-Line Strike |
CDL3LINESTRIKE(open, high, low, close) | |
CDL3OUTSIDE Three Outside Up/Down |
CDL3OUTSIDE(open, high, low, close) | |
CDL3STARSINSOUTH Three Stars In The South |
CDL3STARSINSOUTH(open, high, low, close) | |
CDL3WHITESOLDIERS Three Advancing White Soldiers |
CDL3WHITESOLDIERS(open, high, low, close) | |
CDLABANDONEDBABY Abandoned Baby |
CDLABANDONEDBABY(open, high, low, close, penetration=0) | |
CDLADVANCEBLOCK Advance Block |
CDLADVANCEBLOCK(open, high, low, close) | |
CDLBELTHOLD Belt-hold |
CDLBELTHOLD(open, high, low, close) | |
CDLBREAKAWAY Breakaway |
CDLBREAKAWAY(open, high, low, close) | |
CDLCLOSINGMARUBOZU Closing Marubozu |
CDLCLOSINGMARUBOZU(open, high, low, close) | |
CDLCONCEALBABYSWALL Concealing Baby Swallow |
CDLCONCEALBABYSWALL(open, high, low, close) | |
CDLCOUNTERATTACK Counterattack |
CDLCOUNTERATTACK(open, high, low, close) | |
CDLDARKCLOUDCOVER Dark Cloud Cover |
CDLDARKCLOUDCOVER(open, high, low, close, penetration=0) | |
CDLDOJI Doji |
CDLDOJI(open, high, low, close) | |
CDLDOJISTAR Doji Star |
CDLDOJISTAR(open, high, low, close) | |
CDLDRAGONFLYDOJI Dragonfly Doji |
CDLDRAGONFLYDOJI(open, high, low, close) | |
CDLENGULFING Engulfing Pattern |
CDLENGULFING(open, high, low, close) | |
CDLEVENINGDOJISTAR Evening Doji Star |
CDLEVENINGDOJISTAR(open, high, low, close, penetration=0) | |
CDLEVENINGSTAR Evening Star |
CDLEVENINGSTAR(open, high, low, close, penetration=0) | |
CDLGAPSIDESIDEWHITE Up/Down-gap side-by-side white lines |
CDLGAPSIDESIDEWHITE(open, high, low, close) | |
CDLGRAVESTONEDOJI Gravestone Doji |
CDLGRAVESTONEDOJI(open, high, low, close) | |
CDLHAMMER Hammer |
CDLHAMMER(open, high, low, close) | |
CDLHANGINGMAN Hanging Man |
CDLHANGINGMAN(open, high, low, close) | |
CDLHARAMI Harami Pattern |
CDLHARAMI(open, high, low, close) | |
CDLHARAMICROSS Harami Cross Pattern |
CDLHARAMICROSS(open, high, low, close) | |
CDLHIGHWAVE High-Wave Candle |
CDLHIGHWAVE(open, high, low, close) | |
CDLHIKKAKE Hikkake Pattern |
CDLHIKKAKE(open, high, low, close) | |
CDLHIKKAKEMOD Modified Hikkake Pattern |
CDLHIKKAKEMOD(open, high, low, close) | |
CDLHOMINGPIGEON Homing Pigeon |
CDLHOMINGPIGEON(open, high, low, close) | |
CDLIDENTICAL3CROWS Identical Three Crows |
CDLIDENTICAL3CROWS(open, high, low, close) | |
CDLINNECK In-Neck Pattern |
CDLINNECK(open, high, low, close) | |
CDLINVERTEDHAMMER Inverted Hammer |
CDLINVERTEDHAMMER(open, high, low, close) | |
CDLKICKING Kicking |
CDLKICKING(open, high, low, close) | |
CDLKICKINGBYLENGTH Kicking - bull/bear determined by the longer marubozu |
CDLKICKINGBYLENGTH(open, high, low, close) | |
CDLLADDERBOTTOM Ladder Bottom |
CDLLADDERBOTTOM(open, high, low, close) | |
CDLLONGLEGGEDDOJI Long Legged Doji |
CDLLONGLEGGEDDOJI(open, high, low, close) | |
CDLLONGLINE Long Line Candle |
CDLLONGLINE(open, high, low, close) | |
CDLMARUBOZU Marubozu |
CDLMARUBOZU(open, high, low, close) | |
CDLMATCHINGLOW Matching Low |
CDLMATCHINGLOW(open, high, low, close) | |
CDLMATHOLD Mat Hold |
CDLMATHOLD(open, high, low, close, penetration=0) | |
CDLMORNINGDOJISTAR Morning Doji Star |
CDLMORNINGDOJISTAR(open, high, low, close, penetration=0) | |
CDLMORNINGSTAR Morning Star |
CDLMORNINGSTAR(open, high, low, close, penetration=0) | |
CDLONNECK On-Neck Pattern |
CDLONNECK(open, high, low, close) | |
CDLPIERCING Piercing Pattern |
CDLPIERCING(open, high, low, close) | |
CDLRICKSHAWMAN Rickshaw Man |
CDLRICKSHAWMAN(open, high, low, close) | |
CDLRISEFALL3METHODS Rising/Falling Three Methods |
CDLRISEFALL3METHODS(open, high, low, close) | |
CDLSEPARATINGLINES Separating Lines |
CDLSEPARATINGLINES(open, high, low, close) | |
CDLSHOOTINGSTAR Shooting Star |
CDLSHOOTINGSTAR(open, high, low, close) | |
CDLSHORTLINE Short Line Candle |
CDLSHORTLINE(open, high, low, close) | |
CDLSPINNINGTOP Spinning Top |
CDLSPINNINGTOP(open, high, low, close) | |
CDLSTALLEDPATTERN Stalled Pattern |
CDLSTALLEDPATTERN(open, high, low, close) | |
CDLSTICKSANDWICH Stick Sandwich |
CDLSTICKSANDWICH(open, high, low, close) | |
CDLTAKURI Takuri (Dragonfly Doji with very long lower shadow) |
CDLTAKURI(open, high, low, close) | |
CDLTASUKIGAP Tasuki Gap |
CDLTASUKIGAP(open, high, low, close) | |
CDLTHRUSTING Thrusting Pattern |
CDLTHRUSTING(open, high, low, close) | |
CDLTRISTAR Tristar Pattern |
CDLTRISTAR(open, high, low, close) | |
CDLUNIQUE3RIVER Unique 3 River |
CDLUNIQUE3RIVER(open, high, low, close) | |
CDLUPSIDEGAP2CROWS Upside Gap Two Crows |
CDLUPSIDEGAP2CROWS(open, high, low, close) | |
CDLXSIDEGAP3METHODS Upside/Downside Gap Three Methods |
CDLXSIDEGAP3METHODS(open, high, low, close) |
Statistic Functions
函数名 | 描述 | 代码 |
---|---|---|
BETA Beta |
BETA(high, low, timeperiod=5) | |
CORREL Pearson's Correlation Coefficient (r) |
CORREL(high, low, timeperiod=30) | |
LINEARREG Linear Regression |
LINEARREG(close, timeperiod=14) | |
LINEARREG_ANGLE Linear Regression Angle |
LINEARREG_ANGLE(close, timeperiod=14) | |
LINEARREG_INTERCEPT Linear Regression Intercept |
LINEARREG_INTERCEPT(close, timeperiod=14) | |
LINEARREG_SLOPE Linear Regression Slope |
LINEARREG_SLOPE(close, timeperiod=14) | |
STDDEV Standard Deviation |
STDDEV(close, timeperiod=5, nbdev=1) | |
TSF Time Series Forecast |
TSF(close, timeperiod=14) | |
VAR Variance |
VAR(close, timeperiod=5, nbdev=1) |
Math Transform
函数名 | 描述 | 代码 |
---|---|---|
ACOS Vector Trigonometric ACos |
ACOS(close) | |
ASIN Vector Trigonometric ASin |
ASIN(close) | |
ATAN Vector Trigonometric ATan |
ATAN(close) | |
CEIL Vector Ceil |
CEIL(close) | |
COS Vector Trigonometric Cos |
COS(close) | |
COSH Vector Trigonometric Cosh |
COSH(close) | |
EXP Vector Arithmetic Exp |
EXP(close) | |
FLOOR Vector Floor |
FLOOR(close) | |
LN Vector Log Natural |
LN(close) | |
LOG10 Vector Log10 |
LOG10(close) | |
SIN Vector Trigonometric Sin |
SIN(close) | |
SINH Vector Trigonometric Sinh |
SINH(close) | |
SQRT Vector Square Root |
SQRT(close) | |
TAN Vector Trigonometric Tan |
TAN(close) | |
TANH Vector Trigonometric Tanh |
TANH(close) |
了解更多 >> mrjbq7/ta-lib 文档:Math Transform
Math Operators
函数名 | 描述 | 代码 |
---|---|---|
ADD Vector Arithmetic Add |
ADD(high, low) | |
DIV Vector Arithmetic Div |
DIV(high, low) | |
MAX Highest value over a specified period |
MAX(close, timeperiod=30) | |
MAXINDEX Index of highest value over a specified period |
MAXINDEX(close, timeperiod=30) | |
MIN Lowest value over a specified period |
MIN(close, timeperiod=30) | |
MININDEX Index of lowest value over a specified period |
MININDEX(close, timeperiod=30) | |
MINMAX Lowest and highest values over a specified period |
min, max = MINMAX(close, timeperiod=30) | |
MINMAXINDEX Indexes of lowest and highest values over a specified period |
minidx, maxidx = MINMAXINDEX(close, timeperiod=30) | |
MULT Vector Arithmetic Mult |
MULT(high, low) | |
SUB Vector Arithmetic Substraction |
SUB(high, low) | |
SUM Summation |
SUM(close, timeperiod=30) |
了解更多 >> mrjbq7/ta-lib 文档:Math Operators