scan that would show when there has been 3 of the same price as a high / low

Vcco

New member
I was wondering if there is something similar to:
https://usethinkscript.com/threads/bulkowski-double-bottom-indicator-for-thinkorswim.118/#post-604
but a little different. I am playing around with the double bottom indicator, and feel like it has something to do with "Pivot Length" and "Tolerance Percentage" .

Is it possible to make an indicator / scan that would show when there has been 3 of the same price as a high / low. Example below on SQ from todays trading session.

It hit 63.00 3 times in a row , I'm looking for something that would instead of "Breakout Price" would highlight "Pivot" every time a price has 3 consecutive highs



Thank you!!
 
Last edited by a moderator:
Solution
I was wondering if there is something similar to:
https://usethinkscript.com/threads/bulkowski-double-bottom-indicator-for-thinkorswim.118/#post-604
but a little different. I am playing around with the double bottom indicator, and feel like it has something to do with "Pivot Length" and "Tolerance Percentage" .

Is it possible to make an indicator / scan that would show when there has been 3 of the same price as a high / low. Example below on SQ from todays trading session.

It hit 63.00 3 times in a row , I'm looking for something that would instead of "Breakout Price" would highlight "Pivot" every time a price has 3 consecutive highs


you mentioned scan and display words, so i'm not sure what you want.
i made this up...
I was wondering if there is something similar to:
https://usethinkscript.com/threads/bulkowski-double-bottom-indicator-for-thinkorswim.118/#post-604
but a little different. I am playing around with the double bottom indicator, and feel like it has something to do with "Pivot Length" and "Tolerance Percentage" .

Is it possible to make an indicator / scan that would show when there has been 3 of the same price as a high / low. Example below on SQ from todays trading session.

It hit 63.00 3 times in a row , I'm looking for something that would instead of "Breakout Price" would highlight "Pivot" every time a price has 3 consecutive highs


you mentioned scan and display words, so i'm not sure what you want.
i made this up chart study.

this will look for x bars in a row, at the same high, or same low price, and draw arrows, on the main chart.

can choose how many bars are to be near the same price.
it checks if adjacent bars have a price within x % . the default is 0.02%. set to 0 if you want prices exactly the same.

can choose to also look for a pivot. it just looks at the bars before the same bars, so i'm calling this condition a half pivot. (it doesn't look at the bars after the same bars).

can show dots for the same price conditions and half pivots.


Code:
# same_price_for_x_bars_0

# https://usethinkscript.com/threads/scan-that-would-show-when-there-has-been-3-of-the-same-price-as-a-high-low.13246/
# scan that would show when there has been 3 of the same price as a high / low

#-----------------------------------

def na = double.nan;
def bn = barnumber();

input min_qty_of_same_price = 3;
def minq = min_qty_of_same_price;

# matching price tolerance percent
input match_tol_percent = 0.02;
def ishimatch_per = absvalue(high[1] - high) <= (high * (match_tol_percent/100));
def islomatch_per = absvalue(low[1] - low) <= (low * (match_tol_percent/100));

# were there x bars in a row, that had a price within y %?
def hix = if bn <= minq then 0 else (sum(ishimatch_per, minq-1) == (minq-1));
def lox = if bn <= minq then 0 else (sum(islomatch_per, minq-1) == (minq-1));

input pivot_len = 5;
# the previous bars form half a pivot 
input check_for_half_pivot = yes;
input arrows = yes;
input dots_same_price = yes;

def vert1 = 0.003;
plot zhix = if (dots_same_price and hix) then (high * (1 + (2 * vert1))) else na;
zhix.SetPaintingStrategy(PaintingStrategy.POINTS);
zhix.SetDefaultColor(Color.yellow);
zhix.setlineweight(3);
zhix.hidebubble();
plot zlox = if (dots_same_price and lox) then (low * (1 - (2 * vert1))) else na;
zlox.SetPaintingStrategy(PaintingStrategy.POINTS);
zlox.SetDefaultColor(Color.blue);
zlox.setlineweight(3);
zlox.hidebubble();

#---------------------------
# half a pivot check, look at prev x bars
# check if prev highs were lower, or prev lows were higher
#input check_for_pivot = yes;
#input pivot_len = 5;
def hipiv = if !check_for_half_pivot then 1 else (high[minq-1] > highest(high[minq], pivot_len));
def lopiv = if !check_for_half_pivot then 1 else (low[minq-1] < lowest(low[minq], pivot_len));




input dots_pivot = yes;
plot zhipiv = if (dots_pivot and hipiv) then (high * (1 + (3 * vert1))) else na;
zhipiv.SetPaintingStrategy(PaintingStrategy.POINTS);
#zhipiv.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
zhipiv.SetDefaultColor(Color.red);
zhipiv.setlineweight(3);
zhipiv.hidebubble();
plot zlopiv = if (dots_pivot and lopiv) then (low * (1 - (3 * vert1))) else na;
zlopiv.SetPaintingStrategy(PaintingStrategy.POINTS);
#zlopiv.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
zlopiv.SetDefaultColor(Color.green);
zlopiv.setlineweight(3);
zlopiv.hidebubble();

#-----------------------------------

def downx = (hix and hipiv);
def upx = (lox and lopiv);

#input arrows = yes;
plot zdownx = if (arrows and downx) then (high * (1 + (0.5 * vert1))) else na;
zdownx.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#zdownx.SetPaintingStrategy(PaintingStrategy.POINTS);
zdownx.SetDefaultColor(Color.red);
zdownx.setlineweight(3);
zdownx.hidebubble();

plot zupx = if (arrows and upx) then (low * (1 - (0.5 * vert1))) else na;
zupx.SetPaintingStrategy(PaintingStrategy.ARROW_up);
#zupx.SetPaintingStrategy(PaintingStrategy.POINTS);
zupx.SetDefaultColor(Color.green);
zupx.setlineweight(3);
zupx.hidebubble();
#

SWN 1min
iEV0tzb.jpg
 
Solution

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

you mentioned scan and display words, so i'm not sure what you want.
i made this up chart study.

this will look for x bars in a row, at the same high, or same low price, and draw arrows, on the main chart.

can choose how many bars are to be near the same price.
it checks if adjacent bars have a price within x % . the default is 0.02%. set to 0 if you want prices exactly the same.

can choose to also look for a pivot. it just looks at the bars before the same bars, so i'm calling this condition a half pivot. (it doesn't look at the bars after the same bars).

can show dots for the same price conditions and half pivots.


Code:
# same_price_for_x_bars_0

# https://usethinkscript.com/threads/scan-that-would-show-when-there-has-been-3-of-the-same-price-as-a-high-low.13246/
# scan that would show when there has been 3 of the same price as a high / low

#-----------------------------------

def na = double.nan;
def bn = barnumber();

input min_qty_of_same_price = 3;
def minq = min_qty_of_same_price;

# matching price tolerance percent
input match_tol_percent = 0.02;
def ishimatch_per = absvalue(high[1] - high) <= (high * (match_tol_percent/100));
def islomatch_per = absvalue(low[1] - low) <= (low * (match_tol_percent/100));

# were there x bars in a row, that had a price within y %?
def hix = if bn <= minq then 0 else (sum(ishimatch_per, minq-1) == (minq-1));
def lox = if bn <= minq then 0 else (sum(islomatch_per, minq-1) == (minq-1));

input pivot_len = 5;
# the previous bars form half a pivot
input check_for_half_pivot = yes;
input arrows = yes;
input dots_same_price = yes;

def vert1 = 0.003;
plot zhix = if (dots_same_price and hix) then (high * (1 + (2 * vert1))) else na;
zhix.SetPaintingStrategy(PaintingStrategy.POINTS);
zhix.SetDefaultColor(Color.yellow);
zhix.setlineweight(3);
zhix.hidebubble();
plot zlox = if (dots_same_price and lox) then (low * (1 - (2 * vert1))) else na;
zlox.SetPaintingStrategy(PaintingStrategy.POINTS);
zlox.SetDefaultColor(Color.blue);
zlox.setlineweight(3);
zlox.hidebubble();

#---------------------------
# half a pivot check, look at prev x bars
# check if prev highs were lower, or prev lows were higher
#input check_for_pivot = yes;
#input pivot_len = 5;
def hipiv = if !check_for_half_pivot then 1 else (high[minq-1] > highest(high[minq], pivot_len));
def lopiv = if !check_for_half_pivot then 1 else (low[minq-1] < lowest(low[minq], pivot_len));




input dots_pivot = yes;
plot zhipiv = if (dots_pivot and hipiv) then (high * (1 + (3 * vert1))) else na;
zhipiv.SetPaintingStrategy(PaintingStrategy.POINTS);
#zhipiv.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
zhipiv.SetDefaultColor(Color.red);
zhipiv.setlineweight(3);
zhipiv.hidebubble();
plot zlopiv = if (dots_pivot and lopiv) then (low * (1 - (3 * vert1))) else na;
zlopiv.SetPaintingStrategy(PaintingStrategy.POINTS);
#zlopiv.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
zlopiv.SetDefaultColor(Color.green);
zlopiv.setlineweight(3);
zlopiv.hidebubble();

#-----------------------------------

def downx = (hix and hipiv);
def upx = (lox and lopiv);

#input arrows = yes;
plot zdownx = if (arrows and downx) then (high * (1 + (0.5 * vert1))) else na;
zdownx.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#zdownx.SetPaintingStrategy(PaintingStrategy.POINTS);
zdownx.SetDefaultColor(Color.red);
zdownx.setlineweight(3);
zdownx.hidebubble();

plot zupx = if (arrows and upx) then (low * (1 - (0.5 * vert1))) else na;
zupx.SetPaintingStrategy(PaintingStrategy.ARROW_up);
#zupx.SetPaintingStrategy(PaintingStrategy.POINTS);
zupx.SetDefaultColor(Color.green);
zupx.setlineweight(3);
zupx.hidebubble();
#

SWN 1min
iEV0tzb.jpg

Oh man you are a legend.

Seriously, this is VERY VERY much appreciated.

Saved me a ton of time on visual backtesting!!!

Cheers,
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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