Can addlabel add one label per line ?

Kden

New member
How to tell AddLabel to add one label per line?
I tried "\n" but it did not work

Thank you,
Kden
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.


Here is one alternative to 'stack' labels.

The following image shows a 3 pane grid with 'stacked' labels showing on in the left/right panes to choose to possibly use.

To stack them, try to keep the labels within the largest one of the group. Then in chart settings, uncheck general tab, show price subgraph. Then shrink the pane to 'stack' the labels.

Here is the image and label code used

Capture.jpg
Ruby:
#Chart Label to Provide Trading  Information
#Adaption from Various Sources by zzz 15 Feb 2013
declare lower;
#Open, High, Low, Close for Day
input Show_Label = Yes;
def P = Round(close(period = AggregationPeriod.DAY)[1], 2);
def H = Round(high(period = AggregationPeriod.DAY), 2);
def L = Round(low(period = AggregationPeriod.DAY), 2);
def O = Round(open(period = AggregationPeriod.DAY), 2);

AddLabel(Show_Label, text = Concat("P ", P), if P < O then Color.RED else Color.GREEN);
AddLabel(Show_Label, text = Concat("O ", O), if P > O then Color.RED else Color.GREEN);
AddLabel(Show_Label, "Gap " + AbsValue(P - O), if P > O then Color.RED else if P == O then Color.YELLOW else Color.GREEN);
AddLabel(Show_Label, if P > O and H > P or P <= O and L < P then "Gap Filled" else "Gap Left " + (if P > O and H < P then AbsValue(P - H) else AbsValue(P - L)), if (P > O and H < P) then Color.RED else if P <= O and L > P then Color.GREEN else Color.WHITE);
AddLabel(Show_Label, text = Concat("H ", H), color = Color.WHITE);
AddLabel(Show_Label, text = Concat("L ", L), color = Color.WHITE);
AddLabel(Show_Label, "NC_Open " + Round((close - open(period = AggregationPeriod.DAY)), 2), if open(period = AggregationPeriod.DAY) > close then Color.RED else Color.GREEN);
AddLabel(Show_Label, "NC_Close " + Round((close - close(period = AggregationPeriod.DAY)[1]), 2), if close(period = AggregationPeriod.DAY)[1] > close then Color.RED else Color.GREEN);
AddLabel(Show_Label, Concat(" HH52 " , Highest(high(period = AggregationPeriod.DAY), 252)), Color.GREEN);
AddLabel(Show_Label, "%52W_H: " + AsPercent((close - Highest(high(period = AggregationPeriod.DAY), 252)) / Highest(high(period = AggregationPeriod.DAY), 252)), Color.RED);
AddLabel(Show_Label, Concat( " LL52 ", Lowest(low(period = AggregationPeriod.DAY), 252)), Color.RED);
AddLabel(Show_Label, "%52W_L: " + AsPercent((close - Lowest(low(period = AggregationPeriod.DAY), 252)) / Lowest(low(period = AggregationPeriod.DAY), 252)), Color.GREEN);

#ATR and Daily Range
input atrlength = 5;
def null1 = Double.NaN;
AddLabel(Show_Label, text = Concat("R ", H - L), if O > close then Color.RED else Color.GREEN);
AddLabel(Show_Label, Concat("ADR ",  Round(Average(high(period = AggregationPeriod.DAY) - low(period = AggregationPeriod.DAY), atrlength), 2)), if O > close then Color.RED else Color.GREEN);
AddLabel(Show_Label, text = if (H - L) - Round(Average(high(period = AggregationPeriod.DAY) - low(period = AggregationPeriod.DAY), atrlength), 2) == 0 then "ADR Filled" else "ADR Left " + (if (H - L) - Round(Average(high(period = AggregationPeriod.DAY) - low(period = AggregationPeriod.DAY), atrlength), 2) < 0 then  AbsValue((H - L) - Round(Average(high(period = AggregationPeriod.DAY) - low(period = AggregationPeriod.DAY), atrlength), 2)) else 0) , if (H - L) - Round(Average(high(period = AggregationPeriod.DAY) - low(period = AggregationPeriod.DAY), atrlength), 2) < 0 then Color.GREEN else Color.WHITE);
def ATR2 = Average(TrueRange(high(period = AggregationPeriod.DAY), close(period = AggregationPeriod.DAY), low(period = AggregationPeriod.DAY)), atrlength);
AddLabel(Show_Label, Concat("ATR: D ", Round(ATR2, 2)), Color.YELLOW);

#Volume
def avgvol = Floor(Average(volume, 10));
AddLabel(Show_Label, "BV " + if volume > 0 then volume else 0, if volume < volume[1] then Color.RED else Color.GREEN);
AddLabel(Show_Label, "DV " + volume(period = AggregationPeriod.DAY), if volume(period = AggregationPeriod.DAY) < Average(volume(period = AggregationPeriod.DAY), 10) then Color.RED else Color.GREEN);

#Current Tick Reading
input u = 0;
input lo = -0;
def it = close ("$tick");
AddLabel(Show_Label, Concat("Tick ", it), if it > u then Color.GREEN else if it < lo then Color.LIGHT_RED else Color.WHITE);
 
Here is one alternative to 'stack' labels.

The following image shows a 3 pane grid with 'stacked' labels showing on in the left/right panes to choose to possibly use.

To stack them, try to keep the labels within the largest one of the group. Then in chart settings, uncheck general tab, show price subgraph. Then shrink the pane to 'stack' the labels.

Here is the image and label code used
Hi there!
Could you help me understand what the DV and BV are in the volume label section?
 
Hi there!
Could you help me understand what the DV and BV are in the volume label section?

Daily Volume and Bar Volume.

The Daily Volume records the volume shown in volume bars.

Ruby:
#Volume
def avgvol = Floor(Average(volume, 10));
AddLabel(Show_Label, "BV " + if volume > 0 then volume else 0, if volume < volume[1] then Color.RED else Color.GREEN);
AddLabel(Show_Label, "DV " + volume(period = AggregationPeriod.DAY), if volume(period = AggregationPeriod.DAY) < Average(volume(period = AggregationPeriod.DAY), 10) then Color.RED else Color.GREEN);
 
Daily Volume and Bar Volume.

The Daily Volume records the volume shown in volume bars.

Ruby:
#Volume
def avgvol = Floor(Average(volume, 10));
AddLabel(Show_Label, "BV " + if volume > 0 then volume else 0, if volume < volume[1] then Color.RED else Color.GREEN);
AddLabel(Show_Label, "DV " + volume(period = AggregationPeriod.DAY), if volume(period = AggregationPeriod.DAY) < Average(volume(period = AggregationPeriod.DAY), 10) then Color.RED else Color.GREEN);
Thank you. so does that mean, the BV shows the volume of the bar of whatever timeframe I'm in, or is it limited to daily?
 
Thank you. so does that mean, the BV shows the volume of the bar of whatever timeframe I'm in, or is it limited to daily?

Looking at the code, I used volume for bar volume and did not define an aggregationperiod. So BV would be the bar volume of whatever chart timeframe you using.

The daily volume had the volume defined as volume(period = AggregationPeriod.DAY), thereby limiting the DV to daily no matter which chart timeframe you are using
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
295 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