Quick Search
»

# Percentage Price Oscillator (PPO)

### Syntax

DataSeries PPO( DataSeries ds, int Period1, int Period2 )

### Parameter Description

 ds Data series Period1 The shorter-term moving average period Period2 The longer-term moving average period

### Description

According to the Investopedia's definition, Percentage Price Oscillator (PPO) is a technical momentum indicator showing the relationship between two moving averages. To calculate the PPO, subtract the 26-day exponential moving average (EMA) from the nine-day EMA, and then divide this difference by the 26-day EMA.

It allows to rank and compare stocks more easily than does its counterpart, the MACD. Since PPO expresses the difference as a percentage, you will know that a "5" reading of PPO means the shorter moving average is 5% above the longer.

Note! Version 2010.10 of Community Indicators contains a breaking change: replaced Bars parameter with DataSeries.

### Example

This example illustrates a trading system based on Percentage Price Oscillator (PPO):

Note: the code is based on the new syntax and requires Community Indicators 2010.10.

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

namespace WealthLab.Strategies { public class PPO_demo: WealthScript { private StrategyParameter Period1; private StrategyParameter Period2; public PPO_demo() { Period1 = CreateParameter("Period1", 9, 9, 30, 1); Period2 = CreateParameter("Period2", 26, 20, 50, 1); } protected override void Execute() { PPO ppo = PPO.Series( Close, Period1.ValueInt, Period2.ValueInt ); for (int bar = ppo.FirstValidValue; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if ( ppo[bar] < 0 ) SellAtMarket( bar+1, LastPosition ); } else { if ( ppo[bar] > 0 ) BuyAtMarket( bar+1 ); } } ChartPane ppoPane = CreatePane( 20, true, true ); PlotSeries( ppoPane, ppo, Color.DarkRed, LineStyle.Histogram, 2 ); } } }
 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.