Backtrader内置指标参数详解(1)- backtrader中文教程
加速减速振荡器(别名:AccDeOsc)
加速/减速技术指标 (AC) 测量当前驱动力的加速和减速。该指标将在驱动力发生任何变化之前改变方向,而反过来,驱动力将在价格之前改变其方向。
公式:
* AcdDecOsc = AwesomeOscillator - SMA(AwesomeOscillator, period)
参考 * https://www.metatrader5.com/en/terminal/help/indicators/bw_indicators/ao * https://www.ifcmarkets.com/en/ntx-indicators/ntx-indicators-accelerator-decelerator-oscillator Lines: accde Params:
* period (5) * movav (SMA) PlotInfo:
* plot (True) * plotmaster (None) * legendloc (None) * subplot (True) * plotname () * plotskip (False) * plotabove (False) * plotlinelabels (False) * plotlinevalues (True) * plotvaluetags (True)
- plotymargin (0.0)
- plotyhlines ([])
- plotyticks ([])
- plothlines ([])
- plotforce (False)
PlotLines:
- accde:
- _method (bar)
- alpha (0.5)
- width (1.0)
累积(别名:CumSum, CumulativeSum)
数据值的累积和
公式:
accum += data
Lines:
- accum
Params:
- seed (0.0)
PlotInfo:
- plot (True)
- plotmaster (None)
- legendloc (None)
- subplot (True)
- plotname ()
- plotskip (False)
- plotabove (False)
- plotlinelabels (False)
- plotlinevalues (True)
- plotvaluetags (True)
- plotymargin (0.0)
- plotyhlines ([])
- plotyticks ([])
- plothlines ([])
- plotforce (False)
PlotLines:
- accum
自适应移动平均线(别名:KAMA, MovingAverageAdaptive)
由 Perry Kaufman 在他的《Smarter Trading》一书中定义。
它是一个移动平均线,考虑到市场方向和波动性,具有连续缩放的平滑因子。平滑因子是根据 2 个 ExponetialMovingAverage 平滑因子计算得出的,一个快一个,一个慢一个。
如果市场趋势,价值将趋向于快速 ema 平滑期。如果市场没有趋势,它将走向缓慢的 EMA 平滑期。
它是 SmoothingMovingAverage 的子类,覆盖一次以说明平滑因子的实时性质
公式:
- direction = close – close_period
- volatility = sumN(abs(close – close_n), period)
- effiency_ratio = abs(direction / volatility)
- fast = 2 / (fast_period + 1)
- slow = 2 / (slow_period + 1)
- smfactor = squared(efficienty_ratio * (fast – slow) + slow)
- smfactor1 = 1.0 – smfactor
- The initial seed value is a SimpleMovingAverage
参考:
http://fxcodebase.com/wiki/index.php/Kaufman’s_Adaptive_Moving_Average_(KAMA)
http://www.metatrader5.com/en/terminal/help/analytics/indicators/trend_indicators/ama
http://help.cqg.com/cqgic/default.htm#!Documents/adaptivemovingaverag2.htm
Lines:
- kama
Params:
- period (30)
- fast (2)
- slow (30)
PlotInfo:
- plot (True)
- plotmaster (None)
- legendloc (None)
- subplot (False)
- plotname ()
- plotskip (False)
- plotabove (False)
- plotlinelabels (False)
- plotlinevalues (True)
- plotvaluetags (True)
- plotymargin (0.0)
- plotyhlines ([])
- plotyticks ([])
- plothlines ([])
- plotforce (False)
PlotLines:
- kama
自适应移动平均包(别名:KAMAEnvelope、MovingAverageAdaptiveEnvelope)
AdaptiveMovingAverage 和包络带将“perc”从中分离出来
公式:
- kama (from AdaptiveMovingAverage)
- top = kama * (1 + perc)
- bot = kama * (1 – perc)
参考:
- http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_average_envelopes
Lines:
- kama
- top
- bot
Params:
- period (30)
- fast (2)
- slow (30)
- perc (2.5)
PlotInfo:
- plot (True)
- plotmaster (None)
- legendloc (None)
- subplot (False)
- plotname ()
- plotskip (False)
- plotabove (False)
- plotlinelabels (False)
- plotlinevalues (True)
- plotvaluetags (True)
- plotymargin (0.0)
- plotyhlines ([])
- plotyticks ([])
- plothlines ([])
- plotforce (False)
PlotLines:
- kama:
- top:
- _samecolor (True)
- bot:
- _samecolor (True)
自适应移动平均振荡器(别名:AdaptiveMovingAverageOsc, KAMAOscillator, KAMAOsc, MovingAverageAdaptiveOscillator, MovingAverageAdaptiveOsc)
AdaptiveMovingAverage 围绕其数据的振荡
Lines:
- kama
Params:
- period (30)
- fast (2)
- slow (30)
PlotInfo:
- plot (True)
- plotmaster (None)
- legendloc (None)
- subplot (True)
- plotname ()
- plotskip (False)
- plotabove (False)
- plotlinelabels (False)
- plotlinevalues (True)
- plotvaluetags (True)
- plotymargin (0.0)
- plotyhlines ([])
- plotyticks ([])
- plothlines ([])
- plotforce (False)
PlotLines:
- kama:
- _0:
- _name (osc)
AllN
如果周期中的所有值都计算为非零(即:True),则值为True(在行中存储为 1.0)
使用内置all
计算
公式:
- alln = all(data, period)
Lines:
- alln
Params:
- period (1)
PlotInfo:
- plot (True)
- plotmaster (None)
- legendloc (None)
- subplot (True)
- plotname ()
- plotskip (False)
- plotabove (False)
- plotlinelabels (False)
- plotlinevalues (True)
- plotvaluetags (True)
- plotymargin (0.0)
- plotyhlines ([])
- plotyticks ([])
- plothlines ([])
- plotforce (False)
PlotLines:
- alln:
AnyN
如果周期中的任何值计算为非零(即:True),则值为True(在行中存储为 1.0)
使用内置 any 进行计算
公式:
- anyn = any(data, period)
Lines:
- anyn
Params:
- period (1)
PlotInfo:
- plot (True)
- plotmaster (None)
- legendloc (None)
- subplot (True)
- plotname ()
- plotskip (False)
- plotabove (False)
- plotlinelabels (False)
- plotlinevalues (True)
- plotvaluetags (True)
- plotymargin (0.0)
- plotyhlines ([])
- plotyticks ([])
- plothlines ([])
- plotforce (False)
PlotLines:
- anyn:
ApplyN
计算func
给定时间段
公式:
- line = func(data, period)
Lines:
- apply
Params:
- period (1)
- func (None)
PlotInfo:
- plot (True)
- plotmaster (None)
- legendloc (None)
- subplot (True)
- plotname ()
- plotskip (False)
- plotabove (False)
- plotlinelabels (False)
- plotlinevalues (True)
- plotvaluetags (True)
- plotymargin (0.0)
- plotyhlines ([])
- plotyticks ([])
- plothlines ([])
- plotforce (False)
PlotLines:
- apply: