Help with TD Sequential Support/Resistance Lines script

FateOwnzYou

Active member
VIP
VIP Enthusiast
The traditional TD Sequence 1-9 also adds in what Tom Demark called TDST lines which i believe stands for Support Trend. So on a Sell setup when the sequence is counting 1 through 9 on an ascending price, you place a horizontal line on the lowest wick out of those 9 (which is most the time the 1, but not always). Same with a buy setup when the sequence is counting 1 thru 9 on a descending price, you would place a horizontal line on the highest wick out of those 9. These lines provide great support and resistance lines. When the price is above the line and drops through it though and the support failed, the line is support to delete. I find these lines great for swing trading. Is there anyone that could help out with a script with this? I have gotten the sequence numbers to work and to place a line on the bottom of the 1 wick, but the 1 isnt always the lowest wick, just most of the time. I wish to make this accurate. Anyone have anything already doing this? or maybe help script it?

Example here

Untitled.png
 

BenTen

Administrative
Staff
VIP
I looked into this. Unfortunately, ThinkorSwim doesn't disclose the source code for its SequenceCounter indicator. Without the code, we can't add the high and low to each sequence count.
 

FateOwnzYou

Active member
VIP
VIP Enthusiast
Here is a snippet that will plot the numbers of the sequence. Im not sure how to get rid of the the numbers if the sequence is incomplete though. So it will show each sequence on countup and just keep the number even if the sequence is incomplete

Code:
def SetUpCount = CompoundValue(1, if close > close[4]
                 then SetUpCount[1] + 1
                 else if close < close[4]
                 then 0
                 else SetUpCount[1], 1);

plot Count = if SetUpCount == 0 or
                SetUpCount == SetUPCount[1] or
                SetUpCount > 9
             then double.nan
             else SetUpCount;
     Count.SetPaintingStrategy(PaintingStrategy.Values_Above);
     Count.Setdefaultcolor(color.cyan);
 
Last edited:

FateOwnzYou

Active member
VIP
VIP Enthusiast
Okay, so now I have made it to where it plots a horizontal line to where the low is on a ascending count. which is great, just what ive been trying to do. But the horizontal line only shows under 1 bar, im trying to figure out how to extend it to current time. Then after solving this, i need the line to disappear after price closes below it

Code:
def SetUpCount = CompoundValue(1, if close > close[4]
                 then SetUpCount[1] + 1
                 else if close < close[4]
                 then 0
                 else SetUpCount[1], 1);
def setup9 = setupcount == 9;

plot Count = if SetUpCount == 0 or
                SetUpCount == SetUPCount[1] or
                SetUpCount > 9
             then double.nan
             else SetUpCount;
     Count.SetPaintingStrategy(PaintingStrategy.Values_Above);
     Count.Setdefaultcolor(color.cyan);

Def lowInPeriod = if SetUpCount == 9 then Lowest(low, 9) else double.nan;
plot low = lowInPeriod;
low.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 

Similar threads

Top