SSR (Short Sale Restriction) Label for ThinkorSwim?

zeek

zeek

Active member
2019 Donor
Wondering if there`s any script avaliable that shows if a stock currently has the SSR (short sale restriction) on?
If not, can this be coded into a label that simply says SSR when the rule gets active and when the rule is no longer active, the label does not show.
 
zeek

zeek

Active member
2019 Donor
Found it myself from this thinkscript coder on Twitter. If you like it, go over there and give him a follow. Best part about this indicator is that it does not just put the SSR label on the chart but it also auto plots the price line where SSR will trigger. Very useful!

Code:
#yakBro SSR alerts and plot line

def agPeriod = AggregationPeriod.DAY;
def lod = low(period=agPeriod); #low of the day
def cod = close(period=agPeriod);#close of the day

#check previous day SSRon or not
def PDC = lod[1]<=.90*cod[2];
#check Today SSRon or not
def Today =lod<=.90*cod[1];

#check if SSR triggered today or yesterday
def SSRon= PDC or Today;

def showLine = lod <= cod[1]*.91 && !PDC ;
#returns true if (close < 9% negativeVolumeIndex (SSR didnt trigger previous day)

plot SSRLine = if showLine then cod[1]*.90 else Double.NaN; #plots line if price is below 9% from previous close

SSRLine.setPaintingStrategy(PaintingStrategy.line);
SSRLine.setDefaultColor(color.red);

#labels....
Alert(SSRon,"SSR Triggered" +""+ getsymbol() +"@"+ asDollars(SSRLine), Alert.ONCE, Sound.Bell);

AddLabel (SSRon,("SSR !!!"), Color.RED );
AddLabel (showLine,("Trigger @ "+asDollars(SSRLine)), Color.RED );
 
Last edited by a moderator:
T

tomsk

Well-known member
VIP
All the SSR does is to flag if price has dropped 10% from the prior close
Here's a label you can place on your chart - if the stock did not drop 10%, no label is displayed
In other words the label is only displayed if the SSR condition holds true

Code:
def c = close(period = AggregationPeriod.Day);
def P = (c - c[1]) / c[1];
def SSR = P < -0.10;
AddLabel(SSR, "SSR Alert: Percent Chg = " + P, Color.CYAN);
 
zeek

zeek

Active member
2019 Donor
Wondering if anyone can help create a custom watchlist column for SSR. Basically, i want a column that shows if the stock currently has SSR active and if that is true, can say "SSR ON" and color the field red, otherwise if SSR is not currently on, can say "SSR OFF" and color green.

I am hoping someone can create this with the help of the code above, thanks in advance.
 
L

Len20

Member
I just became aware of this SSR Rule. Couldn't find exactly what I was looking for, so here's my take:
Code:
# SSR Label (Short Sale Restriction rule)
# Len20

# RULES:
# Short Sale-Related Circuit Breaker: The circuit breaker would be triggered for a security any day in which the price declines by 10 percent or more from the prior day's closing price.
# Duration of Price Test Restriction: Once the circuit breaker has been triggered, the alternative uptick rule would apply to short sale orders in that security for the remainder of the day as well as the following day.

def c = close(period = AggregationPeriod.DAY);
def l = low(period = AggregationPeriod.DAY);
def changeToday = (l - c[1]) / c[1];
def changeYest  = (l[1] - c[2]) / c[2];
def SSRactive = changeToday < -0.1 or changeYest < -0.1;
AddLabel(SSRactive, "SSR Active", Color.CYAN);


@zeek I realize you posted about the watchlist column 4 months ago but if still need it here's my version:
Code:
# SSR Watchlist Column (Short Sale Restriction rule)
# Len20
# SET COLUMN AGGREGATION TO DAILY

# RULES:
# Short Sale-Related Circuit Breaker: The circuit breaker would be triggered for a security any day in which the price declines by 10 percent or more from the prior day's closing price.
# Duration of Price Test Restriction: Once the circuit breaker has been triggered, the alternative uptick rule would apply to short sale orders in that security for the remainder of the day as well as the following day.

def c = close;
def l = low;
def changeToday = (l - c[1]) / c[1];
def changeYest  = (l[1] - c[2]) / c[2];
def SSRactive = changeToday < -0.1 or changeYest < -0.1;
AddLabel(1, If SSRactive then "SSR ON" else " ", Color.CYAN);
set column aggregation to DAILY
 

Similar threads

Top