Candlestick in front of Studies

hedgestan

New member
VIP
Hi, my charts are getting too crowded with the studies and I can barely see the candlestick. The studies are useful and I wanted to know if it is possible to make the candlesticks appear in front of the studies?

JV85Q8j.png


@BenTen : Hi Ben, Any recommendation here with making the cloud study appear behind the candlesticks? These studies are useful bt makes it hard to read price action on the candlesticks.

This is the study: https://usethinkscript.com/threads/atr-based-support-resistance-for-thinkorswim.1418/
 
Last edited by a moderator:
@hedgestan Clouds are tricky... We can change the layering of studies and study components but clouds will always be on top of chart bars/candlesticks... You can read more about hierarchy HERE...
Interesting find rad. The cloud gives a good perspective. Sounds like you have already tried playing with the cloud on the charts. If the platform does not support pushing the studies/cloud to the back, that's a bummer.

@hedgestan Do you have multiple copies of it on one chart? If so, that's probably the reason why. I have it on my chart as well and it works just fine.
Yes, that's intentional and I like how the various ATR resistance zones get colored when combing all the "average types" within the study. Just wanted to know if the cloud could be pushed behind the candlesticks.
 
@hedgestan You can keep your colors but change the opaqueness to lighten the clouds so they don't overwhelm the candle color.

kH0PSm4.png


One way to do this is to use GlobalColors for example:

Code:
DefineGlobalColor("Bullish", Color.light_green);
DefineGlobalColor("Bearish", Color.light_RED);
AddCloud(middleline,  upcloud,  GlobalColor("Bullish"),  GlobalColor("Bullish"));
AddCloud(middleline,  dncloud,  GlobalColor("Bearish"),  GlobalColor("Bearish"))

Once GlobalColors are defined, click on the gear icon, next to the study and change the opaqueness

AbTky1E.png
 
Last edited:
@hedgestan The biggest issue with clouds is that they have to be painted at the bottom of the script because they rely on the results of the calculations that allow for the plotting of the boundaries... Therefore they cannot be moved higher in the code in an attempt to adjust layering...
 
Excellent find @MerryDay. Just started playing with this in the study and it's starting to look much better. Will share a screenshot once done. Gonna use this for all the studies that have the cloud studies in it! Love it!
 
@MerryDay So here's the updated chart. Looks much cleaner after changing the opaqueness. I may play around a little more with it. Appreciate the help with the script. Attached updated Code for anyone who wants to use it. You may have to tweak the opaqueness as Merryday has mentioned. Original Code by BenTen and Diazlaz.

SpiXOpw.png


Code:
# ATR Grid (ATR-Based Support & Resistance)
# Assembled by BenTen and @diazlaz at useThinkScript.com
# Converted from https://www.tradingview.com/script/EDN4oFyQ-ATR-0-5-0-7-ranges/

input lvl1 = 0.5;
input lvl2 = 0.7;
input daily_atr_len = 15;

input length = 15;
input AggPeriod = AggregationPeriod.DAY;
input averageType = AverageType.WILDERS;

def h = high(GetSymbol(), period = AggPeriod)[1];
def c = close(GetSymbol(), period = AggPeriod)[1];
def l = low(GetSymbol(), period = AggPeriod)[1];

def atr_func = MovingAverage(averageType, TrueRange(h, c, l), length);
def day_atr = atr_func;
def day_close = c;

DefineGlobalColor("Bullish", Color.GREEN);
DefineGlobalColor("VBullish", Color.DARK_GREEN);
DefineGlobalColor("Bearish", Color.light_RED);
DefineGlobalColor("VBearish", Color.DARK_RED);

plot p1 = day_close + day_atr;
p1.assignValueColor(COLOR.DARK_RED);
p1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot p7 = day_close + day_atr * lvl2;
p7.assignValueColor(COLOR.RED);
AddCloud(p1, p7, GlobalColor("VBearish"), GlobalColor("VBearish"));
p7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot p5 = day_close + day_atr * lvl1;
p5.assignValueColor(COLOR.RED);
AddCloud(p7, p5, GlobalColor("Bearish"), GlobalColor("Bearish"));
p5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot m5 = day_close - day_atr * lvl1;
m5.assignValueColor(COLOR.GREEN);
#AddCloud(p7,p5,COLOR.GREEN, COLOR.GREEN);
m5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot m7 = day_close - day_atr * lvl2;
m7.assignValueColor(COLOR.GREEN);
AddCloud(m7, m5, GlobalColor("Bullish"), GlobalColor("Bullish"));
m7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot m1 = day_close - day_atr;
m1.assignValueColor(COLOR.DARK_GREEN);
AddCloud(m1, m7, GlobalColor("VBullish"), GlobalColor("VBullish"));
m1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 

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