Author: Copyright � 2007 Tom Balfe
PPO

Overview

The Percentage Price Oscillator (PPO) is a momentum-based technical analysis tool designed to help traders understand the strength and speed of price movements. Unlike standard oscillators that show absolute price differences, this tool expresses the relationship between two different moving averages as a percentage. This makes it particularly useful for comparing trends across different assets or timeframes, as it normalizes the data into a relative scale.

How the Logic Works

The script functions by analyzing two primary "moving averages." These are smoothed versions of the price data that filter out minor market noise to reveal the broader trend:

  • The Fast Average: This follows the price movement more closely and reacts quickly to recent changes.
  • The Slow Average: This takes into account a larger amount of historical data, representing the longer-term trend.

The core logic calculates the difference between these two averages (Fast minus Slow) and then divides that difference by the value of the Slow average. By performing this division, the script converts the raw price gap into a percentage.

Visual Representation

The indicator produces two distinct lines on your trading chart:

  1. The PPO Line (Main Indicator): This is the primary line representing the percentage difference between the fast and slow averages. It shows you how much the current momentum is deviating from the long-term trend.
  2. The Signal Line: This is a secondary, smoother line derived from the PPO itself. It acts as a "trend of the trend." By calculating a moving average of the PPO, it helps traders identify shifts in momentum.

Trading Application

Traders typically look at these two lines to gauge market sentiment:

  • Momentum Strength: When the PPO line moves significantly away from its baseline, it indicates strong buying or selling pressure.
  • Trend Crossovers: One of the most common ways to interpret this logic is by watching where the PPO line crosses the Signal line. For example, when the main PPO line moves above the Signal line, it can suggest increasing upward momentum, while a move below may indicate a shift toward downward pressure.
Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
PPO
//+------------------------------------------------------------------+
//|                                                          PPO.mq4 |
//|                                       Copyright © 2007 Tom Balfe |
//|                                                                  |
//| Percentage Price Oscillator                                      |
//| This is a momentum indicator.                                    |
//| Signal line is EMA of PPO.                                       |
//|                                                                  |
//| Follows formula: (FastEMA-SlowEMA)/SlowEMA                       |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007 Tom Balfe"
#property link      "redcarsarasota@yahoo.com"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 SkyBlue
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 1
#property indicator_style2 2
//---- user changeable stuff
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalEMA=9;
//---- two buffers
double     PPOBuffer[];
double     SignalBuffer[];

int init()
  {

   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,SignalEMA);
   IndicatorDigits(Digits+1);
   SetIndexBuffer(0,PPOBuffer);
   SetIndexBuffer(1,SignalBuffer);

   IndicatorShortName("PPO ("+FastEMA+","+SlowEMA+","+SignalEMA+")");
   SetIndexLabel(0,"PPO");
   SetIndexLabel(1,"Signal");

   return(0);
  }
 
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   //---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   //---- (FastEMA-SlowEMA)/SlowEMA
   //---- PPO counted in the 1st buffer
   for(int i=0; i<limit; i++)
      PPOBuffer[i]=(iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i))/
                    iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
   //---- signal line counted in the 2nd buffer
   for(i=0; i<limit; i++)
      SignalBuffer[i]=iMAOnArray(PPOBuffer,Bars,SignalEMA,0,MODE_EMA,i);

   return(0);
  }

Comments