Scan for % change

shahgols

New member
Hi all, I am trying to create a scan that lists stocks that have gone up 1% or more from today's open price. I found this script online, which supposedly shows the % change from the open price, but how do I change this or how do I set up a scan that will show me only stocks that have gone up 1% or more? Thanks in advance.

plot x = round(100*((close/open)-1),1);
 
I have the below custom indicator to show the % change since the Open for the Watchlist. However, it does not work on the mobile app. I believe this has to do with the Aggregation Period being the day, but not completely sure. Anyone know how to modify the code to get it to work on the mobile app? For anyone who doesn't have the below code, feel free to take it - it works great on TOS desktop.

%Open
Code:
def x = close / open -1 ;
Def upday = x > 0;
Def downday = x < 0;
Input DisplayX = yes;
addlabel(yes,aspercent(X),if downday then color.red else if upday then color.blue else color.yellow
);
 
I have the below custom indicator to show the % change since the Open for the Watchlist. However, it does not work on the mobile app. I believe this has to do with the Aggregation Period being the day, but not completely sure. Anyone know how to modify the code to get it to work on the mobile app? For anyone who doesn't have the below code, feel free to take it - it works great on TOS desktop.

%Open
Code:
def x = close / open -1 ;
Def upday = x > 0;
Def downday = x < 0;
Input DisplayX = yes;
addlabel(yes,aspercent(X),if downday then color.red else if upday then color.blue else color.yellow
);

You aren't setting an AggregationPeriod so I doubt that is the issue... Are you sure AddLabel() is supported on Mobile...??? I don't use Mobile so I can't say whether it is or not but I know Mobile has limitations...
 
Hi guys,

I'm new to coding but having a hard time getting this to work.

I'm trying to narrow down my scans to stocks that had a "price percent change today" between -1.00% to +1.00%.

This is what I have so far:

def conditionOne = 100 * (close / close[1]) / close[1] between -1.00 and +1.00;

plot scan= conditionOne;


But I end up with stocks that have gone up +12.60% or 7.84% for the day, not between the -1.00 to +1.00 % parameters I was hoping for.

Any help with more experienced coders would be appreciated please!!
 
I'm trying to make a scan to see what has fallen at open.
I'm looking for stocks that fell at least 5%
All I can think to do is this: but I cant think of how to fit the 5% part in? thanks!

Code:
close is less than open("period" = AggregationPeriod.DAY)
 
At the open, or from the open? That is a big difference. Are you scanning for gaps, or are you scanning stocks that fell relative to todays open?
 
I have some similar issue my study it calculates
I made a Percentage Change on TOS. IT calculates:
- From Pregvious CLose to Opening
-From Open to HOD

-Percentage Pullback from HOD
-Percentage Change From Open to Last (or End of Day)(edited)
-Ave Vol for the Last 10 Days
you can change how many days u want to average the volume
The issue for me it gets the HOD since premarket and I thought I have a condition but is not working the code is :
Code:
#Created by Arlette Rosario
#Display percentage change from yesterday and from open

#- Certain time from 9:30-16:00
def alertPeriodStart = 0930;
def alertPeriodEnd = 1600;
def startCounter = SecondsFromTime(alertPeriodStart);
def endCounter = SecondsTillTime(alertPeriodEnd);
def alertPeriod = if startCounter >= 0 and endCounter >= 0 then 1 else 0;

#-------------------------------------------------------

input length=10;
input period= aggregationPeriod.DAY;
input displaylabel=yes;

#-------------------------------------------------------------------------
#This calculaes Percentage change From High to current until Close of the Day
#In other words Percentage Retracement or pullback
#input percentGain = 20.0;

#plot priorDayClose = close(period = AggregationPeriod.DAY)[1]
def percentRetrace = 10.0;
plot priorDayClose = close(period = AggregationPeriod.DAY)[1];
priorDayClose.SetDefaultColor(Color.GRAY);
priorDayClose.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
def newDay = GetDay() <> GetDay()[1];
rec trackHighOfDay = if newDay then open(period = period)[0] else if high[0] > trackHighOfDay[1] then high else trackHighOfDay[1];
plot highOfDay = trackHighOfDay[0];
highOfDay.SetDefaultColor(Color.CYAN);
highOfDay.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
def gain = 100 * (high / priorDayClose - 1);
def retrace = 100*((close(period=period)[0]-HighOfDay)/HighOfDay);

rec hasRetraced = if newDay then 0 else if retrace < -percentRetrace then 1 else hasRetraced[1];
def signal = hasRetraced and !hasRetraced[1] and alertPeriod; #AddChartBubble(signal, low, Concat(retrace, "% Pullback"), Color.RED, no);




#This Calculated percentage retracement from High to current pullback including after market
#AddLabel(alertPeriod , "% PullBack from High :" + Round(percentRetrace, 2)+ " %",color.LiGHT_ORANGE);




#----------------------------------------------------
#percentage change from Close to Open
def changeclose= ((open(period = period)[0]- close(period = period)[1])/close(period = period)[1])*100;

#percentage change from Open to current
def changeOpen= ((close(period = period)[0]- open(period = period)[0])/open(period = period)[0])*100;

#def changeFromHigh to current pullback
def retrace2=100*((close(period=period)[0]-HighOfDay[0])/HighOfDay[0]);

#def Changeclose From Open to HOD
def OpenHOD=((HighOfDay- open(period = period)[0])/open(period = period)[0])*100;



#current volume today
def dayvolume = volume(period = period)[0];
def dayavgvolume= average(volume(period= period)[1],length);

#------------ Displays----------
#Display Changeclose percentage from Prev Day close until current (premarket)
addlabel(displaylabel ,"PRevClose-Open:" + round(changeclose,2) + "%",if
changeclose<0 then color.RED else color.GREEN);

#Display Percentage change from Open to current or close
addlabel(displaylabel ,"Open-Last :" + round(changeopen,2) + "%",if
changeopen<0 then color.RED else color.GREEN);

#Dispplay percentage changeclose from Open to HOD
addlabel(displaylabel ,"Open-HOD :" + round(OpenHOD,2) + "%", color.CYAN);

#Dispplay percentage changeclose from Open to HOD
AddLabel(displaylabel , "PullBack from HOD:" + Round(retrace2, 2)+ " %",color.LiGHT_ORANGE);


#Display Average Volume from a period of time default is 10(Days) you can change it
addlabel(displaylabel ,"Avg Vol"+length + "Days: " + round(dayavgvolume,0), color.yellow);
 
The issue for me it gets the HOD since premarket and I thought I have a condition but is not working the code is :
Code:
#- Certain time from 9:30-16:00
def alertPeriodStart = 0930;
def alertPeriodEnd = 1600;

rec trackHighOfDay = if newDay then open(period = period)[0] else if high[0] > trackHighOfDay[1] then high else trackHighOfDay[1];
Wow, old script. I rarely see the rec keyword, which is before my time. It's the same as def as far as I know.

The reason the tracked high of day includes premarket is because of that line. It doesn't check if the time is during the alert period.
 
5 Minute Movers

I was wondering. Would anyone be able to help me create a TOS scanner for 5-minute movers? I know Benzinga has a scanner like this. Basically, change % greater than 2 within the last 5 minutes. Volume 50k or higher. Market cap 2B or greater.

Image 1

Image 2

Any help would be greatly appreciated!
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
374 Online
Create Post

Similar threads

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.
Back
Top