SequenceCounter scan for Buy or Sell conditions



Trying to understand the Sequence Counter parameters to say Buy set up is True or Sell set up is true for either the 9 count or the 13 count scenarios.




Marked as spam
Posted by (Questions: 4, Answers: 1)
Asked on April 9, 2020 5:54 pm

There are 8 separate plots for this chart study. Which ones are you trying to use to build your scans? You only mentioned Buy and Sell. However there are no plots by those names in this chart study. Here are the available plots:

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;

Please clearly explain which ones you want to use for your scan signals.

( at April 9, 2020 8:07 pm)
Pete, Following on the topic, can you show the custom script needed to create a dynamic watchlist for Buy and/or Sell Formations? Thank you.
( at August 12, 2020 10:48 am)
A dynamic watchlist is nothing more than a scan that has been saved and set as the source for a watchlist gadget. Any scan can be used for this purpose. The solution is the same for both. However the author of this post never provided the details I requested so there is no solution at this time.
( at August 12, 2020 1:53 pm)
Pete, So to create the scan I make a reference to the study and choose one of the plots above. Can I have more than one plot in the scan, like Buy Formation and Buy Array? When I tried more than one plot I got a message that said only one plot required.
( at August 13, 2020 7:14 am)
Private answer

While the original author of the question failed to provide any details about which of the signals they wanted to use for the scan we do have another viewer expressing an interest. In the comments section above you can see the other viewer has requested how to construct a scan from the "Buy Formation" and from the "Buy Array".

Let's convert these to true/false conditions and see what they look like on the chart. The code below can be used to create a new chart study. It will plot the true/false conditions that the scan would use to pick up these signals. In the lower study you will find the spikes in the blue and red lines correspond with the values displayed for the two plots listed in the paragraph above.

declare lower;
def testOne = SequenceCounter()."Buy Formation";
def testTwo = SequenceCounter()."Buy Array";
plot dataOne = !IsNaN(testOne);
plot dataTwo = !IsNaN(testTwo);

I have included a screenshot below to show what this looks like on the chart.

You can see that it's not as simple as requesting a scan for "Buy Formation" or "Buy Array". Those are not signals, the indicator actually plots values. So do you want the scan to pick up anytime there is a number printed at the bottom of a candle? Or does the value of the number have some significance so that you require the code to look for a specific value?

Having seen this for myself, I can't imagine anyone asking for a scan for this indicator without explaining what values matter to them. However if all you need is any value at all then the scan looks like this:

def buySequence = SequenceCounter()."Buy Formation";
plot scan = !IsNaN(buySequence);

And yes, a scan can only have one plot statement. If you did not know this about custom scans you can watch any one of our several free tutorials on custom scans to learn that. If this is new information to you I suggest you spend some time viewing our scan tutorials before requesting a custom scan of your own.

Marked as spam
Posted by (Questions: 37, Answers: 3223)
Answered on August 13, 2020 8:33 am
Pete, Sorry I was not specific enough. I want a Buy formation when it prints #9 and a Buy Array when it prints #13.
( at August 13, 2020 9:19 am)
Thanks so much for providing the most important piece of information to complete this request. Now here is the bad news. When I try to construct a scan using the SequenceCounter chart study the scan rejects the code saying it is to complex to run as a scan. We cannot construct a scan using this indicator on Thinkorswim. I also checked to see if we could use the Study Alert or a custom watchlist column but both of those failed as well. Best we do with this is to create a chart study with an alert based on those values.
( at August 13, 2020 10:34 am)
Pete, Thank you for spending time on this request!
( at August 16, 2020 6:31 am)