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

New member
VIP
@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.
 

MerryDay

Well-known member
VIP
@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
 

rad14733

Well-known member
VIP
@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...
 

hedgestan

New member
VIP
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!
 

hedgestan

New member
VIP
@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);
 

Similar threads

Top