PPO (Price Percent Oscillator) for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
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
 
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.
 
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.
 
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
 
@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 );
aaa2.png


Here is the shared link: http://tos.mx/zQ6P90
 
Last edited:
@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 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.
 
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.
 
Hello,
Does anyone know how to scan for when the PPO oscillator is at a or below a specific value??
Thank you
Jesse
 
Hi Skynetgen,

Does this redraws all the pivot indicators?
Did you know that clicking on a member's avatar will allow you to see when a member was last seen on the uTS forum? @skynetgen has not been seen in a while. :(

Recommend you put it on your chart. Nothing beats personal experience ;) The only way you will know what works best for you is to play with the settings and see how the indicator line up w/ your strategy and with your other indicators. To determine if this indicator brings value, analyze it over different timeframes, across history and with multiple instruments.
 
Did you know that clicking on a member's avatar will allow you to see when a member was last seen on the uTS forum? @skynetgen has not been seen in a while. :(

Recommend you put it on your chart. Nothing beats personal experience ;) The only way you will know what works best for you is to play with the settings and see how the indicator line up w/ your strategy and with your other indicators. To determine if this indicator brings value, analyze it over different timeframes, across history and with multiple instruments.
Thanks MerryDay,

Yeah, this is a pretty old post already. I will take a look at the script and see if i can understand what it's doing.

Thanks
 
yes, reference PPO() is a built-in ToS indicator.

As to what version is better? Recommend you put it on your chart. Nothing beats personal experience ;) The only way you will know what works best for you is to play with the settings and see how the indicator line up w/ your strategy and with your other indicators. To determine if this indicator brings value, analyze it over different timeframes, across history and with multiple instruments.
@MerryDay
I've searched in ToS for the terms PPO, Price Percent Oscillator, and Percent Price Oscillator a bunch of times and still can't find it. What terms should I use to find the built-in indicator?
Thanks
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
544 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top