ThinkorSwim ThinkScript to detect stock breaking out from a flat base.

BayAreaFun.org

New member
How can I find or write a Thinkscript scan that will find stocks that that have been in an uptrend, but which are now moving sideways in a flat base and which are likely to break out (or have broken out) and are likely to move upward again.
 
Solution
i'm going to take a guess and say, something to scan all stocks, follow your rules, and use several fold loops, probably will stall out and stop working.

i would suggest make a chart study first. that way you can see if it's working.
then make a lower study that plots 0's or 1's.
then convert that into a scan.

scans work from data read from the last bar, so keep that in mind when reading data.

make an outline, and break out each phase of the code.
then go back and write code for each part

---
if the last bar, then do stuff

determine if some previous x bars are within a narrow horizontal channel. one example, is the b3 code.
...come up with min and max quantity of bars to make up the channel.

determine if x quantity of bars before...
i'm going to take a guess and say, something to scan all stocks, follow your rules, and use several fold loops, probably will stall out and stop working.

i would suggest make a chart study first. that way you can see if it's working.
then make a lower study that plots 0's or 1's.
then convert that into a scan.

scans work from data read from the last bar, so keep that in mind when reading data.

make an outline, and break out each phase of the code.
then go back and write code for each part

---
if the last bar, then do stuff

determine if some previous x bars are within a narrow horizontal channel. one example, is the b3 code.
...come up with min and max quantity of bars to make up the channel.

determine if x quantity of bars before the horizontal channel were rising.
...come up with min and max quantity of bars to make up the rising bars.

if a horizontal channel exists and the bars before it were rising, then,
determine if some bars are moving above the horizontal channel top level.
...come up with max quantity of bars to make up a range of bars to look for a breakout.
...after awhile you will want to cancel signals and start over

---

B3 Consolidation Box:
https://usethinkscript.com/threads/...kout-breakdown-indicator-for-thinkorswim.103/
 
Solution

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