The Dynamic Market Lab The Dynamic Market Lab right border
Knowledge Base » Examples and Formulas » Adaptive DPO

Problem: Calculate an Adaptive Detrender Price Oscillator, an adaptive version of a common indicator defined to be the difference between a moving average and the same moving avg. "centered" at half the avg. length.

Here is how you accomplish this in Metastock with ASI:


{For the periods we use Ehler's Cycle Period measurement, this could be ANY function, or simply a constant}

period := ExtFml("ADSI.CyclePeriod", MP(), .18, 0.05, 1.1);

avg := ExtFml("ASI.SMA", MP(), period);
detrender := ExtFml("ASI.Ref", avg, period / 2 + 1);
DetrendPriceOsc := avg - detrender;

DetrendPriceOsc;