PPO (Price Percent Oscillator) for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
PPO is similar to MACD. The oscillator is displayed as a percentage so is consistent between all equities.

This script for ToS was created by Mobius.

neok9UZ.png


thinkScript Code

Code:
# PPO
# Mobius
# V01.03.2014

declare lower;

input c = close;
input AvgType = AverageType.Simple;
input nFast = 8;
input nSlow = 13;
input nSmooth = 5;

plot PPO = ((MovingAverage(AverageType = AvgType, c, nFast) -
             MovingAverage(AverageType = AvgType, c, nSlow)) /
             MovingAverage(AverageType = AvgType, c, nSlow));
PPO.SetPaintingStrategy(PaintingStrategy.Histogram);
PPO.AssignValueColor(if PPO > 0
                     then color.green
                     else color.red);

plot smooth = MovingAverage(AverageType = AvgType, PPO, nSmooth);
smooth.SetPaintingStrategy(PaintingStrategy.Line);
smooth.SetDefaultColor(Color.Cyan);
# End Code PPO

Shareable Link

https://tos.mx/hv8hVf
 

horserider

Well-known member
VIP
The Mobius version BenTen put up is a SMA version of the PPO. The original PPO formula I believe uses the EMA.
skynetgen uses the EMA PPO formula with interesting additions.

If want a simple PPO displayed https://tos.mx/NCheJqs
If want a daily/weekly PPO it is a ToS study. Search studies for it.

I Believe the Ultimate MACD will give equivalent signals plus more info.
 

wpwright

New member
PPO Indicator is missing (1) plot. Indicator has histogram and (1) plot, there is supposed to be a fast line and a slow line (2) line plots. I need the cross over of the line plots for signal generation.
 

grasshopper123

New member
I 2nd, 3rd, and 4th a request for PPO indicator like the one on Stock charts.com or freestockcharts.com :)
Of course I could be doing something wrong but the ones I've tried from here (and yes I adjust the settings as appropriate so they match) give results that differ from each other and the MACD included in TOS.
Thanks in advance
 

MerryDay

Administrative
Staff member
Staff
VIP
@grasshopper123 @wpwright I did was a simple google search, I am assuming that you did also and already saw this Easycator PPO w/ fast and slow lines and it wasn't what you wanted.

However here it is for anyone in the future that has this request:

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2016
#
## created by North Vanhooser

declare lower;

input fastPeriod   = 12;
input slowPeriod   = 26;
input signalPeriod = 9;
input price        = close;

def fastEma   = ExpAverage( price, fastPeriod );
def slowEma   = ExpAverage( price, slowPeriod );
def periodOK  = fastPeriod < slowPeriod;
AddLabel( !periodOK, "ERROR: fastPeriod MUST be less than slowPeriod" );
def _ppo      = if periodOK then ((fastEma - slowEma) / slowEma) * 100 else 0;
def _signal   = ExpAverage( _ppo, signalPeriod );

plot Ppo      = _ppo;
Ppo.SetDefaultColor( Color.BLUE );
Ppo.HideBubble();

plot PpoEma   = _signal;
PpoEma.SetDefaultColor( Color.CYAN );
PpoEma.HideBubble();

plot zeroLine = 0;
zeroLine.HideBubble();
zeroLine.AssignValueColor( Color.BLACK );

plot PpoH1    = _ppo - _signal;
PpoH1.SetPaintingStrategy( PaintingStrategy.HISTOGRAM );
PpoH1.DefineColor("Up", Color.UPTICK);
PpoH1.DefineColor("Down", Color.DOWNTICK);
PpoH1.DefineColor("Flat", Color.GRAY);
PpoH1.AssignValueColor( if PpoH1 > PpoH1[1] then
                           PpoH1.Color("Up")
                       else
                         if PpoH1 < PpoH1[1] then
                           PpoH1.Color("Down")
                       else
                           PpoH1.Color("Flat"));
PpoH1.HideBubble();
PpoH1.SetLineWeight( 3 );


Here is the shared link: http://tos.mx/zQ6P90
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
@Geisman
Setting Up The Scanner
qD04qMH.png

Copy the code from the forum
In TOS, in studies, click on Create
Paste the code from the forum
Save the study with the name: PPO_divergence
uQy5Xii.png

Click on scan.
Click on +Add filter
Click on the pencil icon next to the filter you just added
Click edit
Click on pull-down window, click add study
Type in PPO_divergence
In the Plot pull-down window, click on PlotPH
In the middle column, choose True
Save

If you have trouble, post a screenshot of where you are hung up. HTH
 

matts

New member
I really like the
@Geisman
Setting Up The Scanner
qD04qMH.png

Copy the code from the forum
In TOS, in studies, click on Create
Paste the code from the forum
Save the study with the name: PPO_divergence
uQy5Xii.png

Click on scan.
Click on +Add filter
Click on the pencil icon next to the filter you just added
Click edit
Click on pull-down window, click add study
Type in PPO_divergence
In the Plot pull-down window, click on PlotPH
In the middle column, choose True
Save

If you have trouble, post a screenshot of where you are hung up. HTH

I'm not sure why but my scan is always empty unless I set the parameters to within 3 bars. 2 and 1 bar gets zero results. Please help.
 

Emrys

New member
Did you have to set your scan to within 3 bars for it to show any results? I tried scanning for PlotPH less than 3 bars across time frames all come up empty. I don't understand the script enough to know why. Are u able to scan for current PlotPH signals?
Almost the same experience here.
I use 3 bars and add fundamental conditions to narrow down my search results.
Also, stocks tend to action irrationally several days before and after earnings. It is better to avoid them during this period.
 

thedoc556

New member
Hello,
Does anyone know how to scan for when the PPO oscillator is at a or below a specific value??
Thank you
Jesse
 

Similar threads

Top