CCI Watchlist / Scan / Label / Strategy for ThinkorSwim

These are two different screeners, first one looks for long entries. Both of conditions must be met for a result, it should not show me if only one condition is met.

Long
CCI 8 5min < -135 provided at the same time CCI 34 30min > +100

and this one looks for short entries

Short
CCI 8 5min > +135 provided at the same time CCI 34 30min < -100
 
Last edited:
These are two different screeners, first one looks for long entries. Both of conditions must be met for a result, it should not show me if only one condition is met.

Long
CCI 8 5min < -135 provided at the same time CCI 34 30min > +100

and this one looks for short entries

Short
CCI 8 5min > +135 provided at the same time CCI 34 30min < -100

See if this helps

Ruby:
#Long
#CCI 8 5min < -135 provided at the same time CCI 34 30min > +100
#and this one looks for short entries
#Short
#CCI 8 5min > +135 provided at the same time CCI 34 30min < -100

script cci_agg {
    input length  = 14;
    input agg = AggregationPeriod.FIVE_MIN;
    def c = close(period = agg);
    def h = high(period = agg);
    def l = low(period = agg);
    def price  = c + l + h;
    def linDev = LinDev(price, length);
    plot CCI    = if linDev == 0
             then 0
             else (price - Average(price, length)) / linDev / 0.015;
}


plot long  = cci_agg(8) < -135 and cci_agg(34, agg = "THIRTY_MIN") > +100;
plot short = cci_agg(8) > +135 and cci_agg(34, agg = "THIRTY_MIN") < -100;
 
Last edited:
I'm a little confused, I'd like to screen stocks based on the script and the condition, it is two different screeners the first one for long and the second one for short. For eg - I looked up the inbuilt screener but im still not confident about it. This is for long https://tos.mx/IMYwPKC
what speeyz posted will work,

make 2 copies of sleepyz code
place a # in front of a different plot, in each copy, to disable one of them ( i prefer this over deleting things)

.....
plot long = cci_agg(8) < -135 and cci_agg(34, agg = "THIRTY_MIN") > +100;
#plot short = cci_agg(8) > +135 and cci_agg(34, agg = "THIRTY_MIN") < -100;

#plot long = cci_agg(8) < -135 and cci_agg(34, agg = "THIRTY_MIN") > +100;
plot short = cci_agg(8) > +135 and cci_agg(34, agg = "THIRTY_MIN") < -100;
 
what speeyz posted will work,

make 2 copies of sleepyz code
place a # in front of a different plot, in each copy, to disable one of them ( i prefer this over deleting things)

.....
plot long = cci_agg(8) < -135 and cci_agg(34, agg = "THIRTY_MIN") > +100;
#plot short = cci_agg(8) > +135 and cci_agg(34, agg = "THIRTY_MIN") < -100;

#plot long = cci_agg(8) < -135 and cci_agg(34, agg = "THIRTY_MIN") > +100;
plot short = cci_agg(8) > +135 and cci_agg(34, agg = "THIRTY_MIN") < -100;
I get an error called secondary period not allowed: 30m.
 
I get an error called secondary period not allowed: 30m.

What I posted will work in a study, For the scanner, do this for longs and make a separate one for shorts with your logic.


Screenshot-2022-10-18-152636.png
 
Why do I get different results than you?
2022-10-18-Watch-List-Scanner.png


I do not want extended hours, I just wanted to confirm if both CCI conditions are met for long when I run that scanner. I am new to TOS.
 
Last edited by a moderator:
Why do I get different results than you?
2022-10-18-Watch-List-Scanner.png
If you want to mirror @SleepyZ results; you need to mirror his settings.
  1. Review your "Scan in:" and "Intersect with:" fields.
  2. Review your extended hours settings
If you don't want extended hours on, that's fine;
  1. Review your "Scan in:" and "Intersect with:" fields.
And realize that because your settings are different from @SleepyZ, you might get different results.
 
Last edited:
@SleepyZ

So on my screener right now, and while the first condition of cci8>-135 gets met, the second one for cci34<+100 does not. I am unable to wrap my head around that
 

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