ThinkorSwim Daily Price Change Scanner

EKM

New member
I would like to create an alert for a daily percentage drop in a stock of greater or equal to 10%. Please help.

Thanks,

EKM
 

XeoNoX

Well-known member
VIP
That's a standard built-in scan. set it like below to your liking and then save as a watchlist and set the alert. insctuction for setting scan to alert can be found on youtube.

9rcGKUO.png
 
  • Like
Reactions: EKM

Andygray8

Member
VIP
Hey BenTen coming back to the well again here. Wanted to run a simple scan on my master watchlist that simply highlights stocks that are either up or down 5% or greater. Inclusive of pre/post market would be nice but not critical. I searched a bunch of pages of various indicators but most of them seemed to be more complex strategies than that. Much appreciated!
 

XeoNoX

Well-known member
VIP
Here goes the code for Current Day Change from Premarket Open

Code:
#Current Day Change from Premarket Open
input openingPMTime  = 0400.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
input endTime  = 1600.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.

def na = Double.NaN;
def isDaily = If (GetAggregationPeriod() == AggregationPeriod.DAY, yes, no);
def isBelowDaily = If (GetAggregationPeriod() < AggregationPeriod.DAY, yes, no);
def isToday = If (GetDay() == GetLastDay() and SecondsFromTime(openingPMTime) >= 0, yes, no);
def day = GetDay();

def PMopenBar = day != day[1];
def PMOpen = if PMopenBar then open else PMOpen[1];
def MClose = !IsNaN(close) and IsNaN(close[-1]);

def PMO = if isToday and isBelowDaily then PMOpen else na;
def PMC = if isToday and MClose then close else na;

def Change = PMC-PMO;
def Change_Percent= round((Change/PMO)*100,2);

AddLabel (yes, "Change: " +  (Change)  );
AddLabel (yes, "  % Change: "  +  ( Change_Percent)  );

So to scan you would change the ending to:

Code:
def Change = PMC-PMO;
def Change_Percent= round((Change/PMO)*100,2);

plot scan = Change_Percent > 10;
this will make it a scanner
 
Last edited:

Andygray8

Member
VIP
@XeoNoX Amazing thanks for your help!

So would be:

Code:
def Change = PMC-PMO;
def Change_Percent= round((Change/PMO)*100,2);

plot scan = Change_Percent > 10;

This will make it a scanner

So would look like:

Code:
input openingPMTime  = 0400.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
input endTime  = 1600.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.

def na = Double.NaN;
def isDaily = If (GetAggregationPeriod() == AggregationPeriod.DAY, yes, no);
def isBelowDaily = If (GetAggregationPeriod() < AggregationPeriod.DAY, yes, no);
def isToday = If (GetDay() == GetLastDay() and SecondsFromTime(openingPMTime) >= 0, yes, no);
def day = GetDay();

def PMopenBar = day != day[1];
def PMOpen = if PMopenBar then open else PMOpen[1];
def MClose = !IsNaN(close) and IsNaN(close[-1]);

def PMO = if isToday and isBelowDaily then PMOpen else na;
def PMC = if isToday and MClose then close else na;

def Change = PMC-PMO;
def Change_Percent= round((Change/PMO)*100,2);

plot scan = Change_Percent > 10;

You would enter this under custom studies in the scanner tab right?
 

Andygray8

Member
VIP
Make sure to set your time/chart aggregation correctly in the scan.
Yeah I made sure to set aggregation to D (day) and it doesn't throw up any errors just doesn't come back with any results.

Does all the Yes/No and GetAggregation stuff stay or does that need to be answered or deleted by me?

Btw I changed the change to 1% and still didn't get any results.
 

XeoNoX

Well-known member
VIP
Yeah I made sure to set aggregation to D (day) and it doesn't throw up any errors just doesn't come back with any results.

Does all the Yes/No and GetAggregation stuff stay or does that need to be answered or deleted by me?

Btw I changed the change to 1% and still didn't get any results.
thats why its not working for you, you have it set to DAY... you said you wanted to scan for premarket and aftermarket, if you set it to DAY, it wont let you can for EXT (EXTENDED HOURS). if you want it to scan for extended hours you have to have extended hours checked. there is not EXTEDNED hours (a.k.a premarket/aftermarket) if you set it to DAY. Minute or 5mins would probably be your best scenario
 

Andygray8

Member
VIP
thats why its not working for you, you have it set to DAY... you said you wanted to scan for premarket and aftermarket, if you set it to DAY, it wont let you can for EXT (EXTENDED HOURS). if you want it to scan for extended hours you have to have extended hours checked. there is not EXTEDNED hours (a.k.a premarket/aftermarket) if you set it to DAY. Minute or 5mins would probably be your best scenario
OK will give that a try! Thanks Xeo!
 

Andygray8

Member
VIP
thats why its not working for you, you have it set to DAY... you said you wanted to scan for premarket and aftermarket, if you set it to DAY, it wont let you can for EXT (EXTENDED HOURS). if you want it to scan for extended hours you have to have extended hours checked. there is not EXTEDNED hours (a.k.a premarket/aftermarket) if you set it to DAY. Minute or 5mins would probably be your best scenario
Works perfectly you're the man thanks XeoNoX!
 

Similar threads

Top