ZigZag Price, Price change & Bar Count Change For ThinkOrSwim
Here is something I did awhile ago on the zigzaghighlow study that shows the price, price change and bar count change. See if this helps:
Here is something I did awhile ago on the zigzaghighlow study that shows the price, price change and bar count change. See if this helps:
Code:
#TOS Zigzaghighlow with Price and Price Change Bubbles
#Sleepyz
input show_price_bubble = yes;
input show_change_bubble = yes;
input show_count_bubble = yes;
input zzotherpriceh = high;
input zzotherpricel = low;
input zzotherperrev = 0.0;
input zzotheratrrev = 5.0;
input zzotheratrlen = 14;
input bubbleoffset = .0005;
plot zzother = reference ZigZagHighLow(zzotherpriceh, zzotherpricel, zzotherperrev, "atr length" = zzotheratrlen, "atr reversal" = zzotheratrrev).ZZ;
zzother.EnableApproximation();
zzother.SetDefaultColor(Color.CYAN);
zzother.SetLineWeight(3);
def zzoth = if !IsNaN(zzother) then zzother else zzoth[1];
def chgzzoth = AbsValue(zzoth[1] - zzoth);
def count = if !IsNaN(zzother) then BarNumber() else count[1];
AddChartBubble(!IsNaN(zzother) and show_count_bubble,
if zzother == high
then high * (1 + bubbleoffset)
else low * (1 - bubbleoffset) ,
"Bars: " + (count - count[1]),
color.yellow,
if zzother == high then yes else no);
AddChartBubble(!IsNaN(zzother) and show_change_bubble,
if zzother == high
then high * (1 + bubbleoffset)
else low * (1 - bubbleoffset) ,
"Chg: " + AsText(chgzzoth) ,
Color.CYAN,
if zzother == high then yes else no);
AddChartBubble(!IsNaN(zzother) and show_price_bubble,
if zzother == high
then high * (1 + bubbleoffset)
else low * (1 - bubbleoffset) ,
(if zzother == high then "H: " else "L: ") + AsText(zzother) ,
if !isnan(zzother) > !isnan(zzother[1]) then Color.GREEN else Color.RED,
if zzother == high then yes else no);
Last edited by a moderator: