Is there a code to display past Zigzag waves as labels. Labels -10%, 5% ,-15%, 7% , -11% etc.... I'd like an option to see labels instead of bubbles. MAX 10 labels
Thanks in advance
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Zig Zag indicator Percentage bubbles - Is it possible display at least10 previous percent numbers as labels ? thankscan you describe what the percent numbers are ?
Is there a code to display past Zigzag pct waves as labels. 29.67%, -9.1%, 5.57%, -7.16%, 33.68%. etc.... I'd like an option to see labels instead of bubbles. MAX 10 labels is fine. I posted previously but it takes longer to approve the post. thanks
View attachment 21454
![]()
.Code:# # TD Ameritrade IP Company, Inc. (c) 2011-2024 # input display = {default LeftRight, RightLeft}; input price = close; input reversalAmount = 1.0; input showBubbles = no; input showLabel = no; input showpercent_labels = yes; Assert(reversalAmount > 0, "'reversal amount' should be positive: " + reversalAmount); plot "ZZ%" = reference ZigZagHighLow(price, price, reversalAmount, 0, 1, 0); def zzSave = if !IsNaN("ZZ%") then price else GetValue(zzSave, 1); def chg = (price / GetValue(zzSave, 1) - 1) * 100; def isUp = chg >= 0; def isConf = AbsValue(chg) >= reversalAmount or (IsNaN(GetValue("ZZ%", 1)) and GetValue(isConf, 1)); "ZZ%".EnableApproximation(); "ZZ%".DefineColor("Up Trend", Color.UPTICK); "ZZ%".DefineColor("Down Trend", Color.DOWNTICK); "ZZ%".DefineColor("Undefined", Color.DARK_ORANGE); "ZZ%".AssignValueColor(if !isConf then "ZZ%".Color("Undefined") else if isUp then "ZZ%".Color("Up Trend") else "ZZ%".Color("Down Trend")); DefineGlobalColor("Unconfirmed", Color.DARK_ORANGE); DefineGlobalColor("Up", Color.UPTICK); DefineGlobalColor("Down", Color.DOWNTICK); def barNumber = BarNumber(); AddChartBubble(showBubbles and !IsNaN("ZZ%") and barNumber != 1, price, Round(chg) + "%", if !isConf then GlobalColor("Unconfirmed") else if isUp then GlobalColor("Up") else GlobalColor("Down"), isUp); AddLabel(showLabel and barNumber != 1, (if isConf then "Confirmed " else "Unconfirmed ") + "ZigZag: " + Round(chg) + "%", if !isConf then GlobalColor("Unconfirmed") else if isUp then GlobalColor("Up") else GlobalColor("Down")); def z1 = if !IsNaN("ZZ%") then chg else z1[1]; def z2 = if z1 != z1[1] then z1[1] else z2[1]; def z3 = if z2 != z2[1] then z2[1] else z3[1]; def z4 = if z3 != z3[1] then z3[1] else z4[1]; def z5 = if z4 != z4[1] then z4[1] else z5[1]; def z6 = if z5 != z5[1] then z5[1] else z6[1]; def z7 = if z6 != z6[1] then z6[1] else z7[1]; def z8 = if z7 != z7[1] then z7[1] else z8[1]; def z9 = if z8 != z8[1] then z8[1] else z9[1]; def z10 = if z9 != z9[1] then z9[1] else z10[1]; def w1 = if !IsNaN("ZZ%") then isUp else w1[1]; def w2 = if w1 != w1[1] then w1[1] else w2[1]; def w3 = if w2 != w2[1] then w2[1] else w3[1]; def w4 = if w3 != w3[1] then w3[1] else w4[1]; def w5 = if w4 != w4[1] then w4[1] else w5[1]; def w6 = if w5 != w5[1] then w5[1] else w6[1]; def w7 = if w6 != w6[1] then w6[1] else w7[1]; def w8 = if w7 != w7[1] then w7[1] else w8[1]; def w9 = if w8 != w8[1] then w8[1] else w9[1]; def w10 = if w9 != w9[1] then w9[1] else w10[1]; AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z10) else Round(z1)) + "%", if (if display == display.LeftRight then w10 else w1) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z9) else Round(z2)) + "%", if (if display == display.LeftRight then w9 else w2) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z8) else Round(z3)) + "%", if (if display == display.LeftRight then w8 else w3) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z7) else Round(z4)) + "%", if (if display == display.LeftRight then w7 else w4) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z6) else Round(z5)) + "%", if (if display == display.LeftRight then w6 else w5) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z5) else Round(z6)) + "%", if (if display == display.LeftRight then w5 else w6) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z4) else Round(z7)) + "%", if (if display == display.LeftRight then w4 else w7) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z3) else Round(z8)) + "%", if (if display == display.LeftRight then w3 else w8) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z2) else Round(z9)) + "%", if (if display == display.LeftRight then w2 else w9) then Color.LIGHT_GREEN else Color.LIGHT_RED ); AddLabel(showpercent_labels, (if display == display.LeftRight then Round(z1) else Round(z10)) + "%", if (if display == display.LeftRight then w1 else w10) then Color.LIGHT_GREEN else Color.LIGHT_RED ); #
Perfect! Thank youSorry we missed your request.
The following should print the 10 labels
There is an option to start either left to right or right to left
These are color coded as they are on the chart.
The image shows the bubbles for comparison to the new labels
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.