Multi Timeframe CCI Indicator

Jim C

New member
Been trying to make the CCI indicator Multiple Time frame with no luck. Here is the original indicator. Anyone willing to take a stab? Thanks- Jim

Code:
``````#
# TD Ameritrade IP Company, Inc. (c) 2017-2020
#

declare lower;

input length = 14;
input over_sold = -100;
input over_bought = 100;
input showBreakoutSignals = no;

def price = close + low + high;
def linDev = lindev(price, length);
plot CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
plot OverBought = over_bought;
plot ZeroLine = 0;
plot OverSold = over_sold;
plot UpSignal = if CCI crosses above ZeroLine then ZeroLine else Double.Nan;
plot DownSignal = if CCI crosses below ZeroLine then ZeroLine else Double.Nan;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

CCI.setDefaultColor(GetColor(9));
OverBought.setDefaultColor(GetColor(5));
ZeroLine.setDefaultColor(GetColor(5));
OverSold.setDefaultColor(GetColor(5));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);``````

Solution
Add the following right below `declare lower;`

Code:
``````input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def close = close(period = aggregationPeriod);``````
Add the following right below `declare lower;`

Code:
``````input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def close = close(period = aggregationPeriod);``````

that's it! Thanks Ben!

Looking for a CCI Indicator - Multiple Time Frame. Looking for a 1 Min and 5 Min CCI Indicator to be display on the lower chart.

Any help would be greatly appreciated

@Stockleed So you said you are looking, how did you look? Did you try using the Search function in the upper-right corner of this forum? What about MTF CCI scripts that you found, didn't work for you? Choose which script comes closest to what you want. Then make a post in that Thread of what you are looking to have changed. Follow these instructions when making your post: Guidelines For Posting To Forum. Please do NOT forget to provide marked-up screenshots of how you would like the MTF CCI to be modified.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
347 Online

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• Add-ons and resources
• 1 full year of unlimited support

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?