How can I mave candles that only show high and low of a period?

Unmanifest

New member
Hi, I've been trying to get High/Low candles in TOS like the ones in TradingView.

So far, I've been able to use the deprecated AddChart function to make the candles, but I need to have them be translucent so that underlying candle-coloring schemes from other indicators can come through.

So far, this is the code I have used (found basic code in usethinkscript forums and set open and close to high and low), but I can't find a way to make the candles translucent.

Code:
HidePricePlot();

def o = GetValue(open,0);
def l = GetValue(low,0);
def h = GetValue(high,0);
def c = GetValue(close,0);

AddChart(high = h, low = l, open = h, close = l, type = ChartType.Candle, growcolor = color.GRAY);

Attached is a pic of what it looks llike as it is now. Gets the H/L part but opaque candles only.

Any help is greatly appreciated.

1703731323477.png
 
Solution
Hi, I've been trying to get High/Low candles in TOS like the ones in TradingView.

So far, I've been able to use the deprecated AddChart function to make the candles, but I need to have them be translucent so that underlying candle-coloring schemes from other indicators can come through.

So far, this is the code I have used (found basic code in usethinkscript forums and set open and close to high and low), but I can't find a way to make the candles translucent.

Code:
HidePricePlot();

def o = GetValue(open,0);
def l = GetValue(low,0);
def h = GetValue(high,0);
def c = GetValue(close,0);

AddChart(high = h, low = l, open = h, close = l, type = ChartType.Candle, growcolor = color.GRAY);

Attached is a pic of what it looks llike as...
Hi, I've been trying to get High/Low candles in TOS like the ones in TradingView.

So far, I've been able to use the deprecated AddChart function to make the candles, but I need to have them be translucent so that underlying candle-coloring schemes from other indicators can come through.

So far, this is the code I have used (found basic code in usethinkscript forums and set open and close to high and low), but I can't find a way to make the candles translucent.

Code:
HidePricePlot();

def o = GetValue(open,0);
def l = GetValue(low,0);
def h = GetValue(high,0);
def c = GetValue(close,0);

AddChart(high = h, low = l, open = h, close = l, type = ChartType.Candle, growcolor = color.GRAY);

Attached is a pic of what it looks llike as it is now. Gets the H/L part but opaque candles only.

Any help is greatly appreciated.

View attachment 20536

This should help. It paints a translucent border using the global color. The border can be the color of the candle substituing the green/red/white colors in place of the global color.

The image has the border set to the global color in the image, with the price plot set at the input to be hidden.

Screenshot 2024-01-10 171526.png
Code:
input hide_price_plot = no;
hidePricePlot(hide_price_plot);

input charttype = ChartType.CANDLE;
def o = open;
def h = high;
def l = low;
def c = close;

DefineGlobalColor(color = Color.white, name = "Border");

#Green
def o1 = if o<c then h else double.nan;
def c1 = if o<c then l else double.nan;
def h1 = h;
def l1 = l;

AddChart(growColor = globalColor("Border"), high = h1, low = l1, open = c1, close = o1, type = charttype);

#Red
def o2 = if o>c then h else double.nan;
def c2 = if o>c then l else double.nan;
def h2 = h;
def l2 = l;

AddChart(growColor = globalColor("Border"), high = h2, low = l2, open = c2, close = o2, type = charttype);

#White
def o3 = if o==c then h else double.nan;
def c3 = if o==c then l else double.nan;
def h3 = h;
def l3 = l;

AddChart(growColor = globalColor("Border"), high = h3, low = l3, open = c3, close = o3, type = charttype);
 
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
286 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