How to turn off 1 to 7 and only keep 8, 9 and 13 in Sequence Counter indicator in ThinkorSwim?

petergluis

Active member
I would like to know how to modify following code to turn off 1 to 7, 10, 11 and only keep 8, 9 and 13 in Sequence Counter indicator in ThinkorSwim?

Here is a code from ThinkorSwim platform.

input arrayPeriod = 13;
input formationPeriod = 9;

plot "Buy Formation" = Double.NaN;
plot "Sell Formation" = Double.NaN;
plot "Buy Array" = Double.NaN;
plot "Sell Array" = Double.NaN;
plot "Perfect Buy" = Double.NaN;
plot "Perfect Sell" = Double.NaN;
plot "Perfect Array Buy" = Double.NaN;
plot "Perfect Array Sell" = Double.NaN;
 
Last edited:
I would like to know how to modify following code to turn off 1 to 7, 10, 11 and only keep 8, 9 and 13 in Sequence Counter indicator in ThinkorSwim?

Here is a code from ThinkorSwim platform.

input arrayPeriod = 13;
input formationPeriod = 9;

plot "Buy Formation" = Double.NaN;
plot "Sell Formation" = Double.NaN;
plot "Buy Array" = Double.NaN;
plot "Sell Array" = Double.NaN;
plot "Perfect Buy" = Double.NaN;
plot "Perfect Sell" = Double.NaN;
plot "Perfect Array Buy" = Double.NaN;
plot "Perfect Array Sell" = Double.NaN;


the study SequenceCounter is protected. we can't see the code.
but we can experiment and try to figure out the data from the plots.

i looked up the info on the study.
https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/R-S/SequenceCounter

made a test study to display all 8 plotted values.
saw that t1 to t4 had number values that matched the numbers above and below the candles.

made 4 formulas to check for certain values , 8,9,13 , and plot them.


Ruby:
# seqcnt_00

def na = double.nan;

def t1 = SequenceCounter()."Buy Formation";
def t2 = SequenceCounter()."Sell Formation";
def t3 = SequenceCounter()."Buy Array";
def t4 = SequenceCounter()."Sell Array";
def t5 = SequenceCounter()."Perfect Buy";
def t6 = SequenceCounter()."Perfect Sell";
def t7 = SequenceCounter()."Perfect Array Buy";
def t8 = SequenceCounter()."Perfect Array Sell";

input show_test_labels = no;
addlabel(show_test_labels , "seq1 " + t1, color.cyan);
addlabel(show_test_labels , "seq2 " + t2, color.cyan);
addlabel(show_test_labels , "seq3 " + t3, color.cyan);
addlabel(show_test_labels , "seq4 " + t4, color.cyan);
addlabel(show_test_labels , "seq5 " + t5, color.cyan);
addlabel(show_test_labels , "seq6 " + t6, color.cyan);
addlabel(show_test_labels , "seq7 " + t7, color.cyan);
addlabel(show_test_labels , "seq8 " + t8, color.cyan);

# t1 - lower white
# t2 - upper white
# t3 - lower red
# t4 - uper red

#  keep 8, 9, and 13 , ignore other numbers
plot u1 = if t1 == 8 or t1 == 9 or t1 == 13 then t1 else na;
plot u2 = if t2 == 8 or t2 == 9 or t2 == 13 then t2 else na;
plot u3 = if t3 == 8 or t3 == 9 or t3 == 13 then t3 else na;
plot u4 = if t4 == 8 or t4 == 9 or t4 == 13 then t4 else na;

u1.SetPaintingStrategy(PaintingStrategy.VALUES_below);
u1.SetDefaultColor(Color.white);
u1.hidebubble();

u2.SetPaintingStrategy(PaintingStrategy.VALUES_above);
u2.SetDefaultColor(Color.white);
u2.hidebubble();

u3.SetPaintingStrategy(PaintingStrategy.VALUES_below);
u3.SetDefaultColor(Color.red);
u3.hidebubble();

u4.SetPaintingStrategy(PaintingStrategy.VALUES_above);
u4.SetDefaultColor(Color.red);
u4.hidebubble();


# SequenceCounter
# https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/R-S/SequenceCounter
#  plots
# Buy Formation    Consists of "formation period" consecutive bars with: Close < Close[4 bars ago].
# Sell Formation    Consists of "formation period" consecutive bars with: Close > Close[4 bars ago].
# Buy Array    Displays "array period" bars satisfying the condition: Close <= Low[2 bars ago]
# Sell Array    Displays "array period" bars satisfying the condition: Close >= High[2 bars ago]
# Perfect Buy    Buy signals for Formation patterns meeting perfection criteria.
# Perfect Sell    Sell signals for Formation patterns meeting perfection criteria.
# Perfect Array Buy    Buy signals for Array patterns meeting perfection criteria.
# Perfect Array Sell    Sell signals for Array patterns meeting perfection criteria.
#
 
# seqcnt_00 def na = double.nan; def t1 = SequenceCounter()."Buy Formation"; def t2 = SequenceCounter()."Sell Formation"; def t3 = SequenceCounter()."Buy Array"; def t4 = SequenceCounter()."Sell Array"; def t5 = SequenceCounter()."Perfect Buy"; def t6 = SequenceCounter()."Perfect Sell"; def t7 = SequenceCounter()."Perfect Array Buy"; def t8 = SequenceCounter()."Perfect Array Sell"; input show_test_labels = no; addlabel(show_test_labels , "seq1 " + t1, color.cyan); addlabel(show_test_labels , "seq2 " + t2, color.cyan); addlabel(show_test_labels , "seq3 " + t3, color.cyan); addlabel(show_test_labels , "seq4 " + t4, color.cyan); addlabel(show_test_labels , "seq5 " + t5, color.cyan); addlabel(show_test_labels , "seq6 " + t6, color.cyan); addlabel(show_test_labels , "seq7 " + t7, color.cyan); addlabel(show_test_labels , "seq8 " + t8, color.cyan); # t1 - lower white # t2 - upper white # t3 - lower red # t4 - uper red # keep 8, 9, and 13 , ignore other numbers plot u1 = if t1 == 8 or t1 == 9 or t1 == 13 then t1 else na; plot u2 = if t2 == 8 or t2 == 9 or t2 == 13 then t2 else na; plot u3 = if t3 == 8 or t3 == 9 or t3 == 13 then t3 else na; plot u4 = if t4 == 8 or t4 == 9 or t4 == 13 then t4 else na; u1.SetPaintingStrategy(PaintingStrategy.VALUES_below); u1.SetDefaultColor(Color.white); u1.hidebubble(); u2.SetPaintingStrategy(PaintingStrategy.VALUES_above); u2.SetDefaultColor(Color.white); u2.hidebubble(); u3.SetPaintingStrategy(PaintingStrategy.VALUES_below); u3.SetDefaultColor(Color.red); u3.hidebubble(); u4.SetPaintingStrategy(PaintingStrategy.VALUES_above); u4.SetDefaultColor(Color.red); u4.hidebubble(); # SequenceCounter # https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/R-S/SequenceCounter # plots # Buy Formation Consists of "formation period" consecutive bars with: Close < Close[4 bars ago]. # Sell Formation Consists of "formation period" consecutive bars with: Close > Close[4 bars ago]. # Buy Array Displays "array period" bars satisfying the condition: Close <= Low[2 bars ago] # Sell Array Displays "array period" bars satisfying the condition: Close >= High[2 bars ago] # Perfect Buy Buy signals for Formation patterns meeting perfection criteria. # Perfect Sell Sell signals for Formation patterns meeting perfection criteria. # Perfect Array Buy Buy signals for Array patterns meeting perfection criteria. # Perfect Array Sell Sell signals for Array patterns meeting perfection criteria.
Thank you very much for your great help. It works perfectly. Is it possible to enlarge font size a little bit?
 
Thank you very much for your great help. It works perfectly. Is it possible to enlarge font size a little bit?
i don't think so.
the command .setlineweight(5) doesn't have any affect when used with .VALUES_above , .VALUES_below. ( plots , u1,u2,u3,u4)

it does work on most of the paintstrategies.

a simple test code. change what is commented out to try different setpaintingstrategy(
Code:
plot z = low;
z.SetPaintingStrategy(PaintingStrategy.VALUES_above);
#z.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#z.SetPaintingStrategy(PaintingStrategy.BOOLEAN_wedge_UP);
#z.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
z.setlineweight(5);
[/code
 
i don't think so.
the command .setlineweight(5) doesn't have any affect when used with .VALUES_above , .VALUES_below. ( plots , u1,u2,u3,u4)

it does work on most of the paintstrategies.

a simple test code. change what is commented out to try different setpaintingstrategy(
Code:
plot z = low;
z.SetPaintingStrategy(PaintingStrategy.VALUES_above);
#z.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#z.SetPaintingStrategy(PaintingStrategy.BOOLEAN_wedge_UP);
#z.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
z.setlineweight(5);
[/code
Thank you very much for your help. I will use your suggested approach to modify your previous code.
 
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
356 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