% change > 5 (+ or -) during the last candle

fayaz786

New member
Folks,

As the title says, I am looking to essentially get alerts right after there is a + or - 5% change during a 1 minute time frame for any of the stocks in the market. Script should check for % change >= 5 during the previous 1 minute candle and provide alerts accordingly or add it to a dynamic watchlist

Appreciate any help I get in this area!

Thanks very much,
Fayaz S
 
Last edited:
Solution
@fayaz786 ,
One thing I noticed is that you said "1 -minute" so I must warn you that watchlists don't update frequently enough to use such a low time frame.

Some things that might help you.
1. manually scan over-and-over again
2. load up charts for the symbols you want to get alerts on ( see the post 66780 thread below)
3. Pop-out the message center into a separate, visible window (see the post about alerts in the answers-to-comonly-asked-questions thread below)

Other links that might help you:
Answers to Commonly Asked Questions
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/

Questions About Alerts
https://usethinkscript.com/threads/questions-about-alerts.337/page-4#post-66780

How to...
I have this, there might be something missing. But it's design for 1 min chart. But it will show you a bubble when the price change 5%. You can create an alert with the variables.

Code:
def agg = AggregationPeriod.DAY; #mets l'aggregation temporairement à 1 min.
def LowHighLHCP = Round ((high - low) / low * 100);
AddLabel (yes, "LHC %: " + LowHighLHCP + "  ", if LowHighLHCP >= 5 then Color.RED else  Color.GRAY);


AddChartBubble( high, "5");
AddChartBubble( (LowHighLHCP >= 5), low, "5", Color.RED, yes);
#AddChartBubble( (LowHighLHCP <= 5), high, "5", color.green, yes);
 

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

I have this, there might be something missing. But it's design for 1 min chart. But it will show you a bubble when the price change 5%. You can create an alert with the variables.

Code:
def agg = AggregationPeriod.DAY; #mets l'aggregation temporairement à 1 min.
def LowHighLHCP = Round ((high - low) / low * 100);
AddLabel (yes, "LHC %: " + LowHighLHCP + "  ", if LowHighLHCP >= 5 then Color.RED else  Color.GRAY);


AddChartBubble( high, "5");
AddChartBubble( (LowHighLHCP >= 5), low, "5", Color.RED, yes);
#AddChartBubble( (LowHighLHCP <= 5), high, "5", color.green, yes);
Really appreciate your time to review my Q and reply. I must have been more clear, idea is to alert or add to watchlist any stock in the market that fulfils this criteria for a given 1 min previous candle as opposed to a specific stock that I am tracking. I have updated my Q and will play around with your above code for now. Thanks very much!
 
@fayaz786 ,
One thing I noticed is that you said "1 -minute" so I must warn you that watchlists don't update frequently enough to use such a low time frame.

Some things that might help you.
1. manually scan over-and-over again
2. load up charts for the symbols you want to get alerts on ( see the post 66780 thread below)
3. Pop-out the message center into a separate, visible window (see the post about alerts in the answers-to-comonly-asked-questions thread below)

Other links that might help you:
Answers to Commonly Asked Questions
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/

Questions About Alerts
https://usethinkscript.com/threads/questions-about-alerts.337/page-4#post-66780

How to Change ThinkorSwim Refresh Rate
https://usethinkscript.com/threads/how-to-change-thinkorswim-refresh-rate.1181

How to Add Alert Script to ThinkOrSwim Indicators
https://usethinkscript.com/resources/how-to-add-alert-script-to-thinkorswim-indicators.9/

Here's study and scan code.

Code:
# Study:
input multiplier = 1.05;
def condition = close >= multiplier * close[1];
Alert(condition, Hooray, Alert.Bar, Sound.Chimes);

Code:
# Scan:
input multiplier = 1.05;
def condition = close >= multiplier * close[1];
plot scan = condition;
 
Solution
@fayaz786 ,
One thing I noticed is that you said "1 -minute" so I must warn you that watchlists don't update frequently enough to use such a low time frame.

Some things that might help you.
1. manually scan over-and-over again
2. load up charts for the symbols you want to get alerts on ( see the post 66780 thread below)
3. Pop-out the message center into a separate, visible window (see the post about alerts in the answers-to-comonly-asked-questions thread below)

Other links that might help you:
Answers to Commonly Asked Questions
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/

Questions About Alerts
https://usethinkscript.com/threads/questions-about-alerts.337/page-4#post-66780

How to Change ThinkorSwim Refresh Rate
https://usethinkscript.com/threads/how-to-change-thinkorswim-refresh-rate.1181

How to Add Alert Script to ThinkOrSwim Indicators
https://usethinkscript.com/resources/how-to-add-alert-script-to-thinkorswim-indicators.9/

Here's study and scan code.

Code:
# Study:
input multiplier = 1.05;
def condition = close >= multiplier * close[1];
Alert(condition, Hooray, Alert.Bar, Sound.Chimes);

Code:
# Scan:
input multiplier = 1.05;
def condition = close >= multiplier * close[1];
plot scan = condition;
Thanks for your reply! This is a great answer. As a work around I will use two computers, one for “manually” scanning every minute with auto mouse clicker application and the other to trade with. That is the only option I could think of… Regardless, appreciate your response!
 
@fayaz786 ,
One thing I noticed is that you said "1 -minute" so I must warn you that watchlists don't update frequently enough to use such a low time frame.

Some things that might help you.
1. manually scan over-and-over again
2. load up charts for the symbols you want to get alerts on ( see the post 66780 thread below)
3. Pop-out the message center into a separate, visible window (see the post about alerts in the answers-to-comonly-asked-questions thread below)

Other links that might help you:
Answers to Commonly Asked Questions
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/

Questions About Alerts
https://usethinkscript.com/threads/questions-about-alerts.337/page-4#post-66780

How to Change ThinkorSwim Refresh Rate
https://usethinkscript.com/threads/how-to-change-thinkorswim-refresh-rate.1181

How to Add Alert Script to ThinkOrSwim Indicators
https://usethinkscript.com/resources/how-to-add-alert-script-to-thinkorswim-indicators.9/

Here's study and scan code.

Code:
# Study:
input multiplier = 1.05;
def condition = close >= multiplier * close[1];
Alert(condition, Hooray, Alert.Bar, Sound.Chimes);

Code:
# Scan:
input multiplier = 1.05;
def condition = close >= multiplier * close[1];
plot scan = condition;
Actually, I have a Q if I may on the code you gave for scan - I don’t see it mentioning the 1 minute time period, would you happen to know how do I get it working with 1 minute (candles) time frame? Do I have use 1 minute aggregation period?
 
@fayaz786 The aggregation is set in Scan Hacker:
hP47LdP.png
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
353 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