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
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
@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
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
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
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

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top