Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


Syntax


public DPO(WealthLab.DataSeries source, int period, string description)
public static WealthLab.Indicators.DPO Series(WealthLab.DataSeries source, int period)

Parameter Description

source Data series
period Simple Moving Average period

Description

The Detrended Price Oscillator (DPO) is an indicator that attempts to eliminate the trend in prices. Detrended prices allow you to more easily identify cycles and overbought/oversold levels.

Interpretation

Analyzing the shorter-term cycles inside of the longer-term cycles can be helpful in identifying turning points in the longer term cycle. Like other oscillators, the Detrended Price Oscillator can be used in different ways.

Calculation

DPO = Close – X-period Simple Moving Average [(X/2)+1 bars ago]

To construct the Detrended Price Oscillator, you need to choose the time span for your analysis. Cycles longer than this time period will be removed from prices, leaving the shorter-term cycles.

Example

The following example buys when the DPO crosses below -5, and exits after 3 bars:


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies { public class DPO_Demo : WealthScript { private StrategyParameter paramPeriod; public DPO_Demo() { paramPeriod = CreateParameter("Period", 20, 4, 40, 2); } protected override void Execute() { int period = paramPeriod.ValueInt; DPO dpo = DPO.Series( Close,period ); for(int bar = period; bar < Bars.Count; bar++) { if (IsLastPositionActive) { /* Simple time-based exit */ Position p = LastPosition; if ( bar+1 - p.EntryBar >= 3 ) SellAtMarket( bar+1, p, "After 3 days" ); } else { if( CrossUnder( bar, dpo, -5 ) ) BuyAtMarket( bar+1 ); } } ChartPane dpoPane = CreatePane( 40, true, true ); PlotSeries( dpoPane, dpo, Color.Blue, LineStyle.Solid, 1 ); HideVolume(); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.