# 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.