PPO_v2
Download scriptThe Percentage Price Oscillator (PPO) is a technical analysis tool designed to measure the momentum of a financial asset by analyzing the speed and strength of price movements relative to its historical average. Unlike some indicators that show the absolute difference in price, this specific tool calculates the "percentage" change, allowing for a more consistent comparison across different assets regardless of their price point.
How the Logic Works
The indicator operates by processing three distinct layers of data to provide a clear picture of market trends:
1. The Core Calculation (Fast vs. Slow Trends) The script begins by comparing two different moving averages of the asset's closing prices.
- The Fast EMA tracks short-term price changes quickly.
- The Slow EMA tracks longer-term price trends more smoothly.
By subtracting the Slow EMA from the Fast EMA and then dividing that result by the Slow EMA, the script calculates the percentage difference between these two timeframes. This identifies whether the current price momentum is accelerating upward, cooling off, or shifting downward in relation to its recent history.
2. The PPO Line The primary visual output (shown in Sky Blue) represents this percentage calculation. When the PPO line rises, it indicates that the short-term price is moving significantly higher than the long-term average; when it falls, it suggests the short-term price is dropping compared to the long-term trend.
3. The Signal Line To help traders filter out "noise" and identify actual turning points, the script generates a second line (the Signal Line). This line is an Exponential Moving Average of the PPO values themselves.
Practical Interpretation
The interaction between these two lines is the primary focus for analysis:
- Momentum Tracking: The PPO line tells you the current "speed" of the price move.
- Trend Confirmation: By observing where the PPO line sits in relation to its Signal Line, users can identify potential shifts in momentum. For instance, when the PPO line crosses over the Signal Line, it often suggests a change in the strength or direction of the trend, providing a visual cue for potential market sentiment shifts.
//+------------------------------------------------------------------+
//| 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