3rd Candle Close and 1st Candle Open % difference

ARL

Member
Plus
Greetings! I'd like a scan where the close of the current candle is 1% less than the open of the 3rd candle back. I know the script for this is probably super simple but would appreciate having the 1 or 2 lines of code needed for this OR point me to an existing post that addresses a request like this. Thank you in advance for the help.
- Aaron
 
Last edited:
Solution
Current candle counts as one of the three:
AbsValue((Close - Close[2]) / Close[2]) * 100 < 1

Three total completed candles behind the current candle.
With current candle not being counted one of the three:
AbsValue((Close - Close[3]) / Close[3]) * 100 < 1

The first one again, but not including the right most bar while its still forming.
Only truly finished bars:
AbsValue((Close[1] - Close[3]) / Close[3]) * 100 < 1

This will also account for the < %1 move being in either direction.
Otherwise, remove AbsValue()

This is more complicated than it sounds at first, and very dependent on the subtle details.
The answer should be in there somewhere, if not, let me know.
Only the exact first and third intraday candles of the day? Or, more like a rolling thing where its always checking the recent candles as the day goes on?
 

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

To clarify, the condition is that the price difference between the current candle close and the open of the 3rd candle back is less than 1%. This would be a rolling thing always checking the current candle and the 3rd candle back on a five minute intraday chart. Thanks.
 
Current candle counts as one of the three:
AbsValue((Close - Close[2]) / Close[2]) * 100 < 1

Three total completed candles behind the current candle.
With current candle not being counted one of the three:
AbsValue((Close - Close[3]) / Close[3]) * 100 < 1

The first one again, but not including the right most bar while its still forming.
Only truly finished bars:
AbsValue((Close[1] - Close[3]) / Close[3]) * 100 < 1

This will also account for the < %1 move being in either direction.
Otherwise, remove AbsValue()

This is more complicated than it sounds at first, and very dependent on the subtle details.
The answer should be in there somewhere, if not, let me know.
 
Solution
It's the first instance you provided that delivers the results I'm expecting. I changed it slightly so that price difference is calculated at the open of the [2] candle: AbsValue((Close - Open[2]) / Open[2]) * 100 < 1

Thank you, Joshua. This would have taken me a good chunk of time to figure out and having each subtle variation helps me understand the scripting logic much better. It also cuts down significantly the number of charts through which to process. 🎯
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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