PersonsPivots (PPS) Indicator for ThinkorSwim

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
 
Hi,
I am comparing the replica with the real one and the signals are completed different.
Any idea why?
Example NQ 5min
 
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:
taking the script posted by @2sureshk as basis, and comparing with the original PPS arrows, the script above reproduces very close to the original, though it produces some false signals but I would say in general quite close to the intended trend change detection which is really the end objective of the use of the PPS indicator. I have tried it with a few stocks and timeframes and would like comments from fellow subscribers how it works for them. I come up with the trend conditions in the script by observation and comparation withe the original arrows. Just to make more visual the changes an optional colored background was added

This is my last update to the PPS replica, with slight change in the trend conditions which I felt were more accurate. As said before, comments on how to improve are welcomed.
iNRcinI.png

Ruby:
# PPS replica
# Mobius

input background = yes;
input n = 2;
input n2 = 6; # orginal = 7
input n3 = 5;
input n4 = 4;
input averageType = AverageType.Exponential;
#input lookback = 8;

input src = close;
input q = ohlc4;
def c = src;
def h = high;
def o = open;
def w = low;

plot data = Average(Inertia(c, n), n2);
plot data2 = ExpAverage(Inertia( q, n3), n4);
plot data3 = MovingAverage(averageType, Inertia( src, n3), n4-1);

def f = data3;
def s = data;

#Bullish conditions
def c1 = f>f[1] or (s>s[1] and s>f);
def c2 = close > Max(f,s);
def c3 = close > s[1] ;
def c4 = close > open;
def c51 = Max(open,close);
def c5 = close > c51[1];
def c6 = f>f[1] and s>s[1] and low > Max(f,s);
def uup = c1 and c2 and c3 and ((c4 and c5) or c6);

#Bearish conditions
def d1 = f<f[1] or (s<s[1] and s<f);
def d2 = close < Min(f,s);
def d3 = close < s[1] ;
def d4 = close < open;
def d51 = Min(open,close);
def d5 = close < d51[1];
def d6 = f<f[1] and s<s[1] and high < Min(f,s);

def ddn = d1 and d2 and d3 and ((d4 and d5) or d6);

def cond = if uup then 1 else if ddn then -1 else cond[1];

plot ArrowUP = cond == 1 and cond[1] == -1;
plot ArrowDN = cond == -1 and cond[1] == 1;
ArrowUP.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_UP);
ArrowDN.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
ArrowUP.AssignValueColor(Color.WHITE);
ArrowDN.AssignValueColor(Color.WHITE);


# general background
def up = cond == 1;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;

DefineGlobalColor("dgreen" , CreateColor(0,59,0));
DefineGlobalColor("dred" , CreateColor(79,0,0));
#-- Background
AddCloud(if up and background then pos else if background then neg else Double.NaN, if up and background then neg else if background then pos else Double.NaN, GlobalColor("dgreen"), GlobalColor("dred"));
 
Last edited by a moderator:

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