backtrader.indicators.dpo module¶
DPO Indicator Module - Detrended Price Oscillator.
This module provides the DPO (Detrended Price Oscillator) indicator developed by Joe DiNapoli to identify cycles by removing trend effects.
- Classes:
DetrendedPriceOscillator: DPO indicator (alias: DPO).
示例
- class MyStrategy(bt.Strategy):
- def __init__(self):
self.dpo = bt.indicators.DPO(self.data, period=20)
- def next(self):
- if self.dpo[0] > 0:
self.buy()
- class backtrader.indicators.dpo.DetrendedPriceOscillator[源代码]¶
基类:
IndicatorDefined by Joe DiNapoli in his book "Trading with DiNapoli levels"
It measures the price variations against a Moving Average (the trend) and therefore removes the "trend" factor from the price.
- Formula:
movav = MovingAverage(close, period)
dpo = close - movav(shifted period / 2 + 1)
- See:
- alias = ('DPO',)¶
- plotinfo = <backtrader.metabase.plotinfo_obj object>¶
- __init__(*args, **kwargs)¶
- frompackages = ()¶
- packages = ()¶