├── .gitignore ├── README.md ├── abstract.md ├── doc_index.md ├── func.md ├── func_groups ├── cycle_indicators.md ├── math_operators.md ├── math_transform.md ├── momentum_indicators.md ├── overlap_studies.md ├── pattern_recognition.md ├── price_transform.md ├── statistic_functions.md ├── volatility_indicators.md └── volume_indicators.md ├── funcs.md └── install.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TA-Lib 2 | # 简介: 3 | Talib一直缺乏有效的中文文档,自己又有空闲时间,且在研究量化对冲系统,就发点时间,做一下翻译。 4 | 原文地址: [TA-LIB document](https://mrjbq7.github.io/ta-lib/) 5 | 翻译地址: 6 | 7 | 这是一个Python 金融指数处理库[TA-LIB](http://ta-lib.org),他是基于 Cython 8 | 而不是 SWIG。 9 | 10 | > TA-Lib is widely used by trading software developers requiring to perform 11 | > technical analysis of financial market data. 12 | > TA-Lib广泛应用与交易软件,和金融市场数据进行技术分析。 13 | 14 | > * Includes 150+ indicators such as ADX, MACD, RSI, Stochastic, Bollinger 15 | > Bands, etc. 16 | > * Candlestick pattern recognition 17 | > * Open-source API for C/C++, Java, Perl, Python and 100% Managed .NET 18 | > * 包含了150多个指标,包括:ADX, MACD, RSI, Stochastic, Bollinger Bands, 等. 19 | > * K线形态识别 20 | > * 完全开源,支持 C/C++, Java, Perl, Python and 100% Managed .NET 21 | 22 | 23 | 24 | #### 安装TA-Lib 25 | 26 | ## 案例(快速开始) 27 | 28 | Similar to TA-Lib, the function interface provides a lightweight wrapper of 29 | the exposed TA-Lib indicators. 30 | 类似于TA-Lib,函数接口提供了一个暴露TA-Lib指标的轻量级封装。 31 | 32 | Each function returns an output array and have default values for their 33 | parameters, unless specified as keyword arguments. Typically, these functions 34 | will have an initial "lookback" period (a required number of observations 35 | before an output is generated) set to ``NaN``. 36 | 每个函数都默认需要输入数组,并为它们提供默认值。 37 | 参数,除非指定为关键字参数。通常,这些函数 38 | 会有一个初步的“lookback”时期(观测所需数量 39 | 在生成一个输出之前),设置为“NaN”。 40 | 41 | All of the following examples use the function API: 42 | 所有的API函数的使用,都需引入库文件: 43 | 44 | ```python 45 | import numpy 46 | import talib 47 | 48 | close = numpy.random.random(100) 49 | ``` 50 | 51 | 计算收盘价的一个简单移动平均数SMA: 52 | 53 | ```python 54 | output = talib.SMA(close) 55 | ``` 56 | 57 | 计算布林线,三指数移动平均: 58 | 59 | ```python 60 | from talib import MA_Type 61 | 62 | upper, middle, lower = talib.BBANDS(close, matype=MA_Type.T3) 63 | ``` 64 | 65 | 计算收盘价的动量,时间为5: 66 | 67 | ```python 68 | output = talib.MOM(close, timeperiod=5) 69 | ``` 70 | 71 | ## Abstract API Quick Start 抽象 API 快速入门 72 | 73 | If you're already familiar with using the function API, you should feel right 74 | at home using the abstract API. Every function takes the same input, passed 75 | as a dictionary of Numpy arrays: 76 | 如果您已经熟悉使用函数API,那么您就应该精通使用抽象API。 77 | 每个函数有相同的输入,作为一个字典通过NumPy数组: 78 | 79 | ```python 80 | import numpy as np 81 | # note that all ndarrays must be the same length! 82 | inputs = { 83 | 'open': np.random.random(100), 84 | 'high': np.random.random(100), 85 | 'low': np.random.random(100), 86 | 'close': np.random.random(100), 87 | 'volume': np.random.random(100) 88 | } 89 | ``` 90 | 函数可以直接导入,也可以用名称实例化: 91 | 92 | ```python 93 | from talib import abstract 94 | sma = abstract.SMA 95 | sma = abstract.Function('sma') 96 | ``` 97 | 98 | 调用函数基本上与函数API相同: 99 | 100 | ```python 101 | from talib.abstract import * 102 | output = SMA(input_arrays, timeperiod=25) # SMA均线价格计算收盘价 103 | output = SMA(input_arrays, timeperiod=25, price='open') # SMA均线价格计算收盘价 104 | upper, middle, lower = BBANDS(input_arrays, 20, 2, 2) 105 | slowk, slowd = STOCH(input_arrays, 5, 3, 0, 3, 0) # uses high, low, close by default 106 | slowk, slowd = STOCH(input_arrays, 5, 3, 0, 3, 0, prices=['high', 'low', 'open']) 107 | ``` 108 | 109 | 了解更多高级使用TA库 [here](). 110 | 111 | ## Supported Indicators 支持的指标 112 | 113 | We can show all the TA functions supported by TA-Lib, either as a ``list`` or 114 | as a ``dict`` sorted by group (e.g. "Overlap Studies", "Momentum Indicators", 115 | etc): 116 | 我们可以显示Ta lib的所有TA函数,返回一个 ``list`` 或者 ``dict`` 117 | 118 | ```python 119 | import talib 120 | 121 | print talib.get_functions() 122 | print talib.get_function_groups() 123 | ``` 124 | 125 | ### Function Groups 126 | 127 | * [Overlap Studies 重叠研究](func_groups/overlap_studies.md) 128 | * [Momentum Indicators 动量指标](func_groups/momentum_indicators.md) 129 | * [Volume Indicators 成交量指标](func_groups/volume_indicators.md) 130 | * [Volatility Indicators 波动性指标](func_groups/volatility_indicators.md) 131 | * [Price Transform 价格指标](func_groups/price_transform.md) 132 | * [Cycle Indicators 周期指标](func_groups/cycle_indicators.md) 133 | * [Pattern Recognition 形态识别](func_groups/pattern_recognition.md) 134 | * [Statistic Functions 统计函数](func_groups/statistic_functions.md) 135 | * [Math Transform 数学变换](func_groups/math_transform.md) 136 | * [Math Operators 数学运算符](func_groups/math_operators.md) 137 | 138 | 139 | #### [Overlap Studies](func_groups/overlap_studies.md) 140 | 141 | ``` 142 | BBANDS Bollinger Bands #布林带 143 | DEMA Double Exponential Moving Average #双指数移动平均线 144 | EMA Exponential Moving Average #指数滑动平均 145 | HT_TRENDLINE Hilbert Transform - Instantaneous Trendline #希尔伯特变换瞬时趋势 146 | KAMA Kaufman Adaptive Moving Average #卡玛考夫曼自适应移动平均 147 | MA Moving average #均线 148 | MAMA MESA Adaptive Moving Average #自适应移动平均 149 | MAVP Moving average with variable period #变周期移动平均 150 | MIDPOINT MidPoint over period #在周期的中点 151 | MIDPRICE Midpoint Price over period #中间时段价格 152 | SAR Parabolic SAR #抛物线转向指标 153 | SAREXT Parabolic SAR - Extended #抛物线转向指标 - 扩展 154 | SMA Simple Moving Average# 简单移动平均线 155 | T3 Triple Exponential Moving Average (T3) 156 | TEMA Triple Exponential Moving Average#三次指数移动平均 157 | TRIMA Triangular Moving Average# 三角形移动平均 158 | WMA Weighted Moving Average#加权移动平均线 159 | ``` 160 | 161 | #### [Momentum Indicators](func_groups/momentum_indicators.md) 162 | 163 | ``` 164 | ADX Average Directional Movement Index 165 | ADXR Average Directional Movement Index Rating 166 | APO Absolute Price Oscillator 167 | AROON Aroon 168 | AROONOSC Aroon Oscillator 169 | BOP Balance Of Power 170 | CCI Commodity Channel Index 171 | CMO Chande Momentum Oscillator 172 | DX Directional Movement Index 173 | MACD Moving Average Convergence/Divergence 174 | MACDEXT MACD with controllable MA type 175 | MACDFIX Moving Average Convergence/Divergence Fix 12/26 176 | MFI Money Flow Index 177 | MINUS_DI Minus Directional Indicator 178 | MINUS_DM Minus Directional Movement 179 | MOM Momentum 180 | PLUS_DI Plus Directional Indicator 181 | PLUS_DM Plus Directional Movement 182 | PPO Percentage Price Oscillator 183 | ROC Rate of change : ((price/prevPrice)-1)*100 184 | ROCP Rate of change Percentage: (price-prevPrice)/prevPrice 185 | ROCR Rate of change ratio: (price/prevPrice) 186 | ROCR100 Rate of change ratio 100 scale: (price/prevPrice)*100 187 | RSI Relative Strength Index 188 | STOCH Stochastic 189 | STOCHF Stochastic Fast 190 | STOCHRSI Stochastic Relative Strength Index 191 | TRIX 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA 192 | ULTOSC Ultimate Oscillator 193 | WILLR Williams' %R 194 | ``` 195 | 196 | #### [Volume Indicators](func_groups/volume_indicators.html) 197 | 198 | ``` 199 | AD Chaikin A/D Line 200 | ADOSC Chaikin A/D Oscillator 201 | OBV On Balance Volume 202 | ``` 203 | 204 | #### [Volatility Indicators](func_groups/volatility_indicators.html) 205 | 206 | ``` 207 | ATR Average True Range 208 | NATR Normalized Average True Range 209 | TRANGE True Range 210 | ``` 211 | 212 | #### [Price Transform](func_groups/price_transform.html) 213 | 214 | ``` 215 | AVGPRICE Average Price 216 | MEDPRICE Median Price 217 | TYPPRICE Typical Price 218 | WCLPRICE Weighted Close Price 219 | ``` 220 | 221 | #### [Cycle Indicators](func_groups/cycle_indicators.html) 222 | 223 | ``` 224 | HT_DCPERIOD Hilbert Transform - Dominant Cycle Period 225 | HT_DCPHASE Hilbert Transform - Dominant Cycle Phase 226 | HT_PHASOR Hilbert Transform - Phasor Components 227 | HT_SINE Hilbert Transform - SineWave 228 | HT_TRENDMODE Hilbert Transform - Trend vs Cycle Mode 229 | ``` 230 | 231 | #### [Pattern Recognition](func_groups/pattern_recognition.html) 232 | 233 | ``` 234 | CDL2CROWS Two Crows 235 | CDL3BLACKCROWS Three Black Crows 236 | CDL3INSIDE Three Inside Up/Down 237 | CDL3LINESTRIKE Three-Line Strike 238 | CDL3OUTSIDE Three Outside Up/Down 239 | CDL3STARSINSOUTH Three Stars In The South 240 | CDL3WHITESOLDIERS Three Advancing White Soldiers 241 | CDLABANDONEDBABY Abandoned Baby 242 | CDLADVANCEBLOCK Advance Block 243 | CDLBELTHOLD Belt-hold 244 | CDLBREAKAWAY Breakaway 245 | CDLCLOSINGMARUBOZU Closing Marubozu 246 | CDLCONCEALBABYSWALL Concealing Baby Swallow 247 | CDLCOUNTERATTACK Counterattack 248 | CDLDARKCLOUDCOVER Dark Cloud Cover 249 | CDLDOJI Doji 250 | CDLDOJISTAR Doji Star 251 | CDLDRAGONFLYDOJI Dragonfly Doji 252 | CDLENGULFING Engulfing Pattern 253 | CDLEVENINGDOJISTAR Evening Doji Star 254 | CDLEVENINGSTAR Evening Star 255 | CDLGAPSIDESIDEWHITE Up/Down-gap side-by-side white lines 256 | CDLGRAVESTONEDOJI Gravestone Doji 257 | CDLHAMMER Hammer 258 | CDLHANGINGMAN Hanging Man 259 | CDLHARAMI Harami Pattern 260 | CDLHARAMICROSS Harami Cross Pattern 261 | CDLHIGHWAVE High-Wave Candle 262 | CDLHIKKAKE Hikkake Pattern 263 | CDLHIKKAKEMOD Modified Hikkake Pattern 264 | CDLHOMINGPIGEON Homing Pigeon 265 | CDLIDENTICAL3CROWS Identical Three Crows 266 | CDLINNECK In-Neck Pattern 267 | CDLINVERTEDHAMMER Inverted Hammer 268 | CDLKICKING Kicking 269 | CDLKICKINGBYLENGTH Kicking - bull/bear determined by the longer marubozu 270 | CDLLADDERBOTTOM Ladder Bottom 271 | CDLLONGLEGGEDDOJI Long Legged Doji 272 | CDLLONGLINE Long Line Candle 273 | CDLMARUBOZU Marubozu 274 | CDLMATCHINGLOW Matching Low 275 | CDLMATHOLD Mat Hold 276 | CDLMORNINGDOJISTAR Morning Doji Star 277 | CDLMORNINGSTAR Morning Star 278 | CDLONNECK On-Neck Pattern 279 | CDLPIERCING Piercing Pattern 280 | CDLRICKSHAWMAN Rickshaw Man 281 | CDLRISEFALL3METHODS Rising/Falling Three Methods 282 | CDLSEPARATINGLINES Separating Lines 283 | CDLSHOOTINGSTAR Shooting Star 284 | CDLSHORTLINE Short Line Candle 285 | CDLSPINNINGTOP Spinning Top 286 | CDLSTALLEDPATTERN Stalled Pattern 287 | CDLSTICKSANDWICH Stick Sandwich 288 | CDLTAKURI Takuri (Dragonfly Doji with very long lower shadow) 289 | CDLTASUKIGAP Tasuki Gap 290 | CDLTHRUSTING Thrusting Pattern 291 | CDLTRISTAR Tristar Pattern 292 | CDLUNIQUE3RIVER Unique 3 River 293 | CDLUPSIDEGAP2CROWS Upside Gap Two Crows 294 | CDLXSIDEGAP3METHODS Upside/Downside Gap Three Methods 295 | ``` 296 | 297 | #### [Statistic Functions](func_groups/statistic_functions.html) 298 | 299 | ``` 300 | BETA Beta 301 | CORREL Pearson's Correlation Coefficient (r) 302 | LINEARREG Linear Regression 303 | LINEARREG_ANGLE Linear Regression Angle 304 | LINEARREG_INTERCEPT Linear Regression Intercept 305 | LINEARREG_SLOPE Linear Regression Slope 306 | STDDEV Standard Deviation 307 | TSF Time Series Forecast 308 | VAR Variance 309 | ``` 310 | 311 | 我想成为一名依靠乞讨的程序员。 312 | 313 | ![164938069.png](https://upload-images.jianshu.io/upload_images/6167081-bd931bef186e212e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 314 | -------------------------------------------------------------------------------- /abstract.md: -------------------------------------------------------------------------------- 1 | # 抽象API快速开始 2 | 3 | 如果您已经熟悉使用函数API,那么您就应该在精通使用抽象API。 4 | 每个函数有相同的输入,作为一个字典通过NumPy数组: 5 | 6 | ```python 7 | import numpy as np 8 | #请注意,所有的ndarrays必须是相同的长度! 9 | inputs = { 10 | 'open': np.random.random(100), 11 | 'high': np.random.random(100), 12 | 'low': np.random.random(100), 13 | 'close': np.random.random(100), 14 | 'volume': np.random.random(100) 15 | } 16 | ``` 17 | 18 | 函数可以直接导入,也可以用名称实例化: 19 | 20 | ```python 21 | from talib import abstract 22 | sma = abstract.SMA 23 | sma = abstract.Function('sma') 24 | ``` 25 | 调用函数基本上与函数API相同: 26 | 27 | ```python 28 | from talib.abstract import * 29 | output = SMA(input_arrays, timeperiod=25) # calculate on close prices by default 30 | output = SMA(input_arrays, timeperiod=25, price='open') # calculate on opens 31 | upper, middle, lower = BBANDS(input_arrays, 20, 2, 2) 32 | slowk, slowd = STOCH(input_arrays, 5, 3, 0, 3, 0) # uses high, low, close by default 33 | slowk, slowd = STOCH(input_arrays, 5, 3, 0, 3, 0, prices=['high', 'low', 'open']) 34 | ``` 35 | 36 | ## 高级用法 37 | 38 | For more advanced use cases of TA-Lib, the Abstract API also offers much more 39 | flexibility. You can even subclass ``abstract.Function`` and override 40 | ``set_input_arrays`` to customize the type of input data Function accepts 41 | (e.g. a pandas DataFrame). 42 | 对于更高级的TA库用例,抽象API也提供了更大的灵活性。 43 | 你甚至可以子类``abstract.Function``和覆盖`` set_input_arrays``自定义类型的输入数据的函数接受 44 | (e.g. a pandas DataFrame). 45 | 46 | Details about every function can be accessed via the info property: 47 | 有关每个功能的详细信息可以通过信息属性访问: 48 | 49 | ```python 50 | print Function('stoch').info 51 | { 52 | 'name': 'STOCH', 53 | 'display_name': 'Stochastic', 54 | 'group': 'Momentum Indicators', 55 | 'input_names': OrderedDict([ 56 | ('prices', ['high', 'low', 'close']), 57 | ]), 58 | 'parameters': OrderedDict([ 59 | ('fastk_period', 5), 60 | ('slowk_period', 3), 61 | ('slowk_matype', 0), 62 | ('slowd_period', 3), 63 | ('slowd_matype', 0), 64 | ]), 65 | 'output_names': ['slowk', 'slowd'], 66 | } 67 | 68 | ``` 69 | 或者是可读的格式: 70 | ```python 71 | help(STOCH) 72 | str(STOCH) 73 | ``` 74 | 75 | 其他有用属性 ``Function``: 76 | 77 | ```python 78 | Function('x').function_flags 79 | Function('x').input_names 80 | Function('x').input_arrays 81 | Function('x').parameters 82 | Function('x').lookback 83 | Function('x').output_names 84 | Function('x').output_flags 85 | Function('x').outputs 86 | ``` 87 | 88 | Aside from calling the function directly, Functions maintain state and will 89 | remember their parameters/input_arrays after they've been set. You can set 90 | parameters and recalculate with new input data using run(): 91 | 除了直接调用函数,函数还可以保持状态,已经记住他们的 参数/数组 92 | 你可以设置参数,重新计算使用run()新输入数据 93 | ```python 94 | SMA.parameters = {'timeperiod': 15} 95 | result1 = SMA.run(input_arrays1) 96 | result2 = SMA.run(input_arrays2) 97 | 98 | # Or set input_arrays and change the parameters: 99 | SMA.input_arrays = input_arrays1 100 | ma10 = SMA(timeperiod=10) 101 | ma20 = SMA(20) 102 | ``` 103 | 104 | 105 | 欲了解更多详情,请看 [code](https://github.com/mrjbq7/ta-lib/blob/master/talib/abstract.pyx#L46). 106 | 107 | [文档](doc_index.md) 108 | -------------------------------------------------------------------------------- /doc_index.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | * [安装和问题](install.md) 4 | * [快速使用](func.md) 5 | * [高级应用](abstract.md) 6 | * [方法分类](funcs.md) 7 | * [Overlap Studies 重叠的指标](func_groups/overlap_studies.md) 8 | * [Momentum Indicators 动量指标](func_groups/momentum_indicators.md) 9 | * [Volume Indicators 量指标](func_groups/volume_indicators.md) 10 | * [Volatility Indicators 波动性指标](func_groups/volatility_indicators.md) 11 | * [Price Transform 价格指标](func_groups/price_transform.md) 12 | * [Cycle Indicators 周期指标](func_groups/cycle_indicators.md) 13 | * [Pattern Recognition 形态识别](func_groups/pattern_recognition.md) 14 | * [Statistic Functions 统计功能](func_groups/statistic_functions.md) 15 | * [Math Transform 数学变换](func_groups/math_transform.md) 16 | * [Math Operators 数学运算符](func_groups/math_operators.md) 17 | -------------------------------------------------------------------------------- /func.md: -------------------------------------------------------------------------------- 1 | # Function API Examples 2 | 3 | Similar to TA-Lib, the function interface provides a lightweight wrapper of 4 | the exposed TA-Lib indicators. 5 | 类似于TA库,对函数接口进行了一个轻量级的封装,用于公开的ta-lib的指标。 6 | 7 | Each function returns an output array and have default values for their 8 | parameters, unless specified as keyword arguments. Typically, these functions 9 | will have an initial "lookback" period (a required number of observations 10 | before an output is generated) set to ``NaN``. 11 | 每个函数都默认需要输入数组,并为它们提供默认值。 参数,除非指定为关键字参数。通常,这些函数 会有一个初步的“lookback”时期(观测所需数量 在生成一个输出之前),设置为“NaN”。 12 | 13 | 14 | All of the following examples use the function API: 15 | 所有的API函数的使用,都需引入库文件: 16 | 17 | ```python 18 | import numpy 19 | import talib 20 | 21 | close = numpy.random.random(100) 22 | ``` 23 | 24 | 计算收盘价的一个简单移动平均数SMA: 25 | 26 | ```python 27 | output = talib.SMA(close) 28 | ``` 29 | 30 | 计算布林线,三指数移动平均: 31 | 32 | ```python 33 | from talib import MA_Type 34 | 35 | upper, middle, lower = talib.BBANDS(close, matype=MA_Type.T3) 36 | ``` 37 | 38 | 计算收盘价的动量,时间为5: 39 | 40 | ```python 41 | output = talib.MOM(close, timeperiod=5) 42 | ``` 43 | 44 | 45 | 方法类型分组: 46 | 47 | * [Overlap Studies](func_groups/overlap_studies.md) 48 | * [Momentum Indicators](func_groups/momentum_indicators.md) 49 | * [Volume Indicators](func_groups/volume_indicators.md) 50 | * [Volatility Indicators](func_groups/volatility_indicators.md) 51 | * [Pattern Recognition](func_groups/pattern_recognition.md) 52 | * [Cycle Indicators](func_groups/cycle_indicators.md) 53 | * [Statistic Functions](func_groups/statistic_functions.md) 54 | * [Price Transform](func_groups/price_transform.md) 55 | * [Math Transform](func_groups/math_transform.md) 56 | * [Math Operators](func_groups/math_operators.md) 57 | 58 | [文档](doc_index.md) 59 | [下一章: Using the Abstract API](abstract.md) 60 | -------------------------------------------------------------------------------- /func_groups/cycle_indicators.md: -------------------------------------------------------------------------------- 1 | # Cycle Indicator Functions 2 | > 不是很懂,欢迎指教 3 | ### HT_DCPERIOD - Hilbert Transform - Dominant Cycle Period 4 | > 函数名:HT_DCPERIOD 5 | 名称: 希尔伯特变换-主导周期 6 | 简介:将价格作为信息信号,计算价格处在的周期的位置,作为择时的依据。 7 | 8 | [文库文档](https://wenku.baidu.com/view/0e35f6eead51f01dc281f18e.md) 9 | 10 | NOTE: The ``HT_DCPERIOD`` function has an unstable period. 11 | ```python 12 | real = HT_DCPERIOD(close) 13 | ``` 14 | 15 | Learn more about the Hilbert Transform - Dominant Cycle Period at [tadoc.org](http://www.tadoc.org/indicator/HT_DCPERIOD.htm). 16 | ### HT_DCPHASE - Hilbert Transform - Dominant Cycle Phase 17 | 18 | > 函数名:HT_DCPHASE 19 | 名称: 希尔伯特变换-主导循环阶段 20 | 21 | 22 | NOTE: The ``HT_DCPHASE`` function has an unstable period. 23 | ```python 24 | real = HT_DCPHASE(close) 25 | ``` 26 | 27 | Learn more about the Hilbert Transform - Dominant Cycle Phase at [tadoc.org](http://www.tadoc.org/indicator/HT_DCPHASE.htm). 28 | ### HT_PHASOR - Hilbert Transform - Phasor Components 29 | > 函数名:HT_DCPHASE 30 | 名称: 希尔伯特变换-希尔伯特变换相量分量 31 | 32 | NOTE: The ``HT_PHASOR`` function has an unstable period. 33 | ```python 34 | inphase, quadrature = HT_PHASOR(close) 35 | ``` 36 | 37 | Learn more about the Hilbert Transform - Phasor Components at [tadoc.org](http://www.tadoc.org/indicator/HT_PHASOR.htm). 38 | ### HT_SINE - Hilbert Transform - SineWave 39 | 40 | > 函数名:HT_DCPHASE 41 | 名称: 希尔伯特变换-正弦波 42 | NOTE: The ``HT_SINE`` function has an unstable period. 43 | ```python 44 | sine, leadsine = HT_SINE(close) 45 | ``` 46 | 47 | Learn more about the Hilbert Transform - SineWave at [tadoc.org](http://www.tadoc.org/indicator/HT_SINE.htm). 48 | 49 | ### HT_TRENDMODE - Hilbert Transform - Trend vs Cycle Mode 50 | 51 | > 函数名:HT_DCPHASE 52 | 名称: 希尔伯特变换-趋势与周期模式 53 | NOTE: The ``HT_TRENDMODE`` function has an unstable period. 54 | 55 | ```python 56 | integer = HT_TRENDMODE(close) 57 | ``` 58 | 59 | Learn more about the Hilbert Transform - Trend vs Cycle Mode at [tadoc.org](http://www.tadoc.org/indicator/HT_TRENDMODE.htm). 60 | 61 | [文档](../doc_index.md) 62 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 63 | -------------------------------------------------------------------------------- /func_groups/math_operators.md: -------------------------------------------------------------------------------- 1 | # Math Operator Functions 2 | >数学运算符函数 3 | ### ADD - Vector Arithmetic Add 4 | > 函数名:ADD 5 | 名称:向量加法运算 6 | 7 | ```python 8 | real = ADD(high, low) 9 | ``` 10 | 11 | ### DIV - Vector Arithmetic Div 12 | > 函数名:DIV 13 | 名称:向量除法运算 14 | ```python 15 | real = DIV(high, low) 16 | ``` 17 | 18 | ### MAX - Highest value over a specified period 19 | > 函数名:MAX 20 | 名称:周期内最大值(未满足周期返回nan) 21 | ```python 22 | real = MAX(close, timeperiod=30) 23 | ``` 24 | 25 | ### MAXINDEX - Index of highest value over a specified period 26 | > 函数名:MAXINDEX 27 | 名称:周期内最大值的索引 28 | ```python 29 | integer = MAXINDEX(close, timeperiod=30) 30 | ``` 31 | 32 | ### MIN - Lowest value over a specified period 33 | > 函数名:MIN 34 | 名称:周期内最小值 (未满足周期返回nan) 35 | ```python 36 | real = MIN(close, timeperiod=30) 37 | ``` 38 | 39 | ### MININDEX - Index of lowest value over a specified period 40 | > 函数名:MININDEX 41 | 名称:周期内最小值的索引 42 | ```python 43 | integer = MININDEX(close, timeperiod=30) 44 | ``` 45 | 46 | ### MINMAX - Lowest and highest values over a specified period 47 | > 函数名:MINMAX 48 | 名称:周期内最小值和最大值(返回元组````元组(array【最小】,array【最大】)```) 49 | ```python 50 | min, max = MINMAX(close, timeperiod=30) 51 | ``` 52 | 53 | ### MINMAXINDEX - Indexes of lowest and highest values over a specified period 54 | > 函数名:MINMAX 55 | 名称:周期内最小值和最大值索引(返回元组````元组(array【最小】,array【最大】)```) 56 | ```python 57 | minidx, maxidx = MINMAXINDEX(close, timeperiod=30) 58 | ``` 59 | 60 | ### MULT - Vector Arithmetic Mult 61 | > 函数名:MULT 62 | 名称:向量乘法运算 63 | ```python 64 | real = MULT(high, low) 65 | ``` 66 | 67 | ### SUB - Vector Arithmetic Substraction 68 | > 函数名:SUB 69 | 名称:向量减法运算 70 | ```python 71 | real = SUB(high, low) 72 | ``` 73 | ### SUM - Summation 74 | > 函数名:SUM 75 | 名称:周期内求和 76 | ```python 77 | real = SUM(close, timeperiod=30) 78 | ``` 79 | 80 | 81 | [文档](../doc_index.md) 82 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 83 | -------------------------------------------------------------------------------- /func_groups/math_transform.md: -------------------------------------------------------------------------------- 1 | # Math Transform Functions 2 | ### ACOS - Vector Trigonometric ACos 3 | > 函数名:ACOS 4 | 名称:acos函数是反余弦函数,三角函数 5 | 6 | 7 | ```python 8 | real = ACOS(close) 9 | ``` 10 | 11 | ### ASIN - Vector Trigonometric ASin 12 | > 函数名:ASIN 13 | 名称:反正弦函数,三角函数 14 | 15 | ```python 16 | real = ASIN(close) 17 | ``` 18 | 19 | ### ATAN - Vector Trigonometric ATan 20 | > 函数名:ASIN 21 | 名称:数字的反正切值,三角函数 22 | 23 | ```python 24 | real = ATAN(close) 25 | ``` 26 | 27 | ### CEIL - Vector Ceil 28 | > 函数名:CEIL 29 | 简介:向上取整数 30 | 31 | ```python 32 | real = CEIL(close) 33 | ``` 34 | 35 | ### COS - Vector Trigonometric Cos 36 | > 函数名:COS 37 | 名称:余弦函数,三角函数 38 | ```python 39 | real = COS(close) 40 | ``` 41 | 42 | ### COSH - Vector Trigonometric Cosh 43 | > 函数名:COSH 44 | 名称:双曲正弦函数,三角函数 45 | ```python 46 | real = COSH(close) 47 | ``` 48 | 49 | ### EXP - Vector Arithmetic Exp 50 | > 函数名:EXP 51 | 名称:指数曲线,三角函数 52 | 53 | ```python 54 | real = EXP(close) 55 | ``` 56 | 57 | ### FLOOR - Vector Floor 58 | > 函数名:FLOOR 59 | 名称:向下取整数 60 | 61 | ```python 62 | real = FLOOR(close) 63 | ``` 64 | 65 | ### LN - Vector Log Natural 66 | > 函数名:LN 67 | 名称:自然对数 68 | 69 | ```python 70 | real = LN(close) 71 | ``` 72 | 73 | ### LOG10 - Vector Log10 74 | > 函数名:LOG10 75 | 名称:对数函数log 76 | 77 | ```python 78 | real = LOG10(close) 79 | ``` 80 | 81 | ### SIN - Vector Trigonometric Sin 82 | > 函数名:SIN 83 | 名称:正弦函数,三角函数 84 | ```python 85 | real = SIN(close) 86 | ``` 87 | 88 | ### SINH - Vector Trigonometric Sinh 89 | > 函数名:SINH 90 | 名称:双曲正弦函数,三角函数 91 | 92 | ```python 93 | real = SINH(close) 94 | ``` 95 | 96 | ### SQRT - Vector Square Root 97 | > 函数名:SQRT 98 | 名称:非负实数的平方根 99 | 100 | ```python 101 | real = SQRT(close) 102 | ``` 103 | 104 | ### TAN - Vector Trigonometric Tan 105 | > 函数名:TAN 106 | 名称:正切函数,三角函数 107 | ```python 108 | real = TAN(close) 109 | ``` 110 | 111 | ### TANH - Vector Trigonometric Tanh 112 | > 函数名:TANH 113 | 名称:双曲正切函数,三角函数 114 | ```python 115 | real = TANH(close) 116 | ``` 117 | 118 | 119 | [文档](../doc_index.md) 120 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 121 | -------------------------------------------------------------------------------- /func_groups/momentum_indicators.md: -------------------------------------------------------------------------------- 1 | # Momentum Indicator Functions 2 | ### ADX - Average Directional Movement Index 3 | > 函数名:ADX 4 | 名称:平均趋向指数 5 | 简介:使用ADX指标,指标判断盘整、振荡和单边趋势。 6 | #### 公式: 7 | 一、先决定股价趋势(Directional Movement,DM)是上涨或下跌: 8 | “所谓DM值,今日股价波动幅度大于昨日股价波动幅部分的最大值,可能是创高价的部分或创低价的部分;如果今日股价波动幅度较前一日小,则DM = 0。” 9 | 若股价高点持续走高,为上涨趋势,记作 +DM。 10 | 若为下跌趋势,记作 -DM。-DM的负号(–)是表示反向趋势(下跌),并非数值为负数。 11 | 其他状况:DM = 0。 12 | 二、寻找股价的真实波幅(True Range,TR): 13 | 所谓真实波幅(TR)是以最高价,最低价,及前一日收盘价三个价格做比较,求出当日股价波动的最大幅度。 14 | 三、趋势方向需经由一段时间来观察,研判上才有意义。一般以14天为指标的观察周期: 15 | 先计算出 +DM、–DM及TR的14日算术平均数,得到 +DM14、–DM14及TR14三组数据作为起始值,再计算各自的移动平均值(EMA)。 16 | ``` 17 | +DI14 = +DM/TR14*100 18 | -DI14 = +DM/TR14*100 19 | 20 | DX = |(+DI14)-(-DI14)| / |(+DI14)+(-DI14)| 21 | 22 | DX运算结果取其绝对值,再将DX作移动平均,得到ADX。 23 | ``` 24 | 25 | #### 特点: 26 | * ADX无法告诉你趋势的发展方向。 27 | * 如果趋势存在,ADX可以衡量趋势的强度。不论上升趋势或下降趋势,ADX看起来都一样。 28 | * ADX的读数越大,趋势越明显。衡量趋势强度时,需要比较几天的ADX 读数,观察ADX究竟是上升或下降。ADX读数上升,代表趋势转强;如果ADX读数下降,意味着趋势转弱。 29 | * 当ADX曲线向上攀升,趋势越来越强,应该会持续发展。如果ADX曲线下滑,代表趋势开始转弱,反转的可能性增加。 30 | * 单就ADX本身来说,由于指标落后价格走势,所以算不上是很好的指标,不适合单就ADX进行操作。可是,如果与其他指标配合运用,ADX可以确认市场是否存在趋势,并衡量趋势的强度。 31 | 32 | #### 指标应用: 33 | * +DI与–DI表示多空相反的二个动向,当据此绘出的两条曲线彼此纠结相缠时,代表上涨力道与下跌力道相当,多空势均力敌。当 +DI与–DI彼此穿越时,由下往上的一方其力道开始压过由上往下的另一方,此时出现买卖讯号。 34 | * ADX可作为趋势行情的判断依据,当行情明显朝多空任一方向进行时,ADX数值都会显著上升,趋势走强。若行情呈现盘整格局时,ADX会低于 +DI与–DI二条线。若ADX数值低于20,则不论DI表现如何,均显示市场没有明显趋势。 35 | * ADX持续偏高时,代表“超买”(Overbought)或“超卖”(Oversold)的现象,行情反转的机会将增加,此时则不适宜顺势操作。当ADX数值从上升趋势转为下跌时,则代表行情即将反转;若ADX数值由下跌趋势转为上升时,行情将止跌回升。 36 | * 总言之,DMI指标包含4条线:+DI、-DI、ADX和ADXR。+DI代表买盘的强度、-DI代表卖盘的强度;ADX代表趋势的强度、ADXR则为ADX的移动平均。 37 | 38 | NOTE: The ``ADX`` function has an unstable period. 39 | ```python 40 | real = ADX(high, low, close, timeperiod=14) 41 | ``` 42 | 43 | Learn more about the Average Directional Movement Index at [tadoc.org](http://www.tadoc.org/indicator/ADX.htm). 44 | ### ADXR- Average Directional Movement Index Rating 45 | > 函数名:ADXR 46 | 名称:平均趋向指数的趋向指数 47 | 简介:使用ADXR指标,指标判断ADX趋势。 48 | NOTE: The ``ADXR`` function has an unstable period. 49 | ```python 50 | real = ADXR(high, low, close, timeperiod=14) 51 | ``` 52 | 53 | Learn more about the Average Directional Movement Index Rating at [tadoc.org](http://www.tadoc.org/indicator/ADXR.htm). 54 | ### APO - Absolute Price Oscillator 55 | ```python 56 | real = APO(close, fastperiod=12, slowperiod=26, matype=0) 57 | ``` 58 | 59 | Learn more about the Absolute Price Oscillator at [tadoc.org](http://www.tadoc.org/indicator/APO.htm). 60 | ### AROON - Aroon 61 | > 函数名:AROON 62 | 名称:阿隆指标 63 | 简介:该指标是通过计算自价格达到近期最高值和最低值以来所经过的期间数,阿隆指标帮助你预测价格趋势到趋势区域(或者反过来,从趋势区域到趋势)的变化。 64 | #### 计算公式: 65 | ``` 66 | Aroon(上升)=[(计算期天数-最高价后的天数)/计算期天数]*100 67 | Aroon(下降)=[(计算期天数-最低价后的天数)/计算期天数]*100 68 | ``` 69 | #### 指数应用 70 | 1、极值0和100 71 | 当UP线达到100时,市场处于强势;如果维持在70~100之间,表示一个上升趋势。同样,如果Down线达到0,表示处于弱势,如果维持在0~30之间,表示处于下跌趋势。如果两条线同处于极值水平,则表明一个更强的趋势。 72 | 2、平行运动 73 | 如果两条线平行运动时,表明市场趋势被打破。可以预期该状况将持续下去,只到由极值水平或交叉穿行西安市出方向性运动为止。 74 | 3、交叉穿行 75 | 当下行线上穿上行线时,表明潜在弱势,预期价格开始趋于下跌。反之,表明潜在强势,预期价格趋于走高。 76 | 77 | ```python 78 | aroondown, aroonup = AROON(high, low, timeperiod=14) 79 | ``` 80 | 81 | Learn more about the Aroon at [tadoc.org](http://www.tadoc.org/indicator/AROON.htm). 82 | ### AROONOSC - Aroon Oscillator 83 | > 函数名:AROONOSC 84 | 名称:阿隆振荡 85 | 简介: 86 | ```python 87 | real = AROONOSC(high, low, timeperiod=14) 88 | ``` 89 | 90 | Learn more about the Aroon Oscillator at [tadoc.org](http://www.tadoc.org/indicator/AROONOSC.htm). 91 | ### BOP - Balance Of Power 均势 92 | > 函数名:BOP 93 | 名称:均势指标 94 | 简介 95 | ```python 96 | real = BOP(open, high, low, close) 97 | ``` 98 | 99 | Learn more about the Balance Of Power at [tadoc.org](http://www.tadoc.org/indicator/BOP.htm). 100 | ### CCI - Commodity Channel Index 101 | > 函数名:CCI 102 | 名称:顺势指标 103 | 简介:CCI指标专门测量股价是否已超出常态分布范围 104 | 105 | #### 指标应用 106 | * 1.当CCI指标曲线在+100线~-100线的常态区间里运行时,CCI指标参考意义不大,可以用KDJ等其它技术指标进行研判。 107 | * 2.当CCI指标曲线从上向下突破+100线而重新进入常态区间时,表明市场价格的上涨阶段可能结束,将进入一个比较长时间的震荡整理阶段,应及时平多做空。 108 | * 3.当CCI指标曲线从上向下突破-100线而进入另一个非常态区间(超卖区)时,表明市场价格的弱势状态已经形成,将进入一个比较长的寻底过程,可以持有空单等待更高利润。如果CCI指标曲线在超卖区运行了相当长的一段时间后开始掉头向上,表明价格的短期底部初步探明,可以少量建仓。CCI指标曲线在超卖区运行的时间越长,确认短期的底部的准确度越高。 109 | * 4.CCI指标曲线从下向上突破-100线而重新进入常态区间时,表明市场价格的探底阶段可能结束,有可能进入一个盘整阶段,可以逢低少量做多。 110 | * 5.CCI指标曲线从下向上突破+100线而进入非常态区间(超买区)时,表明市场价格已经脱离常态而进入强势状态,如果伴随较大的市场交投,应及时介入成功率将很大。 111 | * 6.CCI指标曲线从下向上突破+100线而进入非常态区间(超买区)后,只要CCI指标曲线一直朝上运行,表明价格依然保持强势可以继续持有待涨。但是,如果在远离+100线的地方开始掉头向下时,则表明市场价格的强势状态将可能难以维持,涨势可能转弱,应考虑卖出。如果前期的短期涨幅过高同时价格回落时交投活跃,则应该果断逢高卖出或做空。 112 | * CCI主要是在超买和超卖区域发生作用,对急涨急跌的行情检测性相对准确。非常适用于股票、外汇、贵金属等市场的短期操作。[1] 113 | 114 | ```python 115 | real = CCI(high, low, close, timeperiod=14) 116 | ``` 117 | 118 | Learn more about the Commodity Channel Index at [tadoc.org](http://www.tadoc.org/indicator/CCI.htm). 119 | ### CMO - Chande Momentum Oscillator 钱德动量摆动指标 120 | 121 | > 函数名:CMO 122 | 名称:钱德动量摆动指标 123 | 简介:与其他动量指标摆动指标如相对强弱指标(RSI)和随机指标(KDJ)不同,钱德动量指标在计算公式的分子中采用上涨日和下跌日的数据。 124 | 计算公式:CMO=(Su-Sd)*100/(Su+Sd) 125 | 其中:Su是今日收盘价与昨日收盘价(上涨日)差值加总。若当日下跌,则增加值为0;Sd是今日收盘价与做日收盘价(下跌日)差值的绝对值加总。若当日上涨,则增加值为0; 126 | 127 | 128 | #### 指标应用 129 | * 本指标类似RSI指标。 130 | * 当本指标下穿-50水平时是买入信号,上穿+50水平是卖出信号。 131 | * 钱德动量摆动指标的取值介于-100和100之间。 132 | * 本指标也能给出良好的背离信号。 133 | * 当股票价格创出新低而本指标未能创出新低时,出现牛市背离; 134 | * 当股票价格创出新高而本指标未能创出新高时,当出现熊市背离时。 135 | * 我们可以用移动均值对该指标进行平滑。 136 | 137 | NOTE: The ``CMO`` function has an unstable period. 138 | ```python 139 | real = CMO(close, timeperiod=14) 140 | ``` 141 | 142 | Learn more about the Chande Momentum Oscillator at [tadoc.org](http://www.tadoc.org/indicator/CMO.htm). 143 | ### DX - Directional Movement Index DMI指标又叫动向指标或趋向指标 144 | 145 | > 函数名:DX 146 | 名称:动向指标或趋向指标 147 | 简介:通过分析股票价格在涨跌过程中买卖双方力量均衡点的变化情况,即多空双方的力量的变化受价格波动的影响而发生由均衡到失衡的循环过程,从而提供对趋势判断依据的一种技术指标。 148 | 分析和应用:[百度百科](https://baike.baidu.com/item/DMI%E6%8C%87%E6%A0%87/3423254?fr=aladdin) 149 | [维基百科](https://zh.wikipedia.org/wiki/%E5%8B%95%E5%90%91%E6%8C%87%E6%95%B8) 150 | [同花顺学院](http://www.iwencai.com/school/search?cg=100&w=DMI) 151 | 152 | NOTE: The ``DX`` function has an unstable period. 153 | ```python 154 | real = DX(high, low, close, timeperiod=14) 155 | ``` 156 | 157 | Learn more about the Directional Movement Index at [tadoc.org](http://www.tadoc.org/indicator/DX.htm). 158 | ### MACD - Moving Average Convergence/Divergence 159 | > 函数名:MACD 160 | 名称:平滑异同移动平均线 161 | 简介:利用收盘价的短期(常用为12日)指数移动平均线与长期(常用为26日)指数移动平均线之间的聚合与分离状况,对买进、卖出时机作出研判的技术指标。 162 | 分析和应用:[百度百科](https://baike.baidu.com/item/MACD%E6%8C%87%E6%A0%87?fromtitle=MACD&fromid=3334786) 163 | [维基百科](https://zh.wikipedia.org/wiki/MACD) 164 | [同花顺学院](http://www.iwencai.com/school/search?cg=100&w=MACD) 165 | ```python 166 | dif, dem, histogram = MACD(close, fastperiod=12, slowperiod=26, signalperiod=9) 167 | ``` 168 | 169 | Learn more about the Moving Average Convergence/Divergence at [tadoc.org](http://www.tadoc.org/indicator/MACD.htm). 170 | ### MACDEXT - MACD with controllable MA type 171 | 172 | > 函数名:MACDEXT 173 | 名称:平滑异同移动平均线(可控制移动平均算法) 174 | 简介:同MACD函数(固定使用EMA作为matype),并提供参数控制计算DIF, DEM时使用的移动平均算法。计算DIF时使用fastmatype与slowmatype,计算DEM时使用signalmatype,`Histogram = DIF - DEM`。matype参数详见`talib.MA_Type`与`Overlap Studies Functions 重叠研究指标`文档。 175 | 分析和应用:[百度百科](https://baike.baidu.com/item/MACD%E6%8C%87%E6%A0%87?fromtitle=MACD&fromid=3334786) 176 | [维基百科](https://zh.wikipedia.org/wiki/MACD) 177 | [同花顺学院](http://www.iwencai.com/school/search?cg=100&w=MACD) 178 | ```python 179 | dif, dem, histogram = MACDEXT(close, fastperiod=12, fastmatype=0, slowperiod=26, slowmatype=0, signalperiod=9, signalmatype=0) 180 | ``` 181 | 182 | ### MACDFIX - Moving Average Convergence/Divergence Fix 12/26 183 | 184 | > 函数名:MFI 185 | 名称:平滑异同移动平均线(固定快慢均线周期为12/26) 186 | 简介:同MACD函数, 固定快均线周期fastperiod=12, 慢均线周期slowperiod=26. 187 | ```python 188 | dif, dem, histogram = MACDFIX(close, signalperiod=9) 189 | ``` 190 | 191 | ### MFI - Money Flow Index 资金流量指标 192 | 193 | > 函数名:MFI 194 | 名称:资金流量指标 195 | 简介:属于量价类指标,反映市场的运行趋势 196 | 分析和应用:[百度百科](https://baike.baidu.com/item/mfi/7429225?fr=aladdin) 197 | [同花顺学院](http://www.iwencai.com/school/search?cg=100&w=MFI) 198 | NOTE: The ``MFI`` function has an unstable period. 199 | ```python 200 | real = MFI(high, low, close, volume, timeperiod=14) 201 | ``` 202 | 203 | Learn more about the Money Flow Index at [tadoc.org](http://www.tadoc.org/indicator/MFI.htm). 204 | ### MINUS_DI - Minus Directional Indicator 205 | > 函数名:DMI 中的DI指标 负方向指标 206 | 名称:下升动向值 207 | 简介:通过分析股票价格在涨跌过程中买卖双方力量均衡点的变化情况,即多空双方的力量的变化受价格波动的影响而发生由均衡到失衡的循环过程,从而提供对趋势判断依据的一种技术指标。 208 | 分析和应用:[百度百科](https://baike.baidu.com/item/DMI%E6%8C%87%E6%A0%87/3423254?fr=aladdin) 209 | [维基百科](https://zh.wikipedia.org/wiki/%E5%8B%95%E5%90%91%E6%8C%87%E6%95%B8) 210 | [同花顺学院](http://www.iwencai.com/school/search?cg=100&w=DMI) 211 | NOTE: The ``MINUS_DI`` function has an unstable period. 212 | ```python 213 | real = MINUS_DI(high, low, close, timeperiod=14) 214 | ``` 215 | 216 | Learn more about the Minus Directional Indicator at [tadoc.org](http://www.tadoc.org/indicator/MINUS_DI.htm). 217 | ### MINUS_DM - Minus Directional Movement 218 | 219 | > 函数名:MINUS_DM 220 | 名称: 上升动向值 DMI中的DM代表正趋向变动值即上升动向值 221 | 简介:通过分析股票价格在涨跌过程中买卖双方力量均衡点的变化情况,即多空双方的力量的变化受价格波动的影响而发生由均衡到失衡的循环过程,从而提供对趋势判断依据的一种技术指标。 222 | 分析和应用:[百度百科](https://baike.baidu.com/item/DMI%E6%8C%87%E6%A0%87/3423254?fr=aladdin) 223 | [维基百科](https://zh.wikipedia.org/wiki/%E5%8B%95%E5%90%91%E6%8C%87%E6%95%B8) 224 | [同花顺学院](http://www.iwencai.com/school/search?cg=100&w=DMI) 225 | 226 | NOTE: The ``MINUS_DM`` function has an unstable period. 227 | ```python 228 | real = MINUS_DM(high, low, timeperiod=14) 229 | ``` 230 | 231 | Learn more about the Minus Directional Movement at [tadoc.org](http://www.tadoc.org/indicator/MINUS_DM.htm). 232 | ### MOM - Momentum 动量 233 | 234 | > 函数名:MOM 235 | 名称: 上升动向值 236 | 简介:投资学中意思为续航,指股票(或经济指数)持续增长的能力。研究发现,赢家组合在牛市中存在着正的动量效应,输家组合在熊市中存在着负的动量效应。 237 | 分析和应用: 238 | [维基百科](https://zh.wikipedia.org/wiki/%E5%8B%95%E9%87%8F%E6%8C%87%E6%A8%99) 239 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/cb18b2dbe2f455e6) 240 | 241 | ```python 242 | real = MOM(close, timeperiod=10) 243 | ``` 244 | 245 | Learn more about the Momentum at [tadoc.org](http://www.tadoc.org/indicator/MOM.htm). 246 | ### PLUS_DI - Plus Directional Indicator 247 | NOTE: The ``PLUS_DI`` function has an unstable period. 248 | ```python 249 | real = PLUS_DI(high, low, close, timeperiod=14) 250 | ``` 251 | 252 | Learn more about the Plus Directional Indicator at [tadoc.org](http://www.tadoc.org/indicator/PLUS_DI.htm). 253 | ### PLUS_DM - Plus Directional Movement 254 | NOTE: The ``PLUS_DM`` function has an unstable period. 255 | ```python 256 | real = PLUS_DM(high, low, timeperiod=14) 257 | ``` 258 | 259 | Learn more about the Plus Directional Movement at [tadoc.org](http://www.tadoc.org/indicator/PLUS_DM.htm). 260 | ### PPO - Percentage Price Oscillator 价格震荡百分比指数 261 | 262 | > 函数名:PPO 263 | 名称: 价格震荡百分比指数 264 | 简介:价格震荡百分比指标(PPO)是一个和MACD指标非常接近的指标。 265 | PPO标准设定和MACD设定非常相似:12,26,9和PPO,和MACD一样说明了两条移动平均线的差距,但是它们有一个差别是PPO是用百分比说明。 266 | 分析和应用: 267 | [参考](http://blog.sina.com.cn/s/blog_7542a31c0101aux9.html) 268 | 269 | ```python 270 | real = PPO(close, fastperiod=12, slowperiod=26, matype=0) 271 | ``` 272 | 273 | Learn more about the Percentage Price Oscillator at [tadoc.org](http://www.tadoc.org/indicator/PPO.htm). 274 | ### ROC - Rate of change : ((price/prevPrice)-1)*100 变动率指标 275 | 276 | > 函数名:ROC 277 | 名称: 变动率指标 278 | 简介:ROC是由当天的股价与一定的天数之前的某一天股价比较,其变动速度的大小,来反映股票市变动的快慢程度 279 | 分析和应用:[百度百科](https://baike.baidu.com/item/ROC%E6%8C%87%E6%A0%87/3081705?fr=aladdin) 280 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/6ac184fdb20d2f59) 281 | 282 | ```python 283 | real = ROC(close, timeperiod=10) 284 | ``` 285 | 286 | Learn more about the Rate of change : ((price/prevPrice)-1)*100 at [tadoc.org](http://www.tadoc.org/indicator/ROC.htm). 287 | ### ROCP - Rate of change Percentage: (price-prevPrice)/prevPrice 288 | ```python 289 | real = ROCP(close, timeperiod=10) 290 | ``` 291 | 292 | Learn more about the Rate of change Percentage: (price-prevPrice)/prevPrice at [tadoc.org](http://www.tadoc.org/indicator/ROCP.htm). 293 | ### ROCR - Rate of change ratio: (price/prevPrice) 294 | ```python 295 | real = ROCR(close, timeperiod=10) 296 | ``` 297 | 298 | Learn more about the Rate of change ratio: (price/prevPrice) at [tadoc.org](http://www.tadoc.org/indicator/ROCR.htm). 299 | ### ROCR100 - Rate of change ratio 100 scale: (price/prevPrice)*100 300 | ```python 301 | real = ROCR100(close, timeperiod=10) 302 | ``` 303 | 304 | Learn more about the Rate of change ratio 100 scale: (price/prevPrice)*100 at [tadoc.org](http://www.tadoc.org/indicator/ROCR100.htm). 305 | ### RSI - Relative Strength Index 相对强弱指数 306 | 307 | > 函数名:RSI 308 | 名称:相对强弱指数 309 | 简介:是通过比较一段时期内的平均收盘涨数和平均收盘跌数来分析市场买沽盘的意向和实力,从而作出未来市场的走势。 310 | 分析和应用:[百度百科](https://baike.baidu.com/item/RSI/6130115) 311 | [维基百科](https://zh.wikipedia.org/wiki/%E7%9B%B8%E5%B0%8D%E5%BC%B7%E5%BC%B1%E6%8C%87%E6%95%B8) 312 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/6a280c6cebcf140a) 313 | 314 | NOTE: The ``RSI`` function has an unstable period. 315 | ```python 316 | real = RSI(close, timeperiod=14) 317 | ``` 318 | 319 | Learn more about the Relative Strength Index at [tadoc.org](http://www.tadoc.org/indicator/RSI.htm). 320 | ### STOCH - Stochastic 随机指标,俗称KD 321 | 322 | > 函数名:STOCH 323 | 名称:随机指标,俗称KD 324 | ```python 325 | slowk, slowd = STOCH(high, low, close, fastk_period=5, slowk_period=3, slowk_matype=0, slowd_period=3, slowd_matype=0) 326 | ``` 327 | 328 | Learn more about the Stochastic at [tadoc.org](http://www.tadoc.org/indicator/STOCH.htm). 329 | ### STOCHF - Stochastic Fast 330 | ```python 331 | fastk, fastd = STOCHF(high, low, close, fastk_period=5, fastd_period=3, fastd_matype=0) 332 | ``` 333 | 334 | Learn more about the Stochastic Fast at [tadoc.org](http://www.tadoc.org/indicator/STOCHF.htm). 335 | ### STOCHRSI - Stochastic Relative Strength Index 336 | NOTE: The ``STOCHRSI`` function has an unstable period. 337 | ```python 338 | fastk, fastd = STOCHRSI(close, timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=0) 339 | ``` 340 | 341 | Learn more about the Stochastic Relative Strength Index at [tadoc.org](http://www.tadoc.org/indicator/STOCHRSI.htm). 342 | ### TRIX - 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA 343 | ```python 344 | real = TRIX(close, timeperiod=30) 345 | ``` 346 | 347 | Learn more about the 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA at [tadoc.org](http://www.tadoc.org/indicator/TRIX.htm). 348 | ### ULTOSC - Ultimate Oscillator 终极波动指标 349 | 350 | > 函数名:ULTOSC 351 | 名称:终极波动指标 352 | 简介:UOS是一种多方位功能的指标,除了趋势确认及超买超卖方面的作用之外,它的“突破”讯号不仅可以提供最适当的交易时机之外,更可以进一步加强指标的可靠度。 353 | 分析和应用:[百度百科](https://baike.baidu.com/item/%E7%BB%88%E6%9E%81%E6%B3%A2%E5%8A%A8%E6%8C%87%E6%A0%87/1982936?fr=aladdin&fromid=12610066&fromtitle=%E7%BB%88%E6%9E%81%E6%8C%87%E6%A0%87) 354 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/e89b98d39da975e4) 355 | 356 | ```python 357 | real = ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28) 358 | ``` 359 | 360 | Learn more about the Ultimate Oscillator at [tadoc.org](http://www.tadoc.org/indicator/ULTOSC.htm). 361 | ### WILLR - Williams' %R 威廉指标 362 | 363 | > 函数名:WILLR 364 | 名称:威廉指标 365 | 简介:WMS表示的是市场处于超买还是超卖状态。股票投资分析方法主要有如下三种:基本分析、技术分析、演化分析。在实际应用中,它们既相互联系,又有重要区别。 366 | 分析和应用:[百度百科](https://baike.baidu.com/item/%E5%A8%81%E5%BB%89%E6%8C%87%E6%A0%87?fr=aladdin) 367 | [维基百科](https://zh.wikipedia.org/wiki/%E5%A8%81%E5%BB%89%E6%8C%87%E6%A8%99) 368 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/967febb0316c57c1) 369 | 370 | ```python 371 | real = WILLR(high, low, close, timeperiod=14) 372 | ``` 373 | 374 | Learn more about the Williams' %R at [tadoc.org](http://www.tadoc.org/indicator/WILLR.htm). 375 | 376 | [Documentation Index](../doc_index.md) 377 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 378 | -------------------------------------------------------------------------------- /func_groups/overlap_studies.md: -------------------------------------------------------------------------------- 1 | # Overlap Studies Functions 重叠研究指标 2 | ### BBANDS - Bollinger Bands 3 | 4 | > 函数名:BBANDS 5 | 名称: 布林线指标 6 | 简介:其利用统计原理,求出股价的标准差及其信赖区间,从而确定股价的波动范围及未来走势,利用波带显示股价的安全高低价位,因而也被称为布林带。 7 | 分析和应用: 8 | [百度百科](https://baike.baidu.com/item/bollinger%20bands/1612394?fr=aladdin) 9 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/56d0d9be66b4f7a0?rid=53) 10 | 11 | ```python 12 | upperband, middleband, lowerband = BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0) 13 | ``` 14 | 15 | Learn more about the Bollinger Bands at [tadoc.org](http://www.tadoc.org/indicator/BBANDS.htm). 16 | ### DEMA - Double Exponential Moving Average 双移动平均线 17 | 18 | > 函数名:DEMA 19 | 名称: 双移动平均线 20 | 简介:两条移动平均线来产生趋势信号,较长期者用来识别趋势,较短期者用来选择时机。正是两条平均线及价格三者的相互作用,才共同产生了趋势信号。 21 | 分析和应用: 22 | [百度百科](https://baike.baidu.com/item/%E5%8F%8C%E7%A7%BB%E5%8A%A8%E5%B9%B3%E5%9D%87%E7%BA%BF/1831921?fr=aladdin) 23 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/a04d723659318237) 24 | 25 | ```python 26 | real = DEMA(close, timeperiod=30) 27 | ``` 28 | 29 | Learn more about the Double Exponential Moving Average at [tadoc.org](http://www.tadoc.org/indicator/DEMA.htm). 30 | ### EMA - Exponential Moving Average 31 | 32 | > 函数名:EMA 33 | 名称: 指数平均数 34 | 简介:是一种趋向类指标,其构造原理是仍然对价格收盘价进行算术平均,并根据计算结果来进行分析,用于判断价格未来走势的变动趋势。 35 | [百度百科](https://baike.baidu.com/item/EMA/12646151) 36 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/b7a39d74783ad689?rid=589) 37 | 38 | 39 | NOTE: The ``EMA`` function has an unstable period. 40 | ```python 41 | real = EMA(close, timeperiod=30) 42 | ``` 43 | 44 | Learn more about the Exponential Moving Average at [tadoc.org](http://www.tadoc.org/indicator/EMA.htm). 45 | ### HT_TRENDLINE - Hilbert Transform - Instantaneous Trendline 46 | NOTE: The ``HT_TRENDLINE`` function has an unstable period. 47 | 48 | > 函数名:HT_TRENDLINE 49 | 名称: 希尔伯特瞬时变换 50 | 简介:是一种趋向类指标,其构造原理是仍然对价格收盘价进行算术平均,并根据计算结果来进行分析,用于判断价格未来走势的变动趋势。 51 | [百度文库](https://wenku.baidu.com/view/0e35f6eead51f01dc281f18e.html) 52 | 53 | ```python 54 | real = HT_TRENDLINE(close) 55 | ``` 56 | 57 | Learn more about the Hilbert Transform - Instantaneous Trendline at [tadoc.org](http://www.tadoc.org/indicator/HT_TRENDLINE.htm). 58 | ### KAMA - Kaufman Adaptive Moving Average 考夫曼的自适应移动平均线 59 | 60 | > 函数名:KAMA 61 | 名称: 考夫曼的自适应移动平均线 62 | 简介:短期均线贴近价格走势,灵敏度高,但会有很多噪声,产生虚假信号;长期均线在判断趋势上一般比较准确 63 | ,但是长期均线有着严重滞后的问题。我们想得到这样的均线,当价格沿一个方向快速移动时,短期的移动 64 | 平均线是最合适的;当价格在横盘的过程中,长期移动平均线是合适的。 65 | [参考1](http://blog.sina.com.cn/s/blog_62d0bbc701010p7d.html) 66 | [参考2](https://wenku.baidu.com/view/bc4bc9c59ec3d5bbfd0a7454.html?from=search) 67 | 68 | NOTE: The ``KAMA`` function has an unstable period. 69 | ```python 70 | real = KAMA(close, timeperiod=30) 71 | ``` 72 | 73 | Learn more about the Kaufman Adaptive Moving Average at [tadoc.org](http://www.tadoc.org/indicator/KAMA.htm). 74 | ### MA - Moving average 移动平均线 75 | 76 | > 函数名:MA 77 | 名称: 移动平均线 78 | 简介:移动平均线,Moving Average,简称MA,原本的意思是移动平均,由于我们将其制作成线形,所以一般称之为移动平均线,简称均线。它是将某一段时间的收盘价之和除以该周期。 比如日线MA5指5天内的收盘价除以5 。 79 | [百度百科](https://baike.baidu.com/item/%E7%A7%BB%E5%8A%A8%E5%B9%B3%E5%9D%87%E7%BA%BF/217887?fromtitle=MA&fromid=1511750#viewPageContent) 80 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/a04d723659318237?rid=96) 81 | 82 | 83 | ```python 84 | real = MA(close, timeperiod=30, matype=0) 85 | ``` 86 | 87 | ### MAMA - MESA Adaptive Moving Average 88 | NOTE: The ``MAMA`` function has an unstable period. 89 | ```python 90 | mama, fama = MAMA(close, fastlimit=0, slowlimit=0) 91 | ``` 92 | 93 | Learn more about the MESA Adaptive Moving Average at [tadoc.org](http://www.tadoc.org/indicator/MAMA.htm). 94 | ### MAVP - Moving average with variable period 95 | ```python 96 | real = MAVP(close, periods, minperiod=2, maxperiod=30, matype=0) 97 | ``` 98 | 99 | ### MIDPOINT - MidPoint over period 100 | ```python 101 | real = MIDPOINT(close, timeperiod=14) 102 | ``` 103 | 104 | Learn more about the MidPoint over period at [tadoc.org](http://www.tadoc.org/indicator/MIDPOINT.htm). 105 | ### MIDPRICE - Midpoint Price over period 106 | ```python 107 | real = MIDPRICE(high, low, timeperiod=14) 108 | ``` 109 | 110 | Learn more about the Midpoint Price over period at [tadoc.org](http://www.tadoc.org/indicator/MIDPRICE.htm). 111 | ### SAR - Parabolic SAR 抛物线指标 112 | 113 | > 函数名:SAR 114 | 名称: 抛物线指标 115 | 简介:抛物线转向也称停损点转向,是利用抛物线方式,随时调整停损点位置以观察买卖点。由于停损点(又称转向点SAR)以弧形的方式移动,故称之为抛物线转向指标 。 116 | [百度百科](https://baike.baidu.com/item/SAR/2771135#viewPageContent) 117 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/d9d94e65be7f6b5e) 118 | 119 | 120 | ```python 121 | real = SAR(high, low, acceleration=0, maximum=0) 122 | ``` 123 | 124 | Learn more about the Parabolic SAR at [tadoc.org](http://www.tadoc.org/indicator/SAR.htm). 125 | ### SAREXT - Parabolic SAR - Extended 126 | ```python 127 | real = SAREXT(high, low, startvalue=0, offsetonreverse=0, accelerationinitlong=0, accelerationlong=0, accelerationmaxlong=0, accelerationinitshort=0, accelerationshort=0, accelerationmaxshort=0) 128 | ``` 129 | 130 | ### SMA - Simple Moving Average 简单移动平均线 131 | 132 | > 函数名:SMA 133 | 名称: 简单移动平均线 134 | 简介:移动平均线,Moving Average,简称MA,原本的意思是移动平均,由于我们将其制作成线形,所以一般称之为移动平均线,简称均线。它是将某一段时间的收盘价之和除以该周期。 比如日线MA5指5天内的收盘价除以5 。 135 | [百度百科](https://baike.baidu.com/item/%E7%A7%BB%E5%8A%A8%E5%B9%B3%E5%9D%87%E7%BA%BF/217887?fromtitle=MA&fromid=1511750#viewPageContent) 136 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/a04d723659318237?rid=96) 137 | 138 | 139 | ```python 140 | real = SMA(close, timeperiod=30) 141 | ``` 142 | 143 | Learn more about the Simple Moving Average at [tadoc.org](http://www.tadoc.org/indicator/SMA.htm). 144 | ### T3 - Triple Exponential Moving Average (T3) 三重指数移动平均线 145 | 146 | > 函数名:T3 147 | 名称:三重指数移动平均线 148 | 简介:TRIX长线操作时采用本指标的讯号,长时间按照本指标讯号交易,获利百分比大于损失百分比,利润相当可观。 比如日线MA5指5天内的收盘价除以5 。 149 | [百度百科](https://baike.baidu.com/item/%E4%B8%89%E9%87%8D%E6%8C%87%E6%95%B0%E5%B9%B3%E6%BB%91%E5%B9%B3%E5%9D%87%E7%BA%BF/15749345?fr=aladdin) 150 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/6c22c15ccbf24e64?rid=80) 151 | 152 | 153 | 154 | NOTE: The ``T3`` function has an unstable period. 155 | ```python 156 | real = T3(close, timeperiod=5, vfactor=0) 157 | ``` 158 | 159 | Learn more about the Triple Exponential Moving Average (T3) at [tadoc.org](http://www.tadoc.org/indicator/T3.htm). 160 | ### TEMA - Triple Exponential Moving Average 161 | 162 | > 函数名:TEMA(T3 区别?) 163 | 名称:三重指数移动平均线 164 | 165 | 166 | ```python 167 | real = TEMA(close, timeperiod=30) 168 | ``` 169 | 170 | Learn more about the Triple Exponential Moving Average at [tadoc.org](http://www.tadoc.org/indicator/TEMA.htm). 171 | ### TRIMA - Triangular Moving Average 172 | ```python 173 | real = TRIMA(close, timeperiod=30) 174 | ``` 175 | 176 | Learn more about the Triangular Moving Average at [tadoc.org](http://www.tadoc.org/indicator/TRIMA.htm). 177 | ### WMA - Weighted Moving Average 移动加权平均法 178 | 179 | > 函数名:WMA 180 | 名称:加权移动平均线 181 | 简介:移动加权平均法是指以每次进货的成本加上原有库存存货的成本,除以每次进货数量与原有库存存货的数量之和,据以计算加权平均单位成本,以此为基础计算当月发出存货的成本和期末存货的成本的一种方法。 182 | [百度百科](https://baike.baidu.com/item/%E7%A7%BB%E5%8A%A8%E5%8A%A0%E6%9D%83%E5%B9%B3%E5%9D%87%E6%B3%95/10056490?fr=aladdin&fromid=16799870&fromtitle=%E5%8A%A0%E6%9D%83%E7%A7%BB%E5%8A%A8%E5%B9%B3%E5%9D%87) 183 | [同花顺学院](http://www.iwencai.com/yike/detail/auid/262b1dfd1c68ee30) 184 | 185 | 186 | ```python 187 | real = WMA(close, timeperiod=30) 188 | ``` 189 | 190 | Learn more about the Weighted Moving Average at [tadoc.org](http://www.tadoc.org/indicator/WMA.htm). 191 | 192 | [Documentation Index](../doc_index.md) 193 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 194 | -------------------------------------------------------------------------------- /func_groups/pattern_recognition.md: -------------------------------------------------------------------------------- 1 | # Pattern Recognition Functions 形态识别 2 | 3 | ### CDL2CROWS - Two Crows 4 | > 函数名:CDL2CROWS 5 | 名称:Two Crows 两只乌鸦 6 | 简介:三日K线模式,第一天长阳,第二天高开收阴,第三天再次高开继续收阴, 7 | 收盘比前一日收盘价低,预示股价下跌。 8 | 9 | ```python 10 | integer = CDL2CROWS(open, high, low, close) 11 | ``` 12 | 13 | ### CDL3BLACKCROWS - Three Black Crows 14 | > 函数名:CDL3BLACKCROWS 15 | 名称:Three Black Crows 三只乌鸦 16 | 简介:三日K线模式,连续三根阴线,每日收盘价都下跌且接近最低价, 17 | 每日开盘价都在上根K线实体内,预示股价下跌。 18 | 19 | ```python 20 | integer = CDL3BLACKCROWS(open, high, low, close) 21 | ``` 22 | 23 | ### CDL3INSIDE - Three Inside Up/Down 24 | > 函数名:CDL3INSIDE 25 | 名称: Three Inside Up/Down 三内部上涨和下跌 26 | 简介:三日K线模式,母子信号+长K线,以三内部上涨为例,K线为阴阳阳, 27 | 第三天收盘价高于第一天开盘价,第二天K线在第一天K线内部,预示着股价上涨。 28 | 29 | ```python 30 | integer = CDL3INSIDE(open, high, low, close) 31 | ``` 32 | 33 | ### CDL3LINESTRIKE - Three-Line Strike 34 | > 函数名:CDL3LINESTRIKE 35 | 名称: Three-Line Strike 三线打击 36 | 简介:四日K线模式,前三根阳线,每日收盘价都比前一日高, 37 | 开盘价在前一日实体内,第四日市场高开,收盘价低于第一日开盘价,预示股价下跌。 38 | 39 | ```python 40 | integer = CDL3LINESTRIKE(open, high, low, close) 41 | ``` 42 | 43 | ### CDL3OUTSIDE - Three Outside Up/Down 44 | > 函数名:CDL3OUTSIDE 45 | 名称:Three Outside Up/Down 三外部上涨和下跌 46 | 简介:三日K线模式,与三内部上涨和下跌类似,K线为阴阳阳,但第一日与第二日的K线形态相反, 47 | 以三外部上涨为例,第一日K线在第二日K线内部,预示着股价上涨。 48 | 49 | ```python 50 | integer = CDL3OUTSIDE(open, high, low, close) 51 | ``` 52 | 53 | ### CDL3STARSINSOUTH - Three Stars In The South 54 | > 函数名:CDL3STARSINSOUTH 55 | 名称:Three Stars In The South 南方三星 56 | 简介:三日K线模式,与大敌当前相反,三日K线皆阴,第一日有长下影线, 57 | 第二日与第一日类似,K线整体小于第一日,第三日无下影线实体信号, 58 | 成交价格都在第一日振幅之内,预示下跌趋势反转,股价上升。 59 | 60 | ```python 61 | integer = CDL3STARSINSOUTH(open, high, low, close) 62 | ``` 63 | 64 | ### CDL3WHITESOLDIERS - Three Advancing White Soldiers 65 | > 函数名:CDL3WHITESOLDIERS 66 | 名称:Three Advancing White Soldiers 三个白兵 67 | 简介:三日K线模式,三日K线皆阳, 68 | 每日收盘价变高且接近最高价,开盘价在前一日实体上半部,预示股价上升。 69 | 70 | ```python 71 | integer = CDL3WHITESOLDIERS(open, high, low, close) 72 | ``` 73 | 74 | ### CDLABANDONEDBABY - Abandoned Baby 75 | > 函数名:CDLABANDONEDBABY 76 | 名称:Abandoned Baby 弃婴 77 | 简介:三日K线模式,第二日价格跳空且收十字星(开盘价与收盘价接近, 78 | 最高价最低价相差不大),预示趋势反转,发生在顶部下跌,底部上涨。 79 | 80 | ```python 81 | integer = CDLABANDONEDBABY(open, high, low, close, penetration=0) 82 | ``` 83 | 84 | ### CDLADVANCEBLOCK - Advance Block 85 | > 函数名:CDLADVANCEBLOCK 86 | 名称:Advance Block 大敌当前 87 | 简介:三日K线模式,三日都收阳,每日收盘价都比前一日高, 88 | 开盘价都在前一日实体以内,实体变短,上影线变长。 89 | 90 | ```python 91 | integer = CDLADVANCEBLOCK(open, high, low, close) 92 | ``` 93 | 94 | ### CDLBELTHOLD - Belt-hold 95 | > 函数名:CDLBELTHOLD 96 | 名称:Belt-hold 捉腰带线 97 | 简介:两日K线模式,下跌趋势中,第一日阴线, 98 | 第二日开盘价为最低价,阳线,收盘价接近最高价,预示价格上涨。 99 | 100 | ```python 101 | integer = CDLBELTHOLD(open, high, low, close) 102 | ``` 103 | 104 | ### CDLBREAKAWAY - Breakaway 105 | > 函数名:CDLBREAKAWAY 106 | 名称:Breakaway 脱离 107 | 简介:五日K线模式,以看涨脱离为例,下跌趋势中,第一日长阴线,第二日跳空阴线,延续趋势开始震荡, 108 | 第五日长阳线,收盘价在第一天收盘价与第二天开盘价之间,预示价格上涨。 109 | 110 | ```python 111 | integer = CDLBREAKAWAY(open, high, low, close) 112 | ``` 113 | 114 | ### CDLCLOSINGMARUBOZU - Closing Marubozu 115 | > 函数名:CDLCLOSINGMARUBOZU 116 | 名称:Closing Marubozu 收盘缺影线 117 | 简介:一日K线模式,以阳线为例,最低价低于开盘价,收盘价等于最高价, 118 | 预示着趋势持续。 119 | 120 | ```python 121 | integer = CDLCLOSINGMARUBOZU(open, high, low, close) 122 | ``` 123 | 124 | ### CDLCONCEALBABYSWALL - Concealing Baby Swallow 125 | > 函数名:CDLCONCEALBABYSWALL 126 | 名称: Concealing Baby Swallow 藏婴吞没 127 | 简介:四日K线模式,下跌趋势中,前两日阴线无影线 128 | ,第二日开盘、收盘价皆低于第二日,第三日倒锤头, 129 | 第四日开盘价高于前一日最高价,收盘价低于前一日最低价,预示着底部反转。 130 | 131 | ```python 132 | integer = CDLCONCEALBABYSWALL(open, high, low, close) 133 | ``` 134 | 135 | ### CDLCOUNTERATTACK - Counterattack 136 | > 函数名:CDLCOUNTERATTACK 137 | 名称:Counterattack 反击线 138 | 简介:二日K线模式,与分离线类似。 139 | 140 | ```python 141 | integer = CDLCOUNTERATTACK(open, high, low, close) 142 | ``` 143 | 144 | ### CDLDARKCLOUDCOVER - Dark Cloud Cover 145 | > 函数名:CDLDARKCLOUDCOVER 146 | 名称:Dark Cloud Cover 乌云压顶 147 | 简介:二日K线模式,第一日长阳,第二日开盘价高于前一日最高价, 148 | 收盘价处于前一日实体中部以下,预示着股价下跌。 149 | 150 | ```python 151 | integer = CDLDARKCLOUDCOVER(open, high, low, close, penetration=0) 152 | ``` 153 | 154 | ### CDLDOJI - Doji 155 | > 函数名:CDLDOJI 156 | 名称:Doji 十字 157 | 简介:一日K线模式,开盘价与收盘价基本相同。 158 | 159 | ```python 160 | integer = CDLDOJI(open, high, low, close) 161 | ``` 162 | 163 | ### CDLDOJISTAR - Doji Star 164 | > 函数名:CDLDOJISTAR 165 | 名称:Doji Star 十字星 166 | 简介:一日K线模式,开盘价与收盘价基本相同,上下影线不会很长,预示着当前趋势反转。 167 | 168 | ```python 169 | integer = CDLDOJISTAR(open, high, low, close) 170 | ``` 171 | 172 | ### CDLDRAGONFLYDOJI - Dragonfly Doji 173 | > 函数名:CDLDRAGONFLYDOJI 174 | 名称:Dragonfly Doji 蜻蜓十字/T形十字 175 | 简介:一日K线模式,开盘后价格一路走低, 176 | 之后收复,收盘价与开盘价相同,预示趋势反转。 177 | 178 | ```python 179 | integer = CDLDRAGONFLYDOJI(open, high, low, close) 180 | ``` 181 | 182 | ### CDLENGULFING - Engulfing Pattern 183 | > 函数名:CDLENGULFING 184 | 名称:Engulfing Pattern 吞噬模式 185 | 简介:两日K线模式,分多头吞噬和空头吞噬,以多头吞噬为例,第一日为阴线, 186 | 第二日阳线,第一日的开盘价和收盘价在第二日开盘价收盘价之内,但不能完全相同。 187 | 188 | ```python 189 | integer = CDLENGULFING(open, high, low, close) 190 | ``` 191 | 192 | ### CDLEVENINGDOJISTAR - Evening Doji Star 193 | > 函数名:CDLEVENINGDOJISTAR 194 | 名称:Evening Doji Star 十字暮星 195 | 简介:三日K线模式,基本模式为暮星,第二日收盘价和开盘价相同,预示顶部反转。 196 | 197 | ```python 198 | integer = CDLEVENINGDOJISTAR(open, high, low, close, penetration=0) 199 | ``` 200 | 201 | ### CDLEVENINGSTAR - Evening Star 202 | > 函数名:CDLEVENINGSTAR 203 | 名称:Evening Star 暮星 204 | 简介:三日K线模式,与晨星相反,上升趋势中, 205 | 第一日阳线,第二日价格振幅较小,第三日阴线,预示顶部反转。 206 | 207 | ```python 208 | integer = CDLEVENINGSTAR(open, high, low, close, penetration=0) 209 | ``` 210 | 211 | ### CDLGAPSIDESIDEWHITE - Up/Down-gap side-by-side white lines 212 | >函数名:CDLGAPSIDESIDEWHITE 213 | 名称:Up/Down-gap side-by-side white lines 向上/下跳空并列阳线 214 | 简介:二日K线模式,上升趋势向上跳空,下跌趋势向下跳空, 215 | 第一日与第二日有相同开盘价,实体长度差不多,则趋势持续。 216 | 217 | ```python 218 | integer = CDLGAPSIDESIDEWHITE(open, high, low, close) 219 | ``` 220 | 221 | ### CDLGRAVESTONEDOJI - Gravestone Doji 222 | > 函数名:CDLGRAVESTONEDOJI 223 | 名称:Gravestone Doji 墓碑十字/倒T十字 224 | 简介:一日K线模式,开盘价与收盘价相同,上影线长,无下影线,预示底部反转。 225 | 226 | ```python 227 | integer = CDLGRAVESTONEDOJI(open, high, low, close) 228 | ``` 229 | 230 | ### CDLHAMMER - Hammer 231 | > 函数名:CDLHAMMER 232 | 名称:Hammer 锤头 233 | 简介:一日K线模式,实体较短,无上影线, 234 | 下影线大于实体长度两倍,处于下跌趋势底部,预示反转。 235 | 236 | ```python 237 | integer = CDLHAMMER(open, high, low, close) 238 | ``` 239 | 240 | ### CDLHANGINGMAN - Hanging Man 241 | > 函数名:CDLHANGINGMAN 242 | 名称:Hanging Man 上吊线 243 | 简介:一日K线模式,形状与锤子类似,处于上升趋势的顶部,预示着趋势反转。 244 | 245 | ```python 246 | integer = CDLHANGINGMAN(open, high, low, close) 247 | ``` 248 | 249 | ### CDLHARAMI - Harami Pattern 250 | > 函数名:CDLHARAMI 251 | 名称:Harami Pattern 母子线 252 | 简介:二日K线模式,分多头母子与空头母子,两者相反,以多头母子为例,在下跌趋势中,第一日K线长阴, 253 | 第二日开盘价收盘价在第一日价格振幅之内,为阳线,预示趋势反转,股价上升。 254 | 255 | ```python 256 | integer = CDLHARAMI(open, high, low, close) 257 | ``` 258 | 259 | ### CDLHARAMICROSS - Harami Cross Pattern 260 | > 函数名:CDLHARAMICROSS 261 | 名称:Harami Cross Pattern 十字孕线 262 | 简介:二日K线模式,与母子县类似,若第二日K线是十字线, 263 | 便称为十字孕线,预示着趋势反转。 264 | 265 | ```python 266 | integer = CDLHARAMICROSS(open, high, low, close) 267 | ``` 268 | 269 | ### CDLHIGHWAVE - High-Wave Candle 270 | > 函数名:CDLHIGHWAVE 271 | 名称:High-Wave Candle 风高浪大线 272 | 简介:三日K线模式,具有极长的上/下影线与短的实体,预示着趋势反转。 273 | 274 | ```python 275 | integer = CDLHIGHWAVE(open, high, low, close) 276 | ``` 277 | 278 | ### CDLHIKKAKE - Hikkake Pattern 279 | > 函数名:CDLHIKKAKE 280 | 名称:Hikkake Pattern 陷阱 281 | 简介:三日K线模式,与母子类似,第二日价格在前一日实体范围内, 282 | 第三日收盘价高于前两日,反转失败,趋势继续。 283 | ```python 284 | integer = CDLHIKKAKE(open, high, low, close) 285 | ``` 286 | 287 | ### CDLHIKKAKEMOD - Modified Hikkake Pattern 288 | > 函数名:CDLHIKKAKEMOD 289 | 名称:Modified Hikkake Pattern 修正陷阱 290 | 简介:三日K线模式,与陷阱类似,上升趋势中,第三日跳空高开; 291 | 下跌趋势中,第三日跳空低开,反转失败,趋势继续。 292 | ```python 293 | integer = CDLHIKKAKEMOD(open, high, low, close) 294 | ``` 295 | 296 | ### CDLHOMINGPIGEON - Homing Pigeon 297 | > 函数名:CDLHOMINGPIGEON 298 | 名称:Homing Pigeon 家鸽 299 | 简介:二日K线模式,与母子线类似,不同的的是二日K线颜色相同, 300 | 第二日最高价、最低价都在第一日实体之内,预示着趋势反转。 301 | 302 | ```python 303 | integer = CDLHOMINGPIGEON(open, high, low, close) 304 | ``` 305 | 306 | ### CDLIDENTICAL3CROWS - Identical Three Crows 307 | > 函数名:CDLIDENTICAL3CROWS 308 | 名称:Identical Three Crows 三胞胎乌鸦 309 | 简介:三日K线模式,上涨趋势中,三日都为阴线,长度大致相等, 310 | 每日开盘价等于前一日收盘价,收盘价接近当日最低价,预示价格下跌。 311 | 312 | ```python 313 | integer = CDLIDENTICAL3CROWS(open, high, low, close) 314 | ``` 315 | 316 | ### CDLINNECK - In-Neck Pattern 317 | >函数名:CDLINNECK 318 | 名称:In-Neck Pattern 颈内线 319 | 简介:二日K线模式,下跌趋势中,第一日长阴线, 320 | 第二日开盘价较低,收盘价略高于第一日收盘价,阳线,实体较短,预示着下跌继续。 321 | 322 | ```python 323 | integer = CDLINNECK(open, high, low, close) 324 | ``` 325 | 326 | ### CDLINVERTEDHAMMER - Inverted Hammer 327 | > 函数名:CDLINVERTEDHAMMER 328 | 名称:Inverted Hammer 倒锤头 329 | 简介:一日K线模式,上影线较长,长度为实体2倍以上, 330 | 无下影线,在下跌趋势底部,预示着趋势反转。 331 | 332 | ```python 333 | integer = CDLINVERTEDHAMMER(open, high, low, close) 334 | ``` 335 | 336 | ### CDLKICKING - Kicking 337 | > 函数名:CDLKICKING 338 | 名称:Kicking 反冲形态 339 | 简介:二日K线模式,与分离线类似,两日K线为秃线,颜色相反,存在跳空缺口。 340 | 341 | ```python 342 | integer = CDLKICKING(open, high, low, close) 343 | ``` 344 | 345 | ### CDLKICKINGBYLENGTH - Kicking - bull/bear determined by the longer marubozu 346 | > 函数名:CDLKICKINGBYLENGTH 347 | 名称:Kicking - bull/bear determined by the longer marubozu 由较长缺影线决定的反冲形态 348 | 简介:二日K线模式,与反冲形态类似,较长缺影线决定价格的涨跌。 349 | 350 | ```python 351 | integer = CDLKICKINGBYLENGTH(open, high, low, close) 352 | ``` 353 | 354 | ### CDLLADDERBOTTOM - Ladder Bottom 355 | > 函数名:CDLLADDERBOTTOM 356 | 名称:Ladder Bottom 梯底 357 | 简介:五日K线模式,下跌趋势中,前三日阴线, 358 | 开盘价与收盘价皆低于前一日开盘、收盘价,第四日倒锤头,第五日开盘价高于前一日开盘价, 359 | 阳线,收盘价高于前几日价格振幅,预示着底部反转。 360 | 361 | ```python 362 | integer = CDLLADDERBOTTOM(open, high, low, close) 363 | ``` 364 | 365 | ### CDLLONGLEGGEDDOJI - Long Legged Doji 366 | 367 | > 函数名:CDLLONGLEGGEDDOJI 368 | 名称:Long Legged Doji 长脚十字 369 | 简介:一日K线模式,开盘价与收盘价相同居当日价格中部,上下影线长, 370 | 表达市场不确定性。 371 | 372 | ```python 373 | integer = CDLLONGLEGGEDDOJI(open, high, low, close) 374 | ``` 375 | 376 | ### CDLLONGLINE - Long Line Candle 377 | > 函数名:CDLLONGLINE 378 | 名称:Long Line Candle 长蜡烛 379 | 简介:一日K线模式,K线实体长,无上下影线。 380 | 381 | ```python 382 | integer = CDLLONGLINE(open, high, low, close) 383 | ``` 384 | 385 | ### CDLMARUBOZU - Marubozu 386 | 函数名:CDLMARUBOZU 387 | 名称:Marubozu 光头光脚/缺影线 388 | 简介:一日K线模式,上下两头都没有影线的实体, 389 | 阴线预示着熊市持续或者牛市反转,阳线相反。 390 | 391 | ```python 392 | integer = CDLMARUBOZU(open, high, low, close) 393 | ``` 394 | 395 | ### CDLMATCHINGLOW - Matching Low 396 | > 函数名:CDLMATCHINGLOW 397 | 名称:Matching Low 相同低价 398 | 简介:二日K线模式,下跌趋势中,第一日长阴线, 399 | 第二日阴线,收盘价与前一日相同,预示底部确认,该价格为支撑位。 400 | 401 | ```python 402 | integer = CDLMATCHINGLOW(open, high, low, close) 403 | ``` 404 | 405 | ### CDLMATHOLD - Mat Hold 406 | > 函数名:CDLMATHOLD 407 | 名称:Mat Hold 铺垫 408 | 简介:五日K线模式,上涨趋势中,第一日阳线,第二日跳空高开影线, 409 | 第三、四日短实体影线,第五日阳线,收盘价高于前四日,预示趋势持续。 410 | 411 | ```python 412 | integer = CDLMATHOLD(open, high, low, close, penetration=0) 413 | ``` 414 | 415 | ### CDLMORNINGDOJISTAR - Morning Doji Star 416 | >函数名:CDLMORNINGDOJISTAR 417 | 名称:Morning Doji Star 十字晨星 418 | 简介:三日K线模式, 419 | 基本模式为晨星,第二日K线为十字星,预示底部反转。 420 | 421 | 422 | ```python 423 | integer = CDLMORNINGDOJISTAR(open, high, low, close, penetration=0) 424 | ``` 425 | 426 | ### CDLMORNINGSTAR - Morning Star 427 | > 函数名:CDLMORNINGSTAR 428 | 名称:Morning Star 晨星 429 | 简介:三日K线模式,下跌趋势,第一日阴线, 430 | 第二日价格振幅较小,第三天阳线,预示底部反转。 431 | 432 | ```python 433 | integer = CDLMORNINGSTAR(open, high, low, close, penetration=0) 434 | ``` 435 | 436 | ### CDLONNECK - On-Neck Pattern 437 | > 函数名:CDLONNECK 438 | 名称:On-Neck Pattern 颈上线 439 | 简介:二日K线模式,下跌趋势中,第一日长阴线,第二日开盘价较低, 440 | 收盘价与前一日最低价相同,阳线,实体较短,预示着延续下跌趋势。 441 | 442 | ```python 443 | integer = CDLONNECK(open, high, low, close) 444 | ``` 445 | 446 | ### CDLPIERCING - Piercing Pattern 447 | > 函数名:CDLPIERCING 448 | 名称:Piercing Pattern 刺透形态 449 | 简介:两日K线模式,下跌趋势中,第一日阴线,第二日收盘价低于前一日最低价, 450 | 收盘价处在第一日实体上部,预示着底部反转。 451 | ```python 452 | integer = CDLPIERCING(open, high, low, close) 453 | ``` 454 | 455 | ### CDLRICKSHAWMAN - Rickshaw Man 456 | > 函数名:CDLRICKSHAWMAN 457 | 名称:Rickshaw Man 黄包车夫 458 | 简介:一日K线模式,与长腿十字线类似, 459 | 若实体正好处于价格振幅中点,称为黄包车夫。 460 | 461 | ```python 462 | integer = CDLRICKSHAWMAN(open, high, low, close) 463 | ``` 464 | 465 | ### CDLRISEFALL3METHODS - Rising/Falling Three Methods 466 | > 函数名:CDLRISEFALL3METHODS 467 | 名称:Rising/Falling Three Methods 上升/下降三法 468 | 简介: 五日K线模式,以上升三法为例,上涨趋势中, 469 | 第一日长阳线,中间三日价格在第一日范围内小幅震荡, 470 | 第五日长阳线,收盘价高于第一日收盘价,预示股价上升。 471 | 472 | ```python 473 | integer = CDLRISEFALL3METHODS(open, high, low, close) 474 | ``` 475 | 476 | ### CDLSEPARATINGLINES - Separating Lines 477 | > 函数名:CDLSEPARATINGLINES 478 | 名称:Separating Lines 分离线 479 | 简介:二日K线模式,上涨趋势中,第一日阴线,第二日阳线, 480 | 第二日开盘价与第一日相同且为最低价,预示着趋势继续。 481 | 482 | ```python 483 | integer = CDLSEPARATINGLINES(open, high, low, close) 484 | ``` 485 | 486 | ### CDLSHOOTINGSTAR - Shooting Star 487 | > 函数名:CDLSHOOTINGSTAR 488 | 名称:Shooting Star 射击之星 489 | 简介:一日K线模式,上影线至少为实体长度两倍, 490 | 没有下影线,预示着股价下跌 491 | ```python 492 | integer = CDLSHOOTINGSTAR(open, high, low, close) 493 | ``` 494 | 495 | ### CDLSHORTLINE - Short Line Candle 496 | > 函数名:CDLSHORTLINE 497 | 名称:Short Line Candle 短蜡烛 498 | 简介:一日K线模式,实体短,无上下影线 499 | 500 | ```python 501 | integer = CDLSHORTLINE(open, high, low, close) 502 | ``` 503 | 504 | ### CDLSPINNINGTOP - Spinning Top 505 | > 函数名:CDLSPINNINGTOP 506 | 名称:Spinning Top 纺锤 507 | 简介:一日K线,实体小。 508 | 509 | ```python 510 | integer = CDLSPINNINGTOP(open, high, low, close) 511 | ``` 512 | 513 | ### CDLSTALLEDPATTERN - Stalled Pattern 514 | > 函数名:CDLSTALLEDPATTERN 515 | 名称:Stalled Pattern 停顿形态 516 | 简介:三日K线模式,上涨趋势中,第二日长阳线, 517 | 第三日开盘于前一日收盘价附近,短阳线,预示着上涨结束 518 | 519 | ```python 520 | integer = CDLSTALLEDPATTERN(open, high, low, close) 521 | ``` 522 | 523 | ### CDLSTICKSANDWICH - Stick Sandwich 524 | > 函数名:CDLSTICKSANDWICH 525 | 名称:Stick Sandwich 条形三明治 526 | 简介:三日K线模式,第一日长阴线,第二日阳线,开盘价高于前一日收盘价, 527 | 第三日开盘价高于前两日最高价,收盘价于第一日收盘价相同。 528 | 529 | ```python 530 | integer = CDLSTICKSANDWICH(open, high, low, close) 531 | ``` 532 | 533 | ### CDLTAKURI - Takuri (Dragonfly Doji with very long lower shadow) 534 | > 函数名:CDLTAKURI 535 | 名称:Takuri (Dragonfly Doji with very long lower shadow) 536 | 探水竿 537 | 简介:一日K线模式,大致与蜻蜓十字相同,下影线长度长。 538 | 539 | ```python 540 | integer = CDLTAKURI(open, high, low, close) 541 | ``` 542 | 543 | ### CDLTASUKIGAP - Tasuki Gap 544 | > 函数名:CDLTASUKIGAP 545 | 名称:Tasuki Gap 跳空并列阴阳线 546 | 简介:三日K线模式,分上涨和下跌,以上升为例, 547 | 前两日阳线,第二日跳空,第三日阴线,收盘价于缺口中,上升趋势持续。 548 | 549 | ```python 550 | integer = CDLTASUKIGAP(open, high, low, close) 551 | ``` 552 | 553 | ### CDLTHRUSTING - Thrusting Pattern 554 | > 函数名:CDLTHRUSTING 555 | 名称:Thrusting Pattern 插入 556 | 简介:二日K线模式,与颈上线类似,下跌趋势中,第一日长阴线,第二日开盘价跳空, 557 | 收盘价略低于前一日实体中部,与颈上线相比实体较长,预示着趋势持续。 558 | 559 | ```python 560 | integer = CDLTHRUSTING(open, high, low, close) 561 | ``` 562 | 563 | ### CDLTRISTAR - Tristar Pattern 564 | > 函数名:CDLTRISTAR 565 | 名称:Tristar Pattern 三星 566 | 简介:三日K线模式,由三个十字组成, 567 | 第二日十字必须高于或者低于第一日和第三日,预示着反转。 568 | 569 | ```python 570 | integer = CDLTRISTAR(open, high, low, close) 571 | ``` 572 | 573 | ### CDLUNIQUE3RIVER - Unique 3 River 574 | > 函数名:CDLUNIQUE3RIVER 575 | 名称:Unique 3 River 奇特三河床 576 | 简介:三日K线模式,下跌趋势中,第一日长阴线,第二日为锤头,最低价创新低,第三日开盘价低于第二日收盘价,收阳线, 577 | 收盘价不高于第二日收盘价,预示着反转,第二日下影线越长可能性越大。 578 | 579 | ```python 580 | integer = CDLUNIQUE3RIVER(open, high, low, close) 581 | ``` 582 | 583 | ### CDLUPSIDEGAP2CROWS - Upside Gap Two Crows 584 | > 函数名:CDLUPSIDEGAP2CROWS 585 | 名称:Upside Gap Two Crows 向上跳空的两只乌鸦 586 | 简介:三日K线模式,第一日阳线,第二日跳空以高于第一日最高价开盘, 587 | 收阴线,第三日开盘价高于第二日,收阴线,与第一日比仍有缺口。 588 | 589 | ```python 590 | integer = CDLUPSIDEGAP2CROWS(open, high, low, close) 591 | ``` 592 | 593 | ### CDLXSIDEGAP3METHODS - Upside/Downside Gap Three Methods 594 | > 函数名:CDLXSIDEGAP3METHODS 595 | 名称:Upside/Downside Gap Three Methods 上升/下降跳空三法 596 | 简介:五日K线模式,以上升跳空三法为例,上涨趋势中,第一日长阳线,第二日短阳线,第三日跳空阳线,第四日阴线,开盘价与收盘价于前两日实体内, 597 | 第五日长阳线,收盘价高于第一日收盘价,预示股价上升。 598 | 599 | ```python 600 | integer = CDLXSIDEGAP3METHODS(open, high, low, close) 601 | ``` 602 | 603 | 604 | [文档](../doc_index.md) 605 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 606 | -------------------------------------------------------------------------------- /func_groups/price_transform.md: -------------------------------------------------------------------------------- 1 | # Price Transform Functions 2 | 3 | ### AVGPRICE - Average Price 4 | > 函数名:AVGPRICE 5 | 名称:平均价格函数 6 | ```python 7 | real = AVGPRICE(open, high, low, close) 8 | ``` 9 | 10 | Learn more about the Average Price at [tadoc.org](http://www.tadoc.org/indicator/AVGPRICE.htm). 11 | 12 | ### MEDPRICE - Median Price 13 | > 函数名:MEDPRICE 14 | 名称:中位数价格 15 | ```python 16 | real = MEDPRICE(high, low) 17 | ``` 18 | 19 | Learn more about the Median Price at [tadoc.org](http://www.tadoc.org/indicator/MEDPRICE.htm). 20 | ### TYPPRICE - Typical Price 21 | > 函数名:TYPPRICE 22 | 名称:代表性价格 23 | 24 | ```python 25 | real = TYPPRICE(high, low, close) 26 | ``` 27 | 28 | Learn more about the Typical Price at [tadoc.org](http://www.tadoc.org/indicator/TYPPRICE.htm). 29 | ### WCLPRICE - Weighted Close Price 30 | > 函数名:WCLPRICE 31 | 名称:加权收盘价 32 | 33 | ```python 34 | real = WCLPRICE(high, low, close) 35 | ``` 36 | 37 | Learn more about the Weighted Close Price at [tadoc.org](http://www.tadoc.org/indicator/WCLPRICE.htm). 38 | 39 | [文档](../doc_index.md) 40 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 41 | -------------------------------------------------------------------------------- /func_groups/statistic_functions.md: -------------------------------------------------------------------------------- 1 | # Statistic Functions 统计学指标 2 | ### BETA - Beta 3 | > 函数名:BETA 4 | 名称:β系数也称为贝塔系数 5 | 简介:一种风险指数,用来衡量个别股票或 6 | 股票基金相对于整个股市的价格波动情况 7 | 贝塔系数衡量股票收益相对于业绩评价基准收益的总体波动性,是一个相对指标。 β 越高,意味着股票相对于业绩评价基准的波动性越大。 β 大于 1 , 8 | 则股票的波动性大于业绩评价基准的波动性。反之亦然。 9 | 用途: 10 | 1)计算资本成本,做出投资决策(只有回报率高于资本成本的项目才应投资); 11 | 2)计算资本成本,制定业绩考核及激励标准; 12 | 3)计算资本成本,进行资产估值(Beta是现金流贴现模型的基础); 13 | 4)确定单个资产或组合的系统风险,用于资产组合的投资管理,特别是股指期货或其他金融衍生品的避险(或投机) 14 | 15 | ```python 16 | real = BETA(high, low, timeperiod=5) 17 | ``` 18 | 19 | Learn more about the Beta at [tadoc.org](http://www.tadoc.org/indicator/BETA.htm). 20 | ### CORREL - Pearson's Correlation Coefficient (r) 21 | > 函数名:CORREL 22 | 名称:皮尔逊相关系数 23 | 简介:用于度量两个变量X和Y之间的相关(线性相关),其值介于-1与1之间 24 | 皮尔逊相关系数是一种度量两个变量间相关程度的方法。它是一个介于 1 和 -1 之间的值, 25 | 其中,1 表示变量完全正相关, 0 表示无关,-1 表示完全负相关。 26 | ```python 27 | real = CORREL(high, low, timeperiod=30) 28 | ``` 29 | 30 | Learn more about the Pearson's Correlation Coefficient (r) at [tadoc.org](http://www.tadoc.org/indicator/CORREL.htm). 31 | ### LINEARREG - Linear Regression 32 | >直线回归方程:当两个变量x与y之间达到显著地线性相关关系时,应用最小二乘法原理确定一条最优直线的直线方程y=a+bx,这条回归直线与个相关点的距离比任何其他直线与相关点的距离都小,是最佳的理想直线. 33 | 回归截距a:表示直线在y轴上的截距,代表直线的起点. 34 | 回归系数b:表示直线的斜率,他的实际意义是说明x每变化一个单位时,影响y平均变动的数量. 35 | 即x每增加1单位,y变化b个单位. 36 | 37 | 38 | > 函数名:LINEARREG 39 | 名称:线性回归 40 | 简介:来确定两种或两种以上变量间相互依赖的定量关系的一种统计分析方法 41 | 其表达形式为y = w'x+e,e为误差服从均值为0的正态分布。 42 | 43 | ```python 44 | real = LINEARREG(close, timeperiod=14) 45 | ``` 46 | 47 | Learn more about the Linear Regression at [tadoc.org](http://www.tadoc.org/indicator/LINEARREG.htm). 48 | ### LINEARREG_ANGLE - Linear Regression Angle 49 | > 函数名:LINEARREG_ANGLE 50 | 名称:线性回归的角度 51 | 简介:来确定价格的角度变化. 52 | [参考](http://blog.sina.com.cn/s/blog_14c9f45b20102vv8p.md) 53 | ```python 54 | real = LINEARREG_ANGLE(close, timeperiod=14) 55 | ``` 56 | 57 | Learn more about the Linear Regression Angle at [tadoc.org](http://www.tadoc.org/indicator/LINEARREG_ANGLE.htm). 58 | ### LINEARREG_INTERCEPT - Linear Regression Intercept 59 | > 函数名:LINEARREG_INTERCEPT 60 | 名称:线性回归截距 61 | ```python 62 | real = LINEARREG_INTERCEPT(close, timeperiod=14) 63 | ``` 64 | 65 | Learn more about the Linear Regression Intercept at [tadoc.org](http://www.tadoc.org/indicator/LINEARREG_INTERCEPT.htm). 66 | ### LINEARREG_SLOPE - Linear Regression Slope 67 | > 函数名:LINEARREG_SLOPE 68 | 名称:线性回归斜率指标 69 | 70 | ```python 71 | real = LINEARREG_SLOPE(close, timeperiod=14) 72 | ``` 73 | 74 | Learn more about the Linear Regression Slope at [tadoc.org](http://www.tadoc.org/indicator/LINEARREG_SLOPE.htm). 75 | ### STDDEV - Standard Deviation 76 | > 函数名:STDDEV 77 | 名称:标准偏差 78 | 简介:种量度数据分布的分散程度之标准,用以衡量数据值偏离算术平均值的程度。标准偏差越小,这些值偏离平均值就越少,反之亦然。标准偏差的大小可通过标准偏差与平均值的倍率关系来衡量。 79 | 80 | ```python 81 | real = STDDEV(close, timeperiod=5, nbdev=1) 82 | ``` 83 | 84 | Learn more about the Standard Deviation at [tadoc.org](http://www.tadoc.org/indicator/STDDEV.htm). 85 | ### TSF - Time Series Forecast 86 | 87 | > 函数名:TSF 88 | 名称:时间序列预测 89 | 简介:一种历史资料延伸预测,也称历史引伸预测法。是以时间数列所能反映的社会经济现象的发展过程和规律性,进行引伸外推,预测其发展趋势的方法 90 | 91 | 92 | ```python 93 | real = TSF(close, timeperiod=14) 94 | ``` 95 | 96 | Learn more about the Time Series Forecast at [tadoc.org](http://www.tadoc.org/indicator/TSF.htm). 97 | ### VAR - VAR 98 | > 函数名: VAR 99 | 名称:方差 100 | 简介:方差用来计算每一个变量(观察值)与总体均数之间的差异。为避免出现离均差总和为零,离均差平方和受样本含量的影响,统计学采用平均离均差平方和来描述变量的变异程度 101 | 102 | ```python 103 | real = VAR(close, timeperiod=5, nbdev=1) 104 | ``` 105 | 106 | Learn more about the Variance at [tadoc.org](http://www.tadoc.org/indicator/VAR.htm). 107 | 108 | [文档](../doc_index.md) 109 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 110 | -------------------------------------------------------------------------------- /func_groups/volatility_indicators.md: -------------------------------------------------------------------------------- 1 | # Volatility Indicator Functions 波动率指标函数 2 | ### ATR - Average True Range 3 | 4 | > 函数名:ATR 5 | 名称:真实波动幅度均值 6 | 简介:真实波动幅度均值(ATR)是 7 | 以 N 天的指数移动平均数平均後的交易波动幅度。 8 | 计算公式:一天的交易幅度只是单纯地 最大值 - 最小值。 9 | 而真实波动幅度则包含昨天的收盘价,若其在今天的幅度之外: 10 | 真实波动幅度 = max(最大值,昨日收盘价) − min(最小值,昨日收盘价) 真实波动幅度均值便是「真实波动幅度」的 N 日 指数移动平均数。 11 | 12 | 特性:: 13 | * 波动幅度的概念表示可以显示出交易者的期望和热情。 14 | * 大幅的或增加中的波动幅度表示交易者在当天可能准备持续买进或卖出股票。 15 | * 波动幅度的减少则表示交易者对股市没有太大的兴趣。 16 | 17 | NOTE: The ``ATR`` function has an unstable period. 18 | 19 | ```python 20 | real = ATR(high, low, close, timeperiod=14) 21 | ``` 22 | 23 | Learn more about the Average True Range at [tadoc.org](http://www.tadoc.org/indicator/ATR.htm). 24 | ### NATR - Normalized Average True Range 25 | > 函数名:NATR 26 | 名称:归一化波动幅度均值 27 | 简介:归一化波动幅度均值(NATR)是 28 | 29 | NOTE: The ``NATR`` function has an unstable period. 30 | ```python 31 | real = NATR(high, low, close, timeperiod=14) 32 | ``` 33 | 34 | Learn more about the Normalized Average True Range at [tadoc.org](http://www.tadoc.org/indicator/NATR.htm). 35 | ### TRANGE - True Range 36 | 37 | > 函数名:TRANGE 38 | 名称:真正的范围 39 | 40 | ```python 41 | real = TRANGE(high, low, close) 42 | ``` 43 | 44 | Learn more about the True Range at [tadoc.org](http://www.tadoc.org/indicator/TRANGE.htm). 45 | 46 | [Documentation Index](../doc_index.md) 47 | [FLOAT_RIGHTAll Function Groups](../funcs.md) 48 | -------------------------------------------------------------------------------- /func_groups/volume_indicators.md: -------------------------------------------------------------------------------- 1 | #Volume Indicators 成交量指标 2 | 3 | ### AD - Chaikin A/D Line 量价指标 4 | > 函数名:AD 5 | 名称:Chaikin A/D Line 累积/派发线(Accumulation/Distribution Line) 6 | 简介:Marc Chaikin提出的一种平衡交易量指标,以当日的收盘价位来估算成交流量,用于估定一段时间内该证券累积的资金流量。 7 | 计算公式: 8 | ``` A/D = 昨日A/D + 多空对比 * 今日成交量 9 | 多空对比 = [(收盘价- 最低价) - (最高价 - 收盘价)] / (最高价 - 最低价) 10 | ``` 11 | 若最高价等于最低价: 多空对比 = (收盘价 / 昨收盘) - 1 12 | 研判: 13 | 1、A/D测量资金流向,向上的A/D表明买方占优势,而向下的A/D表明卖方占优势 14 | 2、A/D与价格的背离可视为买卖信号,即底背离考虑买入,顶背离考虑卖出 15 | 3、应当注意A/D忽略了缺口的影响,事实上,跳空缺口的意义是不能轻易忽略的 16 | A/D指标无需设置参数,但在应用时,可结合指标的均线进行分析 17 | 18 | ```python 19 | real = AD(high, low, close, volume) 20 | ``` 21 | 22 | ### ADOSC - Chaikin A/D Oscillator 23 | > 函数名:ADOSC 24 | 名称:Chaikin A/D Oscillator Chaikin震荡指标 25 | 简介:将资金流动情况与价格行为相对比,检测市场中资金流入和流出的情况 26 | 计算公式:fastperiod A/D - slowperiod A/D 27 | 研判: 28 | 1、交易信号是背离:看涨背离做多,看跌背离做空 29 | 2、股价与90天移动平均结合,与其他指标结合 30 | 3、由正变负卖出,由负变正买进 31 | 32 | ```python 33 | real = ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10) 34 | ``` 35 | 36 | ### OBV - On Balance Volume 37 | 38 | > 函数名:OBV 39 | 名称:On Balance Volume 能量潮 40 | 简介:Joe Granville提出,通过统计成交量变动的趋势推测股价趋势 41 | 计算公式:以某日为基期,逐日累计每日上市股票总成交量,若隔日指数或股票上涨 42 | ,则基期OBV加上本日成交量为本日OBV。隔日指数或股票下跌, 43 | 则基期OBV减去本日成交量为本日OBV 44 | 研判: 45 | 1、以“N”字型为波动单位,一浪高于一浪称“上升潮”,下跌称“跌潮”;上升潮买进,跌潮卖出 46 | 2、须配合K线图走势 47 | 3、用多空比率净额法进行修正,但不知TA-Lib采用哪种方法 48 | ```计算公式: 多空比率净额= [(收盘价-最低价)-(最高价-收盘价)] ÷( 最高价-最低价)×成交量``` 49 | ```python 50 | real = OBV(close, volume) 51 | ``` 52 | 53 | [文档](../doc_index.md) 54 | [函数分组](../funcs.md) 55 | -------------------------------------------------------------------------------- /funcs.md: -------------------------------------------------------------------------------- 1 | # All Supported Indicators and Functions 所有支持的指标和函数 2 | 3 | * [Overlap Studies](func_groups/overlap_studies.md) 4 | * [Momentum Indicators](func_groups/momentum_indicators.md) 5 | * [Volume Indicators](func_groups/volume_indicators.md) 6 | * [Volatility Indicators](func_groups/volatility_indicators.md) 7 | * [Price Transform](func_groups/price_transform.md) 8 | * [Cycle Indicators](func_groups/cycle_indicators.md) 9 | * [Pattern Recognition](func_groups/pattern_recognition.md) 10 | * [Statistic Functions](func_groups/statistic_functions.md) 11 | * [Math Transform](func_groups/math_transform.md) 12 | * [Math Operators](func_groups/math_operators.md) 13 | 14 | #### [Overlap Studies](func_groups/overlap_studies.md) 15 | 16 | ``` 17 | BBANDS Bollinger Bands 18 | DEMA Double Exponential Moving Average 19 | EMA Exponential Moving Average 20 | HT_TRENDLINE Hilbert Transform - Instantaneous Trendline 21 | KAMA Kaufman Adaptive Moving Average 22 | MA Moving average 23 | MAMA MESA Adaptive Moving Average 24 | MAVP Moving average with variable period 25 | MIDPOINT MidPoint over period 26 | MIDPRICE Midpoint Price over period 27 | SAR Parabolic SAR 28 | SAREXT Parabolic SAR - Extended 29 | SMA Simple Moving Average 30 | T3 Triple Exponential Moving Average (T3) 31 | TEMA Triple Exponential Moving Average 32 | TRIMA Triangular Moving Average 33 | WMA Weighted Moving Average 34 | ``` 35 | 36 | #### [Momentum Indicators](func_groups/momentum_indicators.md) 37 | 38 | ``` 39 | ADX Average Directional Movement Index 40 | ADXR Average Directional Movement Index Rating 41 | APO Absolute Price Oscillator 42 | AROON Aroon 43 | AROONOSC Aroon Oscillator 44 | BOP Balance Of Power 45 | CCI Commodity Channel Index 46 | CMO Chande Momentum Oscillator 47 | DX Directional Movement Index 48 | MACD Moving Average Convergence/Divergence 49 | MACDEXT MACD with controllable MA type 50 | MACDFIX Moving Average Convergence/Divergence Fix 12/26 51 | MFI Money Flow Index 52 | MINUS_DI Minus Directional Indicator 53 | MINUS_DM Minus Directional Movement 54 | MOM Momentum 55 | PLUS_DI Plus Directional Indicator 56 | PLUS_DM Plus Directional Movement 57 | PPO Percentage Price Oscillator 58 | ROC Rate of change : ((price/prevPrice)-1)*100 59 | ROCP Rate of change Percentage: (price-prevPrice)/prevPrice 60 | ROCR Rate of change ratio: (price/prevPrice) 61 | ROCR100 Rate of change ratio 100 scale: (price/prevPrice)*100 62 | RSI Relative Strength Index 63 | STOCH Stochastic 64 | STOCHF Stochastic Fast 65 | STOCHRSI Stochastic Relative Strength Index 66 | TRIX 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA 67 | ULTOSC Ultimate Oscillator 68 | WILLR Williams' %R 69 | ``` 70 | 71 | #### [Volume Indicators](func_groups/volume_indicators.md) 72 | 73 | ``` 74 | AD Chaikin A/D Line 75 | ADOSC Chaikin A/D Oscillator 76 | OBV On Balance Volume 77 | ``` 78 | 79 | #### [Cycle Indicators](func_groups/cycle_indicators.md) 80 | 81 | ``` 82 | HT_DCPERIOD Hilbert Transform - Dominant Cycle Period 83 | HT_DCPHASE Hilbert Transform - Dominant Cycle Phase 84 | HT_PHASOR Hilbert Transform - Phasor Components 85 | HT_SINE Hilbert Transform - SineWave 86 | HT_TRENDMODE Hilbert Transform - Trend vs Cycle Mode 87 | ``` 88 | 89 | #### [Price Transform](func_groups/price_transform.md) 90 | 91 | ``` 92 | AVGPRICE Average Price 93 | MEDPRICE Median Price 94 | TYPPRICE Typical Price 95 | WCLPRICE Weighted Close Price 96 | ``` 97 | 98 | #### [Volatility Indicators](func_groups/volatility_indicators.md) 99 | 100 | ``` 101 | ATR Average True Range 102 | NATR Normalized Average True Range 103 | TRANGE True Range 104 | ``` 105 | 106 | #### [Pattern Recognition](func_groups/pattern_recognition.md) 107 | 108 | ``` 109 | CDL2CROWS Two Crows 110 | CDL3BLACKCROWS Three Black Crows 111 | CDL3INSIDE Three Inside Up/Down 112 | CDL3LINESTRIKE Three-Line Strike 113 | CDL3OUTSIDE Three Outside Up/Down 114 | CDL3STARSINSOUTH Three Stars In The South 115 | CDL3WHITESOLDIERS Three Advancing White Soldiers 116 | CDLABANDONEDBABY Abandoned Baby 117 | CDLADVANCEBLOCK Advance Block 118 | CDLBELTHOLD Belt-hold 119 | CDLBREAKAWAY Breakaway 120 | CDLCLOSINGMARUBOZU Closing Marubozu 121 | CDLCONCEALBABYSWALL Concealing Baby Swallow 122 | CDLCOUNTERATTACK Counterattack 123 | CDLDARKCLOUDCOVER Dark Cloud Cover 124 | CDLDOJI Doji 125 | CDLDOJISTAR Doji Star 126 | CDLDRAGONFLYDOJI Dragonfly Doji 127 | CDLENGULFING Engulfing Pattern 128 | CDLEVENINGDOJISTAR Evening Doji Star 129 | CDLEVENINGSTAR Evening Star 130 | CDLGAPSIDESIDEWHITE Up/Down-gap side-by-side white lines 131 | CDLGRAVESTONEDOJI Gravestone Doji 132 | CDLHAMMER Hammer 133 | CDLHANGINGMAN Hanging Man 134 | CDLHARAMI Harami Pattern 135 | CDLHARAMICROSS Harami Cross Pattern 136 | CDLHIGHWAVE High-Wave Candle 137 | CDLHIKKAKE Hikkake Pattern 138 | CDLHIKKAKEMOD Modified Hikkake Pattern 139 | CDLHOMINGPIGEON Homing Pigeon 140 | CDLIDENTICAL3CROWS Identical Three Crows 141 | CDLINNECK In-Neck Pattern 142 | CDLINVERTEDHAMMER Inverted Hammer 143 | CDLKICKING Kicking 144 | CDLKICKINGBYLENGTH Kicking - bull/bear determined by the longer marubozu 145 | CDLLADDERBOTTOM Ladder Bottom 146 | CDLLONGLEGGEDDOJI Long Legged Doji 147 | CDLLONGLINE Long Line Candle 148 | CDLMARUBOZU Marubozu 149 | CDLMATCHINGLOW Matching Low 150 | CDLMATHOLD Mat Hold 151 | CDLMORNINGDOJISTAR Morning Doji Star 152 | CDLMORNINGSTAR Morning Star 153 | CDLONNECK On-Neck Pattern 154 | CDLPIERCING Piercing Pattern 155 | CDLRICKSHAWMAN Rickshaw Man 156 | CDLRISEFALL3METHODS Rising/Falling Three Methods 157 | CDLSEPARATINGLINES Separating Lines 158 | CDLSHOOTINGSTAR Shooting Star 159 | CDLSHORTLINE Short Line Candle 160 | CDLSPINNINGTOP Spinning Top 161 | CDLSTALLEDPATTERN Stalled Pattern 162 | CDLSTICKSANDWICH Stick Sandwich 163 | CDLTAKURI Takuri (Dragonfly Doji with very long lower shadow) 164 | CDLTASUKIGAP Tasuki Gap 165 | CDLTHRUSTING Thrusting Pattern 166 | CDLTRISTAR Tristar Pattern 167 | CDLUNIQUE3RIVER Unique 3 River 168 | CDLUPSIDEGAP2CROWS Upside Gap Two Crows 169 | CDLXSIDEGAP3METHODS Upside/Downside Gap Three Methods 170 | ``` 171 | 172 | #### [Statistic Functions](func_groups/statistic_functions.md) 173 | 174 | ``` 175 | BETA Beta 176 | CORREL Pearson's Correlation Coefficient (r) 177 | LINEARREG Linear Regression 178 | LINEARREG_ANGLE Linear Regression Angle 179 | LINEARREG_INTERCEPT Linear Regression Intercept 180 | LINEARREG_SLOPE Linear Regression Slope 181 | STDDEV Standard Deviation 182 | TSF Time Series Forecast 183 | VAR Variance 184 | ``` 185 | 186 | #### [Math Transform](func_groups/math_transform.md) 187 | 188 | ``` 189 | ACOS Vector Trigonometric ACos 190 | ASIN Vector Trigonometric ASin 191 | ATAN Vector Trigonometric ATan 192 | CEIL Vector Ceil 193 | COS Vector Trigonometric Cos 194 | COSH Vector Trigonometric Cosh 195 | EXP Vector Arithmetic Exp 196 | FLOOR Vector Floor 197 | LN Vector Log Natural 198 | LOG10 Vector Log10 199 | SIN Vector Trigonometric Sin 200 | SINH Vector Trigonometric Sinh 201 | SQRT Vector Square Root 202 | TAN Vector Trigonometric Tan 203 | TANH Vector Trigonometric Tanh 204 | ``` 205 | 206 | #### [Math Operators](func_groups/math_operators.md) 207 | 208 | ``` 209 | ADD Vector Arithmetic Add 210 | DIV Vector Arithmetic Div 211 | MAX Highest value over a specified period 212 | MAXINDEX Index of highest value over a specified period 213 | MIN Lowest value over a specified period 214 | MININDEX Index of lowest value over a specified period 215 | MINMAX Lowest and highest values over a specified period 216 | MINMAXINDEX Indexes of lowest and highest values over a specified period 217 | MULT Vector Arithmetic Mult 218 | SUB Vector Arithmetic Substraction 219 | SUM Summation 220 | ``` 221 | 222 | [Documentation Index](doc_index.md) 223 | -------------------------------------------------------------------------------- /install.md: -------------------------------------------------------------------------------- 1 | # 安装 2 | 3 | 使用pip安装 PyPI: 4 | 5 | ``` 6 | $ pip install TA-Lib 7 | ``` 8 | 9 | Or checkout the sources and run ``setup.py`` yourself: 10 | 11 | ``` 12 | $ python setup.py install 13 | ``` 14 | 15 | ### 如果安装发生错误 16 | 17 | ``` 18 | func.c:256:28: fatal error: ta-lib/ta_libc.h: No such file or directory 19 | compilation terminated. 20 | ``` 21 | 22 | 如果你遇到这样的编译错误,它通常意味着它找不到底层的库,需要安装: 23 | # Dependencies 依赖库文件 24 | 使用Python的TA库,你需要有安装底层库文件:[下载TA-Lib底层库文件](http://ta-lib.org/hdr_dw.md) 25 | 26 | #### 安装底层库文件方法 27 | #### Mac OS X 28 | ``` 29 | $ brew install ta-lib 30 | ``` 31 | 32 | #### Windows 33 | Download [ta-lib-0.4.0-msvc.zip](http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-msvc.zip) 34 | and unzip to ``C:\ta-lib`` 35 | 36 | #### Linux 37 | Download [ta-lib-0.4.0-src.tar.gz](http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz) and: 38 | ``` 39 | $ untar and cd 40 | $ ./configure --prefix=/usr 41 | $ make 42 | $ sudo make install 43 | ``` 44 | 45 | > If you build ``TA-Lib`` using ``make -jX`` it will fail but that's OK! 46 | > Simply rerun ``make -jX`` followed by ``[sudo] make install``. 47 | 48 | [文档 ](doc_index.md) 49 | [下一章: Using the Function API](func.md) 50 | --------------------------------------------------------------------------------