The Detrended Price Oscillator (DPO) is used to eliminate the long-term trends in prices by comparing the price to a shifted moving average.
DPO = Price − SMA(shifted)
- The SMA is shifted back by (period / 2 + 1) bars
period(default: 20): Period for SMA
import { DPO } from '../src/dpo';
const dpo = new DPO();
const result = dpo.nextValue(close);
// result: DPO valueA single number: the DPO value for the current input.