PersonsPivots (PPS) Indicator for ThinkorSwim

2sureshk

Member
VIP
I am looking for help on PPS indicator strategy. I see this indicator is good in 4 hrs and 2 hrs timeframe. Please share if there an existing strategy or help with code if possible to write as backtest strategy.

Mobius made a replica of the PersonsPivots indicator.

Code:
# PPS replica
# Mobius

input n  = 2;
input n2 = 7;
input n3 = 5;
input n4 = 4;

def c = close;

plot data  = Average(Inertia(c, n), n2);
plot data2 = ExpAverage(Inertia(ohlc4, n3), n4);

#Stan this is a better statement for the arrows in the PPS:
plot ArrowUP = data crosses above data2 and close crosses above data2;
ArrowUP.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_UP);

Plot ArrowDN = close crosses below data2 and data crosses below data2;
ArrowDN.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
 
I would like to add a bubble only when the PPS indicator has a buy signal and the arrow is higher than the previous one.
The bubble will have the arrow number up, example 1,2,3,4 etc...
When the next buy arrow is lower then the counter reset

I do not why the replica does not work for me (different signals from the original). Any idea?
 
Last edited by a moderator:
I would like to add a bubble only when the PPS indicator has a buy signal and the arrow is higher than the previous one.
The bubble will have the arrow number up, example 1,2,3,4 etc...
When the next buy arrow is lower then the counter reset

I do not why the replica does not work for me (different signals from the original). Any idea?

The replica by Mobius is his version of how the PPS was likely done, as on TOS, the PPS code is protected. His version is not exact.

The "replica" that I used in a post above just defines the pps plots in the hidden code so that what you requested, for example, can be provided.

The image shows the replica in the upper chart and the TOS PPS protected code version in the lower for comparison.

Screenshot 2023-09-26 095819.png
Code:
#PPS Replica

input ArrowsOn = yes;
input TracerLinesOn = no;
input PriceColorOn = Yes;

input ShowTodayOnly = no;
input ShowExtraDays = 0;
def Today =
if !ShowTodayOnly then 1 else
if GetDay() + ShowExtraDays >= GetLastDay() && GetYear() == GetLastYear() then 1 else 0;
input ArrowSpace = 0;
def space = Average(high - low) * ArrowSpace;

input AlertsOn = no;

def BuyIt = PPS().buysignal;
def SellIt = PPS().sellsignal;

plot ppsBuy = if !Today or !ArrowsOn then Double.NaN else BuyIt - space;
ppsBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ppsBuy.SetDefaultColor(Color.WHITE);
ppsBuy.SetLineWeight(3);
Alert(AlertsOn and ppsBuy, “PPS Buy Signal”, Alert.BAR, Sound.Ring);

plot ppsSell = if !Today or !ArrowsOn then Double.NaN else SellIt + space;
ppsSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ppsSell.SetDefaultColor(Color.WHITE);
ppsSell.SetLineWeight(3);
Alert(AlertsOn and ppsSell, “PPS Sell Signal”, Alert.BAR, Sound.Ring);

rec PriceAtBuy = if BarNumber() == 1 then close else if !IsNaN(BuyIt[0]) then close[0] else PriceAtBuy[1];
rec PriceAtSell = if BarNumber() == 1 then close else if !IsNaN(SellIt[0]) then close[0] else PriceAtSell[1];

rec trigger = if PriceAtBuy <> PriceAtBuy[1] then -1 else if PriceAtSell <> PriceAtSell[1] then 1 else trigger[1];
plot BuyPrice = if TracerLinesOn && trigger == -1 then PriceAtBuy else Double.NaN;
BuyPrice.SetDefaultColor(Color.WHITE);
BuyPrice.SetPaintingStrategy(PaintingStrategy.POINTS);
plot SellPrice = if TracerLinesOn && trigger == 1 then PriceAtSell else Double.NaN;
SellPrice.SetDefaultColor(Color.YELLOW);
SellPrice.SetPaintingStrategy(PaintingStrategy.POINTS);

AssignPriceColor(if !PriceColorOn then Color.CURRENT else if trigger == 1 then Color.RED else Color.GREEN);

def bb = if IsNaN(BuyIt) then bb[1] else if BuyIt then ppsBuy else bb[1];
def buycount = if bb > bb[1] then buycount[1] + 1 else if bb < bb[1] then 0 else buycount[1];

input showbubble = yes;
AddChartBubble(showbubble and BuyIt and buycount > 0, low, buycount, up = no, color = Color.GREEN);

#
 
Last edited:
All of John L. Person's pivot work, calculations and formulas are spelled out clearly in his book "Candlestick and Pivot Point Trading Triggers." I have turned the PPS and other Person work into TOS indicators that I "fancied" up and personalised. The book is an easy read and explains how Mr. Person recommends using the indicators and is a must read if you will be using them. I got the book at the public library, and should be available at your local library, just check for it online. The book is not worth a buy if you take good notes. The only caveat is Mr. Person has a pretty big opinion of himself, and says so many, MANY times in the book. IMHO, Scott
If you don't mind could you point where in Person book is the PPS explained? thanks
 
It appears that the TOS native PPS does not produce the same signals at the same time as the Mobius replica version of PPS. Does anyone know why that is and/or what needs to be adjusted in the mobius replica PPS version to align exactly with the native TOS PPS version?
 
The Thinkorswim (ToS) PPS Indicator source code is proprietary and inaccessible. Due to the inability to ascertain the precise calculation method used in the ToS version,
a discussion as to why the code does not align with the Mobius Replica PPS it is not feasible.

@adTS @stryde1
 
Last edited:

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
413 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