How to tell AddLabel to add one label per line?
I tried "\n" but it did not work
Thank you,
Kden
How to tell AddLabel to add one label per line?
I tried "\n" but it did not work
Thank you,
Kden
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);
Hi there!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?
#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?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?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
S | AddLabel Void Return Value Custom Scan Column | Questions | 1 | |
![]() |
AddLabel woes... | Questions | 4 | |
![]() |
Help with a conditional AddLabel Command | Questions | 1 | |
![]() |
AddLabel on Chart for Implied Vol for ATM Option | Questions | 1 | |
Y | Error in addlabel | Questions | 1 |
Start a new thread and receive assistance from our community.
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.
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.