SVE Pivots Indicator for ThinkorSwim

Shane

New member
just trying to figure out how to get a 5 hour pivot point. I use SVEPivots and use the 4 hour setting but find the 5 hour pivots listed on investing.com more accurate and would like to mark the 5 hour pivot on my thinkorswim chart if possible. Anyone have code for this? Thanks for your help.
 
Does anyone know how to make a label for the SVE Pivots? Every time I try It only gives me the R3 price and I am looking for the price of every line to show.

Code:
# SVEPivots
# TD Ameritrade IP Company, Inc. (c) 2018-2020
#

input aggregationPeriod = AggregationPeriod.DAY;

def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

plot R3;
plot R3M;
plot R2;
plot R2M;
plot R1;
plot R1M;
plot HH;
plot PP;
plot LL;
plot S1M;
plot S1;
plot S2M;
plot S2;
plot S3M;
plot S3;

HH = PH;
LL = PL;
PP = (PH + PL + PC) / 3;
R1 = 2 * PP - PL;
R1M = (R1 - PP) / 2 + PP;
R2 = PP + (PH - PL);
R2M = (R2 - R1) / 2 + R1;
R3 = 2 * PP + (PH - 2 * PL);
R3M = (R3 - R2) / 2 + R2;
S1 = 2 * PP - PH;
S1M = (PP - S1) / 2 + S1;
S2 = PP - (PH - PL);
S2M = (S1 - S2) / 2 + S2;
S3 = 2 * PP - (2 * PH - PL);
S3M = (S2 - S3) / 2 + S3;

R3.SetDefaultColor(GetColor(5));
R3M.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R2M.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
R1M.SetDefaultColor(GetColor(5));
HH.SetDefaultColor(GetColor(4));
PP.SetDefaultColor(GetColor(0));
LL.SetDefaultColor(GetColor(1));
S1.SetDefaultColor(GetColor(6));
S1M.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S2M.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S3M.SetDefaultColor(GetColor(6));

R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

R3M.SetStyle(Curve.SHORT_DASH);
R2M.SetStyle(Curve.SHORT_DASH);
R1M.SetStyle(Curve.SHORT_DASH);
HH.SetStyle(Curve.MEDIUM_DASH);
LL.SetStyle(Curve.MEDIUM_DASH);
S1M.SetStyle(Curve.SHORT_DASH);
S2M.SetStyle(Curve.SHORT_DASH);
S3M.SetStyle(Curve.SHORT_DASH);

R3M.Hide();
R2M.Hide();
R1M.Hide();
HH.Hide();
LL.Hide();
S1M.Hide();
S2M.Hide();
S3M.Hide();
 
Hello everyone i use pivot points as strategy, im trying to built watchlist/scanner that will alert me every time a stock hit S3 or R3 but cant make it to work. the indicator called SVEPivots is anyone using it or willing to help?
 
Hello everyone i use pivot points as strategy, im trying to built watchlist/scanner that will alert me every time a stock hit S3 or R3 but cant make it to work. the indicator called SVEPivots is anyone using it or willing to help?


i removed the second aggregation parameters. can't use them in a column or scan.

set the environment to DAY

----------------------------------------------

column study link
zpivotcross
http://tos.mx/NBAx2FG

column study
colors the column cell cyan when r3 or s3 is crossed


Code:
# zpivotcross

# SVEPivots_01_s3r3_cross

#https://usethinkscript.com/threads/svepivots-indicator-i-want-to-built-a-scanner-based-on-theis-indicator-need-some-help.11745/

# SVEPivots indicator I want to built a scanner based on theis indicator need some help
# yahalomi3  Start dateWednesday at 1:45 PM  Tagsunanswered
# Hello everyone i use pivot points as strategy, im trying to built watchlist/scanner that will alert me every time a stock hit S3 or R3 but cant make it to work. the indicator called SVEPivots is anyone using it or willing to help?


# set to day

# SVEPivots
# TD Ameritrade IP Company, Inc. (c) 2018-2022
#input aggregationPeriod = AggregationPeriod.DAY;

#def PH = high(period = aggregationPeriod)[1];
#def PL = low(period = aggregationPeriod)[1];
#def PC = close(period = aggregationPeriod)[1];

#declare lower;

def bn = barnumber();

def PH = high[1];
def PL = low[1];
def PC = close[1];


def R3;
def R3M;
def R2;
def R2M;
def R1;
def R1M;
def HH;
def PP;
def LL;
def S1M;
def S1;
def S2M;
def S2;
def S3M;
def S3;

HH = PH;
LL = PL;
PP = (PH + PL + PC) / 3;
R1 = 2 * PP - PL;
R1M = (R1 - PP) / 2 + PP;
R2 = PP + (PH - PL);
R2M = (R2 - R1) / 2 + R1;
R3 = 2 * PP + (PH - 2 * PL);
R3M = (R3 - R2) / 2 + R2;
S1 = 2 * PP - PH;
S1M = (PP - S1) / 2 + S1;
S2 = PP - (PH - PL);
S2M = (S1 - S2) / 2 + S2;
S3 = 2 * PP - (2 * PH - PL);
S3M = (S2 - S3) / 2 + S3;

def s3x = close crosses s3;
def r3x = close crosses r3;

def s3cross_cnt = if bn == 1 then 0 else if s3x then s3cross_cnt[1] + 1 else s3cross_cnt[1];
def r3cross_cnt = if bn == 1 then 0 else if r3x then r3cross_cnt[1] + 1 else r3cross_cnt[1];

#addlabel(1, "s3 crosses " + s3cross_cnt, color.yellow);
#addlabel(1, "r3 crosses " + r3cross_cnt, color.yellow);

#addverticalline(s3x, "s3 x", color.green);
#addverticalline(r3x, "r3 x", color.red);

#plot zs3x = s3x;
#plot zr3x = r3x;

plot z = s3x or r3x;
z.setdefaultcolor(color.black);
assignbackgroundcolor( if z then color.cyan else color.gray);
#


----------------------------------------------



lower test study
draws pulses. goes to 1 when a cross happens

Code:
# SVEPivots_01_s3r3_cross

#https://usethinkscript.com/threads/svepivots-indicator-i-want-to-built-a-scanner-based-on-theis-indicator-need-some-help.11745/

# SVEPivots indicator I want to built a scanner based on theis indicator need some help
# yahalomi3  Start dateWednesday at 1:45 PM  Tagsunanswered
# Hello everyone i use pivot points as strategy, im trying to built watchlist/scanner that will alert me every time a stock hit S3 or R3 but cant make it to work. the indicator called SVEPivots is anyone using it or willing to help?


# set to day

# SVEPivots
# TD Ameritrade IP Company, Inc. (c) 2018-2022
#input aggregationPeriod = AggregationPeriod.DAY;

#def PH = high(period = aggregationPeriod)[1];
#def PL = low(period = aggregationPeriod)[1];
#def PC = close(period = aggregationPeriod)[1];

declare lower;

def bn = barnumber();

def PH = high[1];
def PL = low[1];
def PC = close[1];


def R3;
def R3M;
def R2;
def R2M;
def R1;
def R1M;
def HH;
def PP;
def LL;
def S1M;
def S1;
def S2M;
def S2;
def S3M;
def S3;

HH = PH;
LL = PL;
PP = (PH + PL + PC) / 3;
R1 = 2 * PP - PL;
R1M = (R1 - PP) / 2 + PP;
R2 = PP + (PH - PL);
R2M = (R2 - R1) / 2 + R1;
R3 = 2 * PP + (PH - 2 * PL);
R3M = (R3 - R2) / 2 + R2;
S1 = 2 * PP - PH;
S1M = (PP - S1) / 2 + S1;
S2 = PP - (PH - PL);
S2M = (S1 - S2) / 2 + S2;
S3 = 2 * PP - (2 * PH - PL);
S3M = (S2 - S3) / 2 + S3;

def s3x = close crosses s3;
def r3x = close crosses r3;

def s3cross_cnt = if bn == 1 then 0 else if s3x then s3cross_cnt[1] + 1 else s3cross_cnt[1];
def r3cross_cnt = if bn == 1 then 0 else if r3x then r3cross_cnt[1] + 1 else r3cross_cnt[1];

addlabel(1, "s3 crosses " + s3cross_cnt, color.yellow);
addlabel(1, "r3 crosses " + r3cross_cnt, color.yellow);

#addverticalline(s3x, "s3 x", color.green);
#addverticalline(r3x, "r3 x", color.red);

#plot zs3x = s3x;
#plot zr3x = r3x;

plot z = s3x or r3x;
#
 
This seems like a good place to ask this question. Can anyone limit the svepivots to a single day for me.
I have tried working on it but i can't get it to work. Thank you in advance!
 
This seems like a good place to ask this question. Can anyone limit the svepivots to a single day for me.
I have tried working on it but i can't get it to work. Thank you in advance!

Here is one that I had previously modified that might work for your request.
It plots the pivots for the selected lookback, defaulted to 1, in the optional right expansion area.
The optional bubbles can be moved sideways at the number entered at input bubblemover.

Screenshot 2023-12-06 085426.png
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2014-2016
#
input show_in_right_expansion = yes;
input lookback = 1;
input aggregationPeriod = AggregationPeriod.DAY;

def PH = high(period = aggregationPeriod)[lookback];
def PL = low(period = aggregationPeriod)[lookback];
def PC = close(period = aggregationPeriod)[lookback];

plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;

PP = if show_in_right_expansion and !isnan(close) then double.nan else (PH + PL + PC) / 3;
R1 = 2 * PP - PL;
R2 = PP + (PH - PL);
R3 = 2 * PP + (PH - 2 * PL);
S1 = 2 * PP - PH;
S2 = PP - (PH - PL);
S3 = 2 * PP - (2 * PH - PL);

R3.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
PP.SetDefaultColor(GetColor(0));
S1.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));

R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

input showbubbles = yes;
input bubblemover = 5;
def bn  = barnumber();
def mo  = bubblemover;
def mo1 = mo + 1;


AddChartBubble(showbubbles and bn==highestall(bn - mo1), pp[mo1], "PP" + lookback, pp.TakeValueColor());
AddChartBubble(showbubbles and bn==highestall(bn - mo1), S1[mo1], "S1-" + lookback, S1.TakeValueColor());
AddChartBubble(showbubbles and bn==highestall(bn - mo1), S2[mo1], "S2-" + lookback, S2.TakeValueColor());
AddChartBubble(showbubbles and bn==highestall(bn - mo1), S3[mo1], "S3-" + lookback, S3.TakeValueColor());
AddChartBubble(showbubbles and bn==highestall(bn - mo1), R1[mo1], "R1-" + lookback, R1.TakeValueColor());
AddChartBubble(showbubbles and bn==highestall(bn - mo1), R2[mo1], "R2-" + lookback, R2.TakeValueColor());
AddChartBubble(showbubbles and bn==highestall(bn - mo1), R3[mo1], "R3-" + lookback, R3.TakeValueColor());

#
 

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

Thread starter Similar threads Forum Replies Date
MP432 Fractal Pivots Indicator - Need help adding signal Questions 1
A AMM w/Trend Pivots Questions 2
Bingy Episodic Pivots Questions 0
R ATR Pivots Questions 2
Z 2nd & 3rd Order pivots Questions 2

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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