PPO (Price Percent Oscillator) for ThinkorSwim

@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 );
View attachment 2001

Here is the shared link: http://tos.mx/zQ6P90
Thanks for sharing. Is it possible to add bullish/bearish arrows each time PPO (1) crosses above/below EMA (2) or when PPOH1 changes color from Down to UP (bullish) or from UP to Down (Bearish)? essentially , there will be two different set of arrows. (PPO/EMA) and PPOH1 UP/DOWN color change. Thanks again. Here is the shared link that indicator: http://tos.mx/zQ6P90
1725879714754.png
 
Last edited:

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

The Percentage Price Oscillator (PPO) is similar to Moving Average Convergence Divergence (MACD).
They are both momentum indicators used to gauge the strength and direction of a trend in a stock's price. Many times, they present with the same signals.

The PPO is considered superior in that the PPO is expressed as a percentage, making it easier to compare across different stocks and timeframes. Whereas the MACD has little comparitive value.

View attachment 5664

This script for ToS was created by Mobius.

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
Nice oscillator
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
428 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