SmartCoder
New member
Hi,
So I have this thinkscript code that will plot dots on the bars of the chart:
def OB = High > High[1] and low < low[1];
def IB = High < High[1] and low > low[1];
def HH = ((High > High[1]) and (High[1] > High[2]) and (IB == 0 and IB[1] == 0 and IB[2] == 0)) or
(High[1] > High[2] and High[2] > High[3] and (IB == 1 and IB[1] == 0 and IB[2] == 0 and IB[3] == 0)) or
(High > High[2] and High[2] > High[3] and (IB == 0 and IB[1] == 1 and IB[2] == 0 and IB[3] == 0)) or
(High > High[1] and High[1] > High[3] and (IB == 0 and IB[1] == 0 and IB[2] == 1 and IB[3] == 0));
def LL = (Low < Low[1] and Low[1] < Low[2] and (IB == 0 and IB[1] == 0 and IB[2] == 0)) or
(Low[1] < Low[2] and Low[2] < Low[3] and (IB == 1 and IB[1] == 0 and IB[2] == 0 and IB[3] == 0)) or
(Low < Low[2] and Low[2] < Low[3] and (IB == 0 and IB[1] == 1 and IB[2] == 0 and IB[3] == 0)) or
(Low < Low[1] and Low[1] < Low[3] and (IB == 0 and IB[1] == 0 and IB[2] == 1 and IB[3] == 0));
assignPriceColor(if HH then color.green else if LL then color.red else if OB then color.cyan else if IB then color.orange else color.gray);
# 1 - Green
# 2 - Red
# 3 - Gray
def color = if HH then 1 else if LL then 2 else 3;
def HHdot = if (color == 1 and color[1] == 1) then hl2[2] else double.nan;
def LLdot = if (color == 2 and color[1] == 2) then hl2[2] else double.nan;
plot d1 = HHdot[-2];
plot d2 = LLdot[-2];
d1.SetPaintingStrategy(PaintingStrategy.POINTS);
d2.SetPaintingStrategy(PaintingStrategy.POINTS);
I want to connect these dots in a line similar to the Zig Zag High Low, but I am having trouble doing that. Could someone please show me how to do that?
So I have this thinkscript code that will plot dots on the bars of the chart:
def OB = High > High[1] and low < low[1];
def IB = High < High[1] and low > low[1];
def HH = ((High > High[1]) and (High[1] > High[2]) and (IB == 0 and IB[1] == 0 and IB[2] == 0)) or
(High[1] > High[2] and High[2] > High[3] and (IB == 1 and IB[1] == 0 and IB[2] == 0 and IB[3] == 0)) or
(High > High[2] and High[2] > High[3] and (IB == 0 and IB[1] == 1 and IB[2] == 0 and IB[3] == 0)) or
(High > High[1] and High[1] > High[3] and (IB == 0 and IB[1] == 0 and IB[2] == 1 and IB[3] == 0));
def LL = (Low < Low[1] and Low[1] < Low[2] and (IB == 0 and IB[1] == 0 and IB[2] == 0)) or
(Low[1] < Low[2] and Low[2] < Low[3] and (IB == 1 and IB[1] == 0 and IB[2] == 0 and IB[3] == 0)) or
(Low < Low[2] and Low[2] < Low[3] and (IB == 0 and IB[1] == 1 and IB[2] == 0 and IB[3] == 0)) or
(Low < Low[1] and Low[1] < Low[3] and (IB == 0 and IB[1] == 0 and IB[2] == 1 and IB[3] == 0));
assignPriceColor(if HH then color.green else if LL then color.red else if OB then color.cyan else if IB then color.orange else color.gray);
# 1 - Green
# 2 - Red
# 3 - Gray
def color = if HH then 1 else if LL then 2 else 3;
def HHdot = if (color == 1 and color[1] == 1) then hl2[2] else double.nan;
def LLdot = if (color == 2 and color[1] == 2) then hl2[2] else double.nan;
plot d1 = HHdot[-2];
plot d2 = LLdot[-2];
d1.SetPaintingStrategy(PaintingStrategy.POINTS);
d2.SetPaintingStrategy(PaintingStrategy.POINTS);
I want to connect these dots in a line similar to the Zig Zag High Low, but I am having trouble doing that. Could someone please show me how to do that?