How to Scan for SequenceCounter Signals in ThinkorSwim


New member
Hey, im looking for a script which can scan for Demark signals or sequence counter 9 and 13 both buy and sell signals on certain time frames. I want to have it with alerts and want to be able to select what time frame to scan on. Looking to make a watchlist with it Thanks in advance!


New member
Can anyone give me some insight on the error I am getting. (not the best at working thru the logic).

SequenceCounter()."Perfect Buy" is true within 2 bars (on 1 hour)

Get the following error.. Folding: integer 'to' is expected. NaN

what am I missing? thanks


Interesting issue since this study code works.

plot A = if SequenceCounter()."Perfect Buy" is true within 2 bars
         then close()
         else Double.NaN;

I tried using the "perfect buy" formula as well but that ended in tears.


Well-known member
@Sean_C I'm not sure that the SequenceCounter() function is broken but it's definitely a bit quirky... I haven't played with it much to date but may give it a go later this evening...

Edited to add: I found this information on Jim Shinglers site:
The use of the TOS 'SequenceCounter', for intra-day trading, has an advantage when the count can be viewed to multiple aggregations simultaneously. This can be done by setting up a grid of 4 components, as an example. The below picture illustrates doing this. Also configure the chart to synchronize the cursor across all grid charts via Chart settings/general tab/Synchronize crosshair position. A tick chart seems to present a neat plot. Regular grids is suggested in lieu of flexible grids.

The example picture is no longer available on his site...
Last edited:


New member
Can @BenTen help me scan any stock that with sell formation is 1?
🙏 please! Thanks.


Last edited by a moderator:

Similar threads