Wolf Waves for ThinkorSwim

As requested, here is the Wolf Waves indicator for ThinkorSwim. It automatically plots support and resistance on your chart, as well as trend lines that you can use to catch potential breakouts or breakdown.

This indicator was created by Mobius. As mentioned by the author, this is similar to other Pivot Studies that mark different types of breakouts.

eobYmxR.png


thinkScript Code

Rich (BB code):
# Wolf Waves
# Mobius
# V01.05.22.2018

# User Inputs

input n = 10;

# Internal Script Reference

script LinePlot {

    input BarID = 0;

    input Value = 0;

    input BarOrigin = 0;

    def ThisBar = HighestAll(BarOrigin);

    def ValueLine = if BarOrigin == ThisBar

                then Value

                else Double.NaN;

    plot P = if ThisBar - BarID <= BarOrigin

             then HighestAll(ValueLine)

             else Double.NaN;

}

# Variables

def o = open;

def h = high;

def l = low;

def c = close;

def x = BarNumber();

def xN = x == HighestAll(x);

# R1

def hh = fold i = 1 to n + 1

         with p = 1

         while p

         do h > GetValue(h, -i);

def PivotH = if (x > n and

                 h == Highest(h, n) and

                 hh)

             then h

             else Double.NaN;

def PHValue = if !IsNaN(PivotH)

              then PivotH

              else PHValue[1];

def PHBarOrigin = if !IsNaN(PivotH)

                  then x

                  else PHBarOrigin[1];

def PHBarID = x - PHBarOrigin;

# R2

def R2PHValue = if PHBarOrigin != PHBarOrigin[1]

                then PHValue[1]

                else R2PHValue[1];

def R2PHBarOrigin = if PHBarOrigin != PHBarOrigin[1]

                    then PHBarOrigin[1]

                    else R2PHBarOrigin[1];

def R2PHBarID = x - R2PHBarOrigin;

# R3

def R3PHValue = if R2PHBarOrigin != R2PHBarOrigin[1]

                then R2PHValue[1]

                else R3PHValue[1];

def R3PHBarOrigin = if R2PHBarOrigin != R2PHBarOrigin[1]

                    then R2PHBarOrigin[1]

                    else R3PHBarOrigin[1];

def R3PHBarID = x - R3PHBarOrigin;

# S1

def ll = fold j = 1 to n + 1

         with q = 1

         while q

         do l < GetValue(l, -j);

def PivotL = if (x > n and

                 l == Lowest(l, n) and

                 ll)

             then l

             else Double.NaN;

def PLValue = if !IsNaN(PivotL)

              then PivotL

              else PLValue[1];

def PLBarOrigin = if !IsNaN(PivotL)

                  then x

                  else PLBarOrigin[1];

def PLBarID = x - PLBarOrigin;

# S2

def S2PLValue = if PLBarOrigin != PLBarOrigin[1]

                then PLValue[1]

                else S2PLValue[1];

def S2PLBarOrigin = if PLBarOrigin != PLBarOrigin[1]

                    then PLBarOrigin[1]

                    else S2PLBarOrigin[1];

def S2PLBarID = x - S2PLBarOrigin;

# S3

def S3PLValue = if S2PLBarOrigin != S2PLBarOrigin[1]

                then S2PLValue[1]

                else S3PLValue[1];

def S3PLBarOrigin = if S2PLBarOrigin != S2PLBarOrigin[1]

                    then S2PLBarOrigin[1]

                    else S3PLBarOrigin[1];

def S3PLBarID = x - S3PLBarOrigin;

# S4

def S4PLValue = if S3PLBarOrigin != S3PLBarOrigin[1]

                then S3PLValue[1]

                else S4PLValue[1];

def S4PLBarOrigin = if S3PLBarOrigin != S3PLBarOrigin[1]

                    then S3PLBarOrigin[1]

                    else S4PLBarOrigin[1];

def S4PLBarID = x - S4PLBarOrigin;

# S5

def S5PLValue = if S4PLBarOrigin != S4PLBarOrigin[1]

                then S4PLValue[1]

                else S5PLValue[1];

def S5PLBarOrigin = if S4PLBarOrigin != S4PLBarOrigin[1]

                    then S4PLBarOrigin[1]

                    else S5PLBarOrigin[1];

def S5PLBarID = x - S5PLBarOrigin;

# Plots

plot R1 = LinePlot(BarID = PHBarID,

                   Value = PHValue,

                   BarOrigin = PHBarOrigin);

R1.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(PHBarOrigin), PHValue, "R1", Color.GREEN, 1);

plot R2 = LinePlot(BarID = R2PHBarID,

                   Value = R2PHValue,

                   BarOrigin = R2PHBarOrigin);

R2.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(R2PHBarOrigin), PHValue, "R2", Color.GREEN, 1);

plot R3 = LinePlot(BarID = R3PHBarID,

                   Value = R3PHValue,

                   BarOrigin = R3PHBarOrigin);

R3.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(R3PHBarOrigin), PHValue, "R3", Color.GREEN, 1);

plot S1 = LinePlot(BarID = PLBarID,

                   Value = PLValue,

                   BarOrigin = PLBarOrigin);

S1.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(PLBarOrigin), PLValue, "S1", Color.RED, 0);

plot S2 = LinePlot(BarID = S2PLBarID,

                   Value = S2PLValue,

                   BarOrigin = S2PLBarOrigin);

S2.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(S2PLBarOrigin), PLValue, "S2", Color.RED, 0);

plot S3 = LinePlot(BarID = S3PLBarID,

                   Value = S3PLValue,

                   BarOrigin = S3PLBarOrigin);

S3.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(S3PLBarOrigin), PLValue, "S3", Color.RED, 0);

# Trend Line

plot SupportLine2 = if x == HighestAll(S2PLBarOrigin)

                    then S2

                    else if x == HighestAll(PLBarOrigin)

                         then S1  #Parentlow

                         else Double.NaN;

SupportLine2.EnableApproximation();

SupportLine2.SetDefaultColor(Color.GRAY);

SupportLine2.SetLineWeight(1);

SupportLine2.SetStyle(Curve.LONG_DASH);

def slope2 = (S2 - S1) /

             (HighestAll(S2PLBarOrigin) - PLBarOrigin);

plot ExtLine2 = if x >= S2PLBarOrigin

                then (x - HighestAll(S2PLBarOrigin)) * slope2 + S2

                else Double.NaN;

ExtLine2.EnableApproximation();

ExtLine2.SetDefaultColor(Color.GRAY);

ExtLine2.SetLineWeight(1);

ExtLine2.SetStyle(Curve.LONG_DASH);

plot SupportLine3 = if x == HighestAll(R3PHBarOrigin)

                    then R3

                    else if x == PHBarOrigin

                         then R1

                         else Double.NaN;

SupportLine3.EnableApproximation();

SupportLine3.SetDefaultColor(Color.GRAY);

SupportLine3.SetLineWeight(1);

SupportLine3.SetStyle(Curve.LONG_DASH);

def slope3 = (R1 - R3) /

             (HighestAll(PHBarOrigin) - R3PHBarOrigin);

plot ExtLine3 = if x >= R3PHBarOrigin

                then (x - HighestAll(R3PHBarOrigin)) * slope3 + R3

                else Double.NaN;

ExtLine3.EnableApproximation();

ExtLine3.SetDefaultColor(Color.GRAY);

ExtLine3.SetLineWeight(1);

ExtLine3.SetStyle(Curve.LONG_DASH);

Shareable Link

https://tos.mx/Wj3rEc

Hi @BenTen , could you please tell me how to add a cloud to each support and resistance line from the line to the closing or opening price as appropriate in this indicator?

Thanks in advance
 

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

Hi guys, I keep trying to add clouds at each support and Resistance , I succeeded, but so far I can't get the clouds to hide along with the lines, I'll leave the code to see if someone helps me see what happens, For now I have only done it on the Resistance , thanks in advanced


#StudyName: BLT_HarndogLazyFractalPivots
#Version/Date: v2 01-13-2016 TOS.mx Link: http://tos.mx/2CTLqx #Type: [Study | Strategy]
#Description: Instead of redrafting fractal pivots to frame market behavior
# this adaption of Mobius' FractalPivotsArrayV3 was modified by
# by BLT/ZZZ/LB using a Harndog test script idea to generate
# lazy fractal pivot lines.
#Requested By: Harndog in chat starting around 02/12/17
#History: TOS.mx Link:
# Notes: The idea is based on Mobius Fractal Pivot Array http://tos.mx/Yf06LY
# Annotation:
# V02: Added ExtLine.Hide: because script was generating expansion problems
# Changed Plot Support Line (line 450) to
# plot SupportLine = if bar == ParentHbarOrigin
# then ParentHigh
# else if bar == ParentLbarOrigin
# then ParentLow
# else double.nan;
# Suggestion from Brian_ss
# Trading Notes: Play with the script properties to adjust fractal pivots,
# aggregations
# 18:58 blt_: harndog, if you still are looking for hiding pivots in your version of "lazy pivots", maybe this will help. It hides pivots when a close crosses the pivot. You can set how many crosses before a line is hidden. The bubble was also set to hide if the pivot line is hidden. The current/higher option was changed to allow for more

# Fractal Pivot Array 11 deep
# Mobius
# V03.01.2017
# V02: Added some information on Basic Wave Structure and labels to hold wave data started
# V03: Added User Input for secondary aggregations. Add a label to show what chart aggregation pivots are being plotted. Add a cloud to show first zone of support / resistance. Altered Support line plot to extend at a consistent slope. Reset UI's for WaveLabel and ShowWaves to no.

# User Inputs
input length = 300;
input averageType = AverageType.WILDERS;
input n = 10;
input WaveLabel = no;
input ShowWaves = no;
input ShowSupportResistanceCloud = no;
input select_aggperiod = {default "Current", "Higher"};
input higheragg = AggregationPeriod.THREE_MIN;
input sethiding_crosses_required = 1;
input ShowSRLevelsCloud = yes;
def closecloud = yes;



def sh = sethiding_crosses_required;

def ATR = MovingAverage(AverageType.SIMPLE, TrueRange(high, close, low), length);
def Num_Dev_Dn = ATR ;
def Num_Dev_up = - ATR ;



# Internal Script Reference
script LinePlot
{
input BarID = 0;
input Value = 0;
input BarOrigin = 0;
def ThisBar = HighestAll(BarOrigin);
def ValueLine = if BarOrigin == ThisBar then Value else Double.NaN;

plot P = if ThisBar - BarID <= BarOrigin then HighestAll(ValueLine) else Double.NaN;
}

# Variables

def o;
def h;
def l;
def c;
switch (select_aggperiod) {
case Current:
o = open;
h = high;
l = low;
c = if IsNaN(close) then c[1] else close;
case Higher:
o = open(period = higheragg);
h = high(period = higheragg);
l = low(period = higheragg);
c = if IsNaN(close(period = higheragg)) then c[1] else close(period = higheragg);
}

def bar = BarNumber();
def BBar = bar == HighestAll(bar);
def nan = Double.NaN;

# Parent High

def ParentHigh = HighestAll(h);
def ParentHBarOrigin = if h == ParentHigh then bar else ParentHBarOrigin[1];
def ParentHBarID = bar - HighestAll(ParentHBarOrigin);


# R1

def hh = fold i = 1 to n + 1 with p = 1 while p do h > GetValue(h, -i);
def PivotH = if (bar > n and h == Highest(h, n) and hh) then h else Double.NaN;
def PHValue = if !IsNaN(PivotH) then PivotH else PHValue[1];
def PHBarOrigin = if !IsNaN(PivotH) then bar else PHBarOrigin[1];
def PHBarID = bar - PHBarOrigin;
def xh = if h == hh then c else nan;


#plot hh_ = if PivotH >= HighestAll(xh) then HighestAll(if IsNaN(close[-1]) then hh else nan) else nan;
#hh_.SetDefaultColor(Color.RED);


# R2

def R2PHValue = if PHBarOrigin != PHBarOrigin[1] then PHValue[1] else R2PHValue[1];
def R2PHBarOrigin = if PHBarOrigin != PHBarOrigin[1] then PHBarOrigin[1] else R2PHBarOrigin[1];
def R2PHBarID = bar - R2PHBarOrigin;

# R3

def R3PHValue = if R2PHBarOrigin != R2PHBarOrigin[1] then R2PHValue[1] else R3PHValue[1];
def R3PHBarOrigin = if R2PHBarOrigin != R2PHBarOrigin[1] then R2PHBarOrigin[1] else R3PHBarOrigin[1];
def R3PHBarID = bar - R3PHBarOrigin;

# R4

def R4PHValue = if R3PHBarOrigin != R3PHBarOrigin[1] then R3PHValue[1] else R4PHValue[1];
def R4PHBarOrigin = if R3PHBarOrigin != R3PHBarOrigin[1] then R3PHBarOrigin[1] else R4PHBarOrigin[1];
def R4PHBarID = bar - R4PHBarOrigin;

# R5

def R5PHValue = if R4PHBarOrigin != R4PHBarOrigin[1] then R4PHValue[1] else R5PHValue[1];
def R5PHBarOrigin = if R4PHBarOrigin != R4PHBarOrigin[1] then R4PHBarOrigin[1] else R5PHBarOrigin[1];
def R5PHBarID = bar - R5PHBarOrigin;

# R6

def R6PHValue = if R5PHBarOrigin != R5PHBarOrigin[1] then R5PHValue[1] else R6PHValue[1];
def R6PHBarOrigin = if R5PHBarOrigin != R5PHBarOrigin[1] then R5PHBarOrigin[1] else R6PHBarOrigin[1];
def R6PHBarID = bar - R6PHBarOrigin;

# R5

def R7PHValue = if R6PHBarOrigin != R6PHBarOrigin[1] then R6PHValue[1] else R7PHValue[1];
def R7PHBarOrigin = if R6PHBarOrigin != R6PHBarOrigin[1] then R6PHBarOrigin[1] else R7PHBarOrigin[1];
def R7PHBarID = bar - R7PHBarOrigin;

# R8

def R8PHValue = if R7PHBarOrigin != R7PHBarOrigin[1] then R7PHValue[1] else R8PHValue[1];
def R8PHBarOrigin = if R7PHBarOrigin != R7PHBarOrigin[1] then R7PHBarOrigin[1] else R8PHBarOrigin[1];
def R8PHBarID = bar - R8PHBarOrigin;

# R9

def R9PHValue = if R8PHBarOrigin != R8PHBarOrigin[1] then R8PHValue[1] else R9PHValue[1];
def R9PHBarOrigin = if R8PHBarOrigin != R8PHBarOrigin[1] then R8PHBarOrigin[1] else R9PHBarOrigin[1];
def R9PHBarID = bar - R9PHBarOrigin;

# R10

def R10PHValue = if R9PHBarOrigin != R9PHBarOrigin[1] then R9PHValue[1] else R10PHValue[1];
def R10PHBarOrigin = if R9PHBarOrigin != R9PHBarOrigin[1] then R9PHBarOrigin[1] else R10PHBarOrigin[1];
def R10PHBarID = bar - R10PHBarOrigin;


# Parent Low

def ParentLow = LowestAll(l);
def ParentLBarOrigin = if l == ParentLow then bar else ParentLBarOrigin[1];
def ParentLBarID = bar - ParentLBarOrigin;

# S1

def ll = fold j = 1 to n + 1 with q = 1 while q do l < GetValue(l, -j);
def PivotL = if (bar > n and l == Lowest(l, n) and ll) then l else Double.NaN;
def PLValue = if !IsNaN(PivotL) then PivotL else PLValue[1];
def PLBarOrigin = if !IsNaN(PivotL) then bar else PLBarOrigin[1];
def PLBarID = bar - PLBarOrigin;

# S2

def S2PLValue = if PLBarOrigin != PLBarOrigin[1] then PLValue[1] else S2PLValue[1];
def S2PLBarOrigin = if PLBarOrigin != PLBarOrigin[1] then PLBarOrigin[1] else S2PLBarOrigin[1];
def S2PLBarID = bar - S2PLBarOrigin;

# S3

def S3PLValue = if S2PLBarOrigin != S2PLBarOrigin[1] then S2PLValue[1] else S3PLValue[1];
def S3PLBarOrigin = if S2PLBarOrigin != S2PLBarOrigin[1] then S2PLBarOrigin[1] else S3PLBarOrigin[1];
def S3PLBarID = bar - S3PLBarOrigin;

# S4

def S4PLValue = if S3PLBarOrigin != S3PLBarOrigin[1] then S3PLValue[1] else S4PLValue[1];
def S4PLBarOrigin = if S3PLBarOrigin != S3PLBarOrigin[1] then S3PLBarOrigin[1] else S4PLBarOrigin[1];
def S4PLBarID = bar - S4PLBarOrigin;

# S5

def S5PLValue = if S4PLBarOrigin != S4PLBarOrigin[1] then S4PLValue[1] else S5PLValue[1];
def S5PLBarOrigin = if S4PLBarOrigin != S4PLBarOrigin[1] then S4PLBarOrigin[1] else S5PLBarOrigin[1];
def S5PLBarID = bar - S5PLBarOrigin;

# S6

def S6PLValue = if S5PLBarOrigin != S5PLBarOrigin[1] then S5PLValue[1] else S6PLValue[1];
def S6PLBarOrigin = if S5PLBarOrigin != S5PLBarOrigin[1] then S5PLBarOrigin[1] else S6PLBarOrigin[1];
def S6PLBarID = bar - S6PLBarOrigin;

# S7

def S7PLValue = if S6PLBarOrigin != S6PLBarOrigin[1] then S6PLValue[1] else S7PLValue[1];
def S7PLBarOrigin = if S6PLBarOrigin != S6PLBarOrigin[1] then S6PLBarOrigin[1] else S7PLBarOrigin[1];
def S7PLBarID = bar - S7PLBarOrigin;

# S8

def S8PLValue = if S7PLBarOrigin != S7PLBarOrigin[1] then S7PLValue[1] else S8PLValue[1];
def S8PLBarOrigin = if S7PLBarOrigin != S7PLBarOrigin[1] then S7PLBarOrigin[1] else S8PLBarOrigin[1];
def S8PLBarID = bar - S8PLBarOrigin;

# S9

def S9PLValue = if S8PLBarOrigin != S8PLBarOrigin[1] then S8PLValue[1] else S9PLValue[1];
def S9PLBarOrigin = if S8PLBarOrigin != S8PLBarOrigin[1] then S8PLBarOrigin[1] else S9PLBarOrigin[1];
def S9PLBarID = bar - S9PLBarOrigin;

# S10

def S10PLValue = if S9PLBarOrigin != S9PLBarOrigin[1] then S9PLValue[1] else S10PLValue[1];
def S10PLBarOrigin = if S9PLBarOrigin != S9PLBarOrigin[1] then S9PLBarOrigin[1] else S10PLBarOrigin[1];
def S10PLBarID = bar - S10PLBarOrigin;

# Plots

plot PR1 = LinePlot(BarID = ParentHBarID, Value = ParentHigh, BarOrigin = HighestAll(ParentHBarOrigin));
PR1.SetDefaultColor(Color.RED);
AddChartBubble(bar == HighestAll(ParentHBarOrigin), ParentHigh, "B", Color.YELLOW, 1);

plot R1 = LinePlot(BarID = PHBarID, Value = PHValue, BarOrigin = PHBarOrigin);
R1.SetDefaultColor(Color.RED);
def r1v = if bar == HighestAll(PHBarOrigin) then h else r1v[1];
def crossr1 = if bar < HighestAll(PHBarOrigin) then 0 else if bar > HighestAll(PHBarOrigin) and c crosses HighestAll(r1v) then crossr1[1] + 1 else crossr1[1];
R1.SetHiding(crossr1 >= sh);
AddChartBubble(HighestAll(crossr1) < sh and bar == HighestAll(PHBarOrigin), PHValue, "R1", Color.RED, 1);


plot R1_ = LinePlot(BarID = PHBarID, Value = R1 + Num_Dev_up, BarOrigin = PHBarOrigin);
R1_.SetDefaultColor(Color.RED);
R1_.SetHiding(crossr1 >= sh);
AddCloud(if ShowSRLevelsCloud then R1_ else Double.NaN , R1, Color.LIGHT_RED , Color.LIGHT_RED);


plot R2 = LinePlot(BarID = R2PHBarID, Value = R2PHValue, BarOrigin = R2PHBarOrigin);
R2.SetDefaultColor(Color.RED);
def r2v = if bar == HighestAll(R2PHBarOrigin) then h else r2v[1];
def crossr2 = if bar < HighestAll(R2PHBarOrigin) then 0 else if bar > HighestAll(R2PHBarOrigin) and c crosses HighestAll(r2v) then crossr2[1] + 1 else crossr2[1];
R2.SetHiding(crossr2 >= sh);
AddChartBubble(HighestAll(crossr2) < sh and bar == HighestAll(R2PHBarOrigin), PHValue, "R2", Color.RED, 1);


plot R2_ = LinePlot(BarID = R2PHBarID, Value = R2 + Num_Dev_up, BarOrigin = R2PHBarOrigin);
R2_.SetDefaultColor(Color.RED);
R2_.SetHiding(crossr2 >= sh);
AddCloud(if ShowSRLevelsCloud then R2_ else Double.NaN , R2, Color.LIGHT_RED , Color.LIGHT_RED);


plot R3 = LinePlot(BarID = R3PHBarID, Value = R3PHValue, BarOrigin = R3PHBarOrigin);
R3.SetDefaultColor(Color.RED);
def r3v = if bar == HighestAll(R3PHBarOrigin) then h else r3v[1];
def crossr3 = if bar < HighestAll(R3PHBarOrigin) then 0 else if bar > HighestAll(R3PHBarOrigin) and c crosses HighestAll(r3v) then crossr3[1] + 1 else crossr3[1];
R3.SetHiding(crossr3 >= sh);
AddChartBubble(HighestAll(crossr3) < sh and bar == HighestAll(R3PHBarOrigin), PHValue, "R3", Color.RED, 1);


plot R3_ = LinePlot(BarID = R3PHBarID, Value = R3 + Num_Dev_up, BarOrigin = R3PHBarOrigin);
R3_.SetLineWeight(1);
R3_.SetDefaultColor(Color.RED);
R3_.SetHiding(crossr3 >= sh);
AddCloud(if ShowSRLevelsCloud then R3_ else Double.NaN , R3, Color.LIGHT_RED , Color.LIGHT_RED);


plot R4 = LinePlot(BarID = R4PHBarID, Value = R4PHValue, BarOrigin = R4PHBarOrigin);
R4.SetDefaultColor(Color.RED);
def r4v = if bar == HighestAll(R4PHBarOrigin) then h else r4v[1];
def crossr4 = if bar < HighestAll(R4PHBarOrigin) then 0 else if bar > HighestAll(R4PHBarOrigin) and c crosses HighestAll(r4v) then crossr4[1] + 1 else crossr4[1];
R4.SetHiding(crossr4 >= sh);
AddChartBubble(HighestAll(crossr4) < sh and bar == HighestAll(R4PHBarOrigin), PHValue, "R4", Color.RED, 1);

plot R4_ = LinePlot(BarID = R4PHBarID, Value = R4 + Num_Dev_up, BarOrigin = R4PHBarOrigin);
R4_.SetLineWeight(1);
R4_.SetDefaultColor(Color.LIGHT_RED);
R4_.SetHiding(crossr4 >= sh);
AddCloud(if ShowSRLevelsCloud then R4_ else Double.NaN , R4, Color.LIGHT_RED , Color.LIGHT_RED);


plot R5 = LinePlot(BarID = R5PHBarID, Value = R5PHValue, BarOrigin = R5PHBarOrigin);
R5.SetDefaultColor(Color.RED);
def r5v = if bar == HighestAll(R5PHBarOrigin) then h else r5v[1];
def crossr5 = if bar < HighestAll(R5PHBarOrigin) then 0 else if bar > HighestAll(R5PHBarOrigin) and c crosses HighestAll(r5v) then crossr5[1] + 1 else crossr5[1];
R5.SetHiding(crossr5 >= sh);
AddChartBubble(HighestAll(crossr5) < sh and bar == HighestAll(R5PHBarOrigin), PHValue, "R5", Color.RED, 1);


plot R5_ = LinePlot(BarID = R5PHBarID, Value = R5 + Num_Dev_up, BarOrigin = R5PHBarOrigin);
R5_.SetDefaultColor(Color.RED);
R5_.SetHiding(crossr5 >= sh);
AddCloud(if ShowSRLevelsCloud then R5_ else Double.NaN , R5, Color.LIGHT_RED , Color.LIGHT_RED);


plot R6 = LinePlot(BarID = R6PHBarID, Value = R6PHValue, BarOrigin = R6PHBarOrigin);
R6.SetDefaultColor(Color.RED);
def r6v = if bar == HighestAll(R6PHBarOrigin) then h else r6v[1];
def crossr6 = if bar < HighestAll(R6PHBarOrigin) then 0 else if bar > HighestAll(R6PHBarOrigin) and c crosses HighestAll(r6v) then crossr6[1] + 1 else crossr6[1];
R6.SetHiding(crossr6 >= sh);
AddChartBubble(HighestAll(crossr6) < sh and bar == HighestAll(R6PHBarOrigin), PHValue, "R6", Color.RED, 1);


plot R6_ = LinePlot(BarID = R6PHBarID, Value = R6+Num_Dev_up, BarOrigin = R6PHBarOrigin);
R6_.SetDefaultColor(Color.RED);
R6_.SetHiding(crossr6 >= sh);
AddCloud(if ShowSRLevelsCloud then R6_ else Double.NaN , R6, Color.LIGHT_RED , Color.LIGHT_RED);


plot R7 = LinePlot(BarID = R7PHBarID, Value = R7PHValue, BarOrigin = R7PHBarOrigin);
R7.SetDefaultColor(Color.RED);
def r7v = if bar == HighestAll(R7PHBarOrigin) then h else r7v[1];
def crossr7 = if bar < HighestAll(R7PHBarOrigin) then 0 else if bar > HighestAll(R7PHBarOrigin) and c crosses HighestAll(r7v) then crossr7[1] + 1 else crossr7[1];
R7.SetHiding(crossr7 >= sh);
AddChartBubble(HighestAll(crossr7) < sh and bar == HighestAll(R7PHBarOrigin), PHValue, "R7", Color.RED, 1);

plot R7_ = LinePlot(BarID = R7PHBarID, Value = R7 + Num_Dev_up, BarOrigin = R7PHBarOrigin);
R7_.SetDefaultColor(Color.RED);
R7_.SetHiding(crossr7 >= sh);
AddCloud(if ShowSRLevelsCloud then R7_ else Double.NaN , R7, Color.LIGHT_RED , Color.LIGHT_RED);

plot R8 = LinePlot(BarID = R8PHBarID, Value = R8PHValue, BarOrigin = R8PHBarOrigin);
R8.SetDefaultColor(Color.RED);
def r8v = if bar == HighestAll(R8PHBarOrigin) then h else r8v[1];
def crossr8 = if bar < HighestAll(R8PHBarOrigin) then 0 else if bar > HighestAll(R8PHBarOrigin) and c crosses HighestAll(r8v) then crossr8[1] + 1 else crossr8[1];
R8.SetHiding(crossr8 >= sh);
AddChartBubble(HighestAll(crossr8) < sh and bar == HighestAll(R8PHBarOrigin), PHValue, "R8", Color.RED, 1);


plot R8_ = LinePlot(BarID = R8PHBarID, Value = R8 + Num_Dev_up, BarOrigin = R8PHBarOrigin);
R8_.SetDefaultColor(Color.RED);
R8_.SetHiding(crossr8 >= sh);
AddCloud(if ShowSRLevelsCloud then R8_ else Double.NaN , R8, Color.LIGHT_RED , Color.LIGHT_RED);


plot R9 = LinePlot(BarID = R9PHBarID, Value = R9PHValue, BarOrigin = R9PHBarOrigin);
R9.SetDefaultColor(Color.RED);
def r9v = if bar == HighestAll(R9PHBarOrigin) then h else r9v[1];
def crossr9 = if bar < HighestAll(R9PHBarOrigin) then 0 else if bar > HighestAll(R9PHBarOrigin) and c crosses HighestAll(r9v) then crossr9[1] + 1 else crossr9[1];
R9.SetHiding(crossr9 >= sh);
AddChartBubble(HighestAll(crossr9) < sh and bar == HighestAll(R9PHBarOrigin), PHValue, "R9", Color.RED, 1);


plot R9_ = LinePlot(BarID = R9PHBarID, Value = R9 + Num_Dev_up, BarOrigin = R9PHBarOrigin);
R9_.SetDefaultColor(Color.RED);
R9_.SetHiding(crossr9 >= sh);
AddCloud(if ShowSRLevelsCloud then R9_ else Double.NaN , R9, Color.LIGHT_RED , Color.LIGHT_RED);


plot R10 = LinePlot(BarID = R10PHBarID, Value = R10PHValue, BarOrigin = R10PHBarOrigin);
R10.SetDefaultColor(Color.RED);
def r10v = if bar == HighestAll(R10PHBarOrigin) then h else r10v[1];
def crossr10 = if bar < HighestAll(R10PHBarOrigin) then 0 else if bar > HighestAll(R10PHBarOrigin) and c crosses HighestAll(r10v) then crossr10[1] + 1 else crossr10[1];
R10.SetHiding(crossr10 >= sh);
AddChartBubble(HighestAll(crossr10) < sh and bar == HighestAll(R10PHBarOrigin), PHValue, "R10", Color.RED, 1);


plot R10_ = LinePlot(BarID = R10PHBarID, Value = R10 + Num_Dev_up, BarOrigin = R10PHBarOrigin);
R10_.SetDefaultColor(Color.RED);
R10_.SetHiding(crossr10 >= sh);
AddCloud(if ShowSRLevelsCloud then R10_ else Double.NaN , R10, Color.LIGHT_RED , Color.LIGHT_RED);


plot PS1 = LinePlot(BarID = ParentLBarID, Value = ParentLow, BarOrigin = HighestAll(ParentLBarOrigin));
PS1.SetDefaultColor(Color.GREEN);
AddChartBubble(bar == HighestAll(ParentLBarOrigin), ParentLow, "A", Color.YELLOW, 0);

plot S1 = LinePlot(BarID = PLBarID, Value = PLValue, BarOrigin = PLBarOrigin);
S1.SetDefaultColor(Color.GREEN);
def s1v = if bar == HighestAll(PLBarOrigin) then l else s1v[1];
def crosss1 = if bar < HighestAll(PLBarOrigin) then 0 else if bar > HighestAll(PLBarOrigin) and c crosses HighestAll(s1v) then crosss1[1] + 1 else crosss1[1];
S1.SetHiding(crosss1 >= sh);
AddChartBubble(HighestAll(crosss1) < sh and bar == HighestAll(PLBarOrigin), PLValue, "S1", Color.GREEN, 0);


plot S2 = LinePlot(BarID = S2PLBarID,
Value = S2PLValue,
BarOrigin = S2PLBarOrigin);
S2.SetDefaultColor(Color.GREEN);
def s2v = if bar == HighestAll(S2PLBarOrigin) then l else s2v[1];
def crosss2 = if bar < HighestAll(S2PLBarOrigin) then 0 else if bar > HighestAll(S2PLBarOrigin) and c crosses HighestAll(s2v) then crosss2[1] + 1 else crosss2[1];
S2.SetHiding(crosss2 >= sh);
AddChartBubble(HighestAll(crosss2) < sh and bar == HighestAll(S2PLBarOrigin), PLValue, "S2", Color.GREEN, 0);
plot S3 = LinePlot(BarID = S3PLBarID, Value = S3PLValue, BarOrigin = S3PLBarOrigin);
S3.SetDefaultColor(Color.GREEN);
def s3v = if bar == HighestAll(S3PLBarOrigin) then l else s3v[1];
def crosss3 = if bar < HighestAll(S3PLBarOrigin) then 0 else if bar > HighestAll(S3PLBarOrigin) and c crosses HighestAll(s3v) then crosss3[1] + 1 else crosss3[1];
S3.SetHiding(crosss3 >= sh);
AddChartBubble(HighestAll(crosss3) < sh and bar == HighestAll(S3PLBarOrigin), PLValue, "S3", Color.GREEN, 0);
plot S4 = LinePlot(BarID = S4PLBarID, Value = S4PLValue, BarOrigin = S4PLBarOrigin);
S4.SetDefaultColor(Color.GREEN);
def s4v = if bar == HighestAll(S4PLBarOrigin) then l else s4v[1];
def crosss4 = if bar < HighestAll(S4PLBarOrigin) then 0 else if bar > HighestAll(S4PLBarOrigin) and c crosses HighestAll(s4v) then crosss4[1] + 1 else crosss4[1];
S4.SetHiding(crosss4 >= sh);
AddChartBubble(HighestAll(crosss4) < sh and bar == HighestAll(S4PLBarOrigin), PLValue, "S4", Color.GREEN, 0);
plot S5 = LinePlot(BarID = S5PLBarID,
Value = S5PLValue,
BarOrigin = S5PLBarOrigin);
S5.SetDefaultColor(Color.GREEN);
def s5v = if bar == HighestAll(S5PLBarOrigin) then l else s5v[1];
def crosss5 = if bar < HighestAll(S5PLBarOrigin) then 0 else if bar > HighestAll(S5PLBarOrigin) and c crosses HighestAll(s5v) then crosss5[1] + 1 else crosss5[1];
S5.SetHiding(crosss5 >= sh);
AddChartBubble(HighestAll(crosss5) < sh and bar == HighestAll(S5PLBarOrigin), PLValue, "S5", Color.GREEN, 0);
plot S6 = LinePlot(BarID = S6PLBarID, Value = S6PLValue, BarOrigin = S6PLBarOrigin);
S6.SetDefaultColor(Color.GREEN);
def s6v = if bar == HighestAll(S6PLBarOrigin) then l else s6v[1];
def crosss6 = if bar < HighestAll(S6PLBarOrigin) then 0 else if bar > HighestAll(S6PLBarOrigin) and c crosses HighestAll(s6v) then crosss6[1] + 1 else crosss6[1];
S6.SetHiding(crosss6 >= sh);
AddChartBubble(HighestAll(crosss6) < sh and bar == HighestAll(S6PLBarOrigin), PLValue, "S6", Color.GREEN, 0);
plot S7 = LinePlot(BarID = S7PLBarID, Value = S7PLValue, BarOrigin = S7PLBarOrigin);
S7.SetDefaultColor(Color.GREEN);
def s7v = if bar == HighestAll(S7PLBarOrigin) then l else s7v[1];
def crosss7 = if bar < HighestAll(S7PLBarOrigin) then 0 else if bar > HighestAll(S7PLBarOrigin) and c crosses HighestAll(s7v) then crosss7[1] + 1 else crosss7[1];
S7.SetHiding(crosss7 >= sh);
AddChartBubble(HighestAll(crosss7) < sh and bar == HighestAll(S7PLBarOrigin), PLValue, "S7", Color.GREEN, 0);
plot S8 = LinePlot(BarID = S8PLBarID, Value = S8PLValue, BarOrigin = S8PLBarOrigin);
S8.SetDefaultColor(Color.GREEN);
def s8v = if bar == HighestAll(S8PLBarOrigin) then l else s8v[1];
def crosss8 = if bar < HighestAll(S8PLBarOrigin) then 0 else if bar > HighestAll(S8PLBarOrigin) and c crosses HighestAll(s8v) then crosss8[1] + 1 else crosss8[1];
S8.SetHiding(crosss8 >= sh);
AddChartBubble(HighestAll(crosss8) < sh and bar == HighestAll(S8PLBarOrigin), PLValue, "S8", Color.GREEN, 0);
plot S9 = LinePlot(BarID = S9PLBarID, Value = S9PLValue, BarOrigin = S9PLBarOrigin);
def s9v = if bar == HighestAll(S9PLBarOrigin) then l else s9v[1];
def crosss9 = if bar < HighestAll(S9PLBarOrigin) then 0 else if bar > HighestAll(S9PLBarOrigin) and c crosses HighestAll(s9v) then crosss9[1] + 1 else crosss9[1];
S9.SetHiding(crosss9 >= sh);
AddChartBubble(HighestAll(crosss9) < sh and bar == HighestAll(S9PLBarOrigin), PLValue, "S9", Color.GREEN, 0);
S9.SetDefaultColor(Color.GREEN);
plot S10 = LinePlot(BarID = S10PLBarID, Value = S10PLValue, BarOrigin = S10PLBarOrigin);
S10.SetDefaultColor(Color.GREEN);
def s10v = if bar == HighestAll(S10PLBarOrigin) then l else s10v[1];
def crosss10 = if bar < HighestAll(S10PLBarOrigin) then 0 else if bar > HighestAll(S10PLBarOrigin) and c crosses HighestAll(s10v) then crosss10[1] + 1 else crosss10[1];
S10.SetHiding(crosss10 >= sh);
AddChartBubble(HighestAll(crosss10) < sh and bar == HighestAll(S10PLBarOrigin), PLValue, "S10", Color.GREEN, 0);

# End Code Fractal Array 11 Deep
# Trend Line

def PH_low = if bar == ParentHBarOrigin then l else PH_low[1];
def firstParentBar = Min(HighestAll(ParentLBarOrigin), HighestAll(ParentHBarOrigin));
def lastParentBar = Max(HighestAll(ParentLBarOrigin), HighestAll(ParentHBarOrigin));
def firstParent = if bar == firstParentBar and l == PH_low then PH_low else if bar == firstParentBar and l == ParentLow then ParentLow else firstParent[1];
def lastParent = if bar == lastParentBar and l == PH_low then PH_low else if bar == lastParentBar and l == ParentLow then ParentLow else lastParent[1];
def slope = (lastParent - firstParent) / (lastParentBar - firstParentBar);

plot SupportLine = if bar == ParentHBarOrigin then ParentHigh else if bar == ParentLBarOrigin then ParentLow else Double.NaN;
SupportLine.EnableApproximation();
SupportLine.SetDefaultColor(Color.GRAY);
SupportLine.SetLineWeight(2);
SupportLine.SetStyle(Curve.LONG_DASH);

plot ExtLine = if bar >= lastParentBar then (bar - lastParentBar) * slope + lastParent else Double.NaN;
ExtLine.EnableApproximation();
ExtLine.SetDefaultColor(Color.GRAY);
ExtLine.SetLineWeight(2);
ExtLine.SetStyle(Curve.LONG_DASH);
ExtLine.Hide();

AddChartBubble(WaveLabel and bar == HighestAll(bar), HighestAll(high),
"Basic Elliott Wave Rules:" + "\n" +
"Wave (2) cannot retrace past the start of Wave (1)" + "\n" +
"Wave (3) cannot be the shortest wave in a 5 wave sequence." + "\n" +
"Wave (4) cannot retrace into Wave (1)" + "\n", Color.WHITE, 1);

plot waves = if !IsNaN(PivotH) then PivotH else if !IsNaN(PivotL) then PivotL else Double.NaN;
waves.SetStyle(Curve.FIRM);
waves.EnableApproximation();
waves.SetDefaultColor(Color.CYAN);
waves.SetLineWeight(2);
waves.SetHiding(!ShowWaves);

# Wave Pattern

def ParentMaxBar = Max(ParentHBarOrigin, ParentLBarOrigin);
def ParentMinBar = Min(ParentLBarOrigin, ParentLBarOrigin);
def deltaPos = if ParentHBarOrigin == ParentMaxBar then 1 else 0;

# Clouds

AddCloud(if ShowSupportResistanceCloud then R1 else Double.NaN, S1, Color.DARK_GRAY, Color.DARK_GRAY);


ERdHUGY.jpg
 
Hi guys, I keep trying to add clouds at each support and Resistance , I succeeded, but so far I can't get the clouds to hide along with the lines, I'll leave the code to see if someone helps me see what happens, For now I have only done it on the Resistance , thanks in advanced


#StudyName: BLT_HarndogLazyFractalPivots
#Version/Date: v2 01-13-2016 TOS.mx Link: http://tos.mx/2CTLqx #Type: [Study | Strategy]
#Description: Instead of redrafting fractal pivots to frame market behavior
# this adaption of Mobius' FractalPivotsArrayV3 was modified by
# by BLT/ZZZ/LB using a Harndog test script idea to generate
# lazy fractal pivot lines.
#Requested By: Harndog in chat starting around 02/12/17
#History: TOS.mx Link:
# Notes: The idea is based on Mobius Fractal Pivot Array http://tos.mx/Yf06LY
# Annotation:
# V02: Added ExtLine.Hide: because script was generating expansion problems
# Changed Plot Support Line (line 450) to
# plot SupportLine = if bar == ParentHbarOrigin
# then ParentHigh
# else if bar == ParentLbarOrigin
# then ParentLow
# else double.nan;
# Suggestion from Brian_ss
# Trading Notes: Play with the script properties to adjust fractal pivots,
# aggregations
# 18:58 blt_: harndog, if you still are looking for hiding pivots in your version of "lazy pivots", maybe this will help. It hides pivots when a close crosses the pivot. You can set how many crosses before a line is hidden. The bubble was also set to hide if the pivot line is hidden. The current/higher option was changed to allow for more

# Fractal Pivot Array 11 deep
# Mobius
# V03.01.2017
# V02: Added some information on Basic Wave Structure and labels to hold wave data started
# V03: Added User Input for secondary aggregations. Add a label to show what chart aggregation pivots are being plotted. Add a cloud to show first zone of support / resistance. Altered Support line plot to extend at a consistent slope. Reset UI's for WaveLabel and ShowWaves to no.

# User Inputs
input length = 300;
input averageType = AverageType.WILDERS;
input n = 10;
input WaveLabel = no;
input ShowWaves = no;
input ShowSupportResistanceCloud = no;
input select_aggperiod = {default "Current", "Higher"};
input higheragg = AggregationPeriod.THREE_MIN;
input sethiding_crosses_required = 1;
input ShowSRLevelsCloud = yes;
def closecloud = yes;



def sh = sethiding_crosses_required;

def ATR = MovingAverage(AverageType.SIMPLE, TrueRange(high, close, low), length);
def Num_Dev_Dn = ATR ;
def Num_Dev_up = - ATR ;



# Internal Script Reference
script LinePlot
{
input BarID = 0;
input Value = 0;
input BarOrigin = 0;
def ThisBar = HighestAll(BarOrigin);
def ValueLine = if BarOrigin == ThisBar then Value else Double.NaN;

plot P = if ThisBar - BarID <= BarOrigin then HighestAll(ValueLine) else Double.NaN;
}

# Variables

def o;
def h;
def l;
def c;
switch (select_aggperiod) {
case Current:
o = open;
h = high;
l = low;
c = if IsNaN(close) then c[1] else close;
case Higher:
o = open(period = higheragg);
h = high(period = higheragg);
l = low(period = higheragg);
c = if IsNaN(close(period = higheragg)) then c[1] else close(period = higheragg);
}

def bar = BarNumber();
def BBar = bar == HighestAll(bar);
def nan = Double.NaN;

# Parent High

def ParentHigh = HighestAll(h);
def ParentHBarOrigin = if h == ParentHigh then bar else ParentHBarOrigin[1];
def ParentHBarID = bar - HighestAll(ParentHBarOrigin);


# R1

def hh = fold i = 1 to n + 1 with p = 1 while p do h > GetValue(h, -i);
def PivotH = if (bar > n and h == Highest(h, n) and hh) then h else Double.NaN;
def PHValue = if !IsNaN(PivotH) then PivotH else PHValue[1];
def PHBarOrigin = if !IsNaN(PivotH) then bar else PHBarOrigin[1];
def PHBarID = bar - PHBarOrigin;
def xh = if h == hh then c else nan;


#plot hh_ = if PivotH >= HighestAll(xh) then HighestAll(if IsNaN(close[-1]) then hh else nan) else nan;
#hh_.SetDefaultColor(Color.RED);


# R2

def R2PHValue = if PHBarOrigin != PHBarOrigin[1] then PHValue[1] else R2PHValue[1];
def R2PHBarOrigin = if PHBarOrigin != PHBarOrigin[1] then PHBarOrigin[1] else R2PHBarOrigin[1];
def R2PHBarID = bar - R2PHBarOrigin;

# R3

def R3PHValue = if R2PHBarOrigin != R2PHBarOrigin[1] then R2PHValue[1] else R3PHValue[1];
def R3PHBarOrigin = if R2PHBarOrigin != R2PHBarOrigin[1] then R2PHBarOrigin[1] else R3PHBarOrigin[1];
def R3PHBarID = bar - R3PHBarOrigin;

# R4

def R4PHValue = if R3PHBarOrigin != R3PHBarOrigin[1] then R3PHValue[1] else R4PHValue[1];
def R4PHBarOrigin = if R3PHBarOrigin != R3PHBarOrigin[1] then R3PHBarOrigin[1] else R4PHBarOrigin[1];
def R4PHBarID = bar - R4PHBarOrigin;

# R5

def R5PHValue = if R4PHBarOrigin != R4PHBarOrigin[1] then R4PHValue[1] else R5PHValue[1];
def R5PHBarOrigin = if R4PHBarOrigin != R4PHBarOrigin[1] then R4PHBarOrigin[1] else R5PHBarOrigin[1];
def R5PHBarID = bar - R5PHBarOrigin;

# R6

def R6PHValue = if R5PHBarOrigin != R5PHBarOrigin[1] then R5PHValue[1] else R6PHValue[1];
def R6PHBarOrigin = if R5PHBarOrigin != R5PHBarOrigin[1] then R5PHBarOrigin[1] else R6PHBarOrigin[1];
def R6PHBarID = bar - R6PHBarOrigin;

# R5

def R7PHValue = if R6PHBarOrigin != R6PHBarOrigin[1] then R6PHValue[1] else R7PHValue[1];
def R7PHBarOrigin = if R6PHBarOrigin != R6PHBarOrigin[1] then R6PHBarOrigin[1] else R7PHBarOrigin[1];
def R7PHBarID = bar - R7PHBarOrigin;

# R8

def R8PHValue = if R7PHBarOrigin != R7PHBarOrigin[1] then R7PHValue[1] else R8PHValue[1];
def R8PHBarOrigin = if R7PHBarOrigin != R7PHBarOrigin[1] then R7PHBarOrigin[1] else R8PHBarOrigin[1];
def R8PHBarID = bar - R8PHBarOrigin;

# R9

def R9PHValue = if R8PHBarOrigin != R8PHBarOrigin[1] then R8PHValue[1] else R9PHValue[1];
def R9PHBarOrigin = if R8PHBarOrigin != R8PHBarOrigin[1] then R8PHBarOrigin[1] else R9PHBarOrigin[1];
def R9PHBarID = bar - R9PHBarOrigin;

# R10

def R10PHValue = if R9PHBarOrigin != R9PHBarOrigin[1] then R9PHValue[1] else R10PHValue[1];
def R10PHBarOrigin = if R9PHBarOrigin != R9PHBarOrigin[1] then R9PHBarOrigin[1] else R10PHBarOrigin[1];
def R10PHBarID = bar - R10PHBarOrigin;


# Parent Low

def ParentLow = LowestAll(l);
def ParentLBarOrigin = if l == ParentLow then bar else ParentLBarOrigin[1];
def ParentLBarID = bar - ParentLBarOrigin;

# S1

def ll = fold j = 1 to n + 1 with q = 1 while q do l < GetValue(l, -j);
def PivotL = if (bar > n and l == Lowest(l, n) and ll) then l else Double.NaN;
def PLValue = if !IsNaN(PivotL) then PivotL else PLValue[1];
def PLBarOrigin = if !IsNaN(PivotL) then bar else PLBarOrigin[1];
def PLBarID = bar - PLBarOrigin;

# S2

def S2PLValue = if PLBarOrigin != PLBarOrigin[1] then PLValue[1] else S2PLValue[1];
def S2PLBarOrigin = if PLBarOrigin != PLBarOrigin[1] then PLBarOrigin[1] else S2PLBarOrigin[1];
def S2PLBarID = bar - S2PLBarOrigin;

# S3

def S3PLValue = if S2PLBarOrigin != S2PLBarOrigin[1] then S2PLValue[1] else S3PLValue[1];
def S3PLBarOrigin = if S2PLBarOrigin != S2PLBarOrigin[1] then S2PLBarOrigin[1] else S3PLBarOrigin[1];
def S3PLBarID = bar - S3PLBarOrigin;

# S4

def S4PLValue = if S3PLBarOrigin != S3PLBarOrigin[1] then S3PLValue[1] else S4PLValue[1];
def S4PLBarOrigin = if S3PLBarOrigin != S3PLBarOrigin[1] then S3PLBarOrigin[1] else S4PLBarOrigin[1];
def S4PLBarID = bar - S4PLBarOrigin;

# S5

def S5PLValue = if S4PLBarOrigin != S4PLBarOrigin[1] then S4PLValue[1] else S5PLValue[1];
def S5PLBarOrigin = if S4PLBarOrigin != S4PLBarOrigin[1] then S4PLBarOrigin[1] else S5PLBarOrigin[1];
def S5PLBarID = bar - S5PLBarOrigin;

# S6

def S6PLValue = if S5PLBarOrigin != S5PLBarOrigin[1] then S5PLValue[1] else S6PLValue[1];
def S6PLBarOrigin = if S5PLBarOrigin != S5PLBarOrigin[1] then S5PLBarOrigin[1] else S6PLBarOrigin[1];
def S6PLBarID = bar - S6PLBarOrigin;

# S7

def S7PLValue = if S6PLBarOrigin != S6PLBarOrigin[1] then S6PLValue[1] else S7PLValue[1];
def S7PLBarOrigin = if S6PLBarOrigin != S6PLBarOrigin[1] then S6PLBarOrigin[1] else S7PLBarOrigin[1];
def S7PLBarID = bar - S7PLBarOrigin;

# S8

def S8PLValue = if S7PLBarOrigin != S7PLBarOrigin[1] then S7PLValue[1] else S8PLValue[1];
def S8PLBarOrigin = if S7PLBarOrigin != S7PLBarOrigin[1] then S7PLBarOrigin[1] else S8PLBarOrigin[1];
def S8PLBarID = bar - S8PLBarOrigin;

# S9

def S9PLValue = if S8PLBarOrigin != S8PLBarOrigin[1] then S8PLValue[1] else S9PLValue[1];
def S9PLBarOrigin = if S8PLBarOrigin != S8PLBarOrigin[1] then S8PLBarOrigin[1] else S9PLBarOrigin[1];
def S9PLBarID = bar - S9PLBarOrigin;

# S10

def S10PLValue = if S9PLBarOrigin != S9PLBarOrigin[1] then S9PLValue[1] else S10PLValue[1];
def S10PLBarOrigin = if S9PLBarOrigin != S9PLBarOrigin[1] then S9PLBarOrigin[1] else S10PLBarOrigin[1];
def S10PLBarID = bar - S10PLBarOrigin;

# Plots

plot PR1 = LinePlot(BarID = ParentHBarID, Value = ParentHigh, BarOrigin = HighestAll(ParentHBarOrigin));
PR1.SetDefaultColor(Color.RED);
AddChartBubble(bar == HighestAll(ParentHBarOrigin), ParentHigh, "B", Color.YELLOW, 1);

plot R1 = LinePlot(BarID = PHBarID, Value = PHValue, BarOrigin = PHBarOrigin);
R1.SetDefaultColor(Color.RED);
def r1v = if bar == HighestAll(PHBarOrigin) then h else r1v[1];
def crossr1 = if bar < HighestAll(PHBarOrigin) then 0 else if bar > HighestAll(PHBarOrigin) and c crosses HighestAll(r1v) then crossr1[1] + 1 else crossr1[1];
R1.SetHiding(crossr1 >= sh);
AddChartBubble(HighestAll(crossr1) < sh and bar == HighestAll(PHBarOrigin), PHValue, "R1", Color.RED, 1);


plot R1_ = LinePlot(BarID = PHBarID, Value = R1 + Num_Dev_up, BarOrigin = PHBarOrigin);
R1_.SetDefaultColor(Color.RED);
R1_.SetHiding(crossr1 >= sh);
AddCloud(if ShowSRLevelsCloud then R1_ else Double.NaN , R1, Color.LIGHT_RED , Color.LIGHT_RED);


plot R2 = LinePlot(BarID = R2PHBarID, Value = R2PHValue, BarOrigin = R2PHBarOrigin);
R2.SetDefaultColor(Color.RED);
def r2v = if bar == HighestAll(R2PHBarOrigin) then h else r2v[1];
def crossr2 = if bar < HighestAll(R2PHBarOrigin) then 0 else if bar > HighestAll(R2PHBarOrigin) and c crosses HighestAll(r2v) then crossr2[1] + 1 else crossr2[1];
R2.SetHiding(crossr2 >= sh);
AddChartBubble(HighestAll(crossr2) < sh and bar == HighestAll(R2PHBarOrigin), PHValue, "R2", Color.RED, 1);


plot R2_ = LinePlot(BarID = R2PHBarID, Value = R2 + Num_Dev_up, BarOrigin = R2PHBarOrigin);
R2_.SetDefaultColor(Color.RED);
R2_.SetHiding(crossr2 >= sh);
AddCloud(if ShowSRLevelsCloud then R2_ else Double.NaN , R2, Color.LIGHT_RED , Color.LIGHT_RED);


plot R3 = LinePlot(BarID = R3PHBarID, Value = R3PHValue, BarOrigin = R3PHBarOrigin);
R3.SetDefaultColor(Color.RED);
def r3v = if bar == HighestAll(R3PHBarOrigin) then h else r3v[1];
def crossr3 = if bar < HighestAll(R3PHBarOrigin) then 0 else if bar > HighestAll(R3PHBarOrigin) and c crosses HighestAll(r3v) then crossr3[1] + 1 else crossr3[1];
R3.SetHiding(crossr3 >= sh);
AddChartBubble(HighestAll(crossr3) < sh and bar == HighestAll(R3PHBarOrigin), PHValue, "R3", Color.RED, 1);


plot R3_ = LinePlot(BarID = R3PHBarID, Value = R3 + Num_Dev_up, BarOrigin = R3PHBarOrigin);
R3_.SetLineWeight(1);
R3_.SetDefaultColor(Color.RED);
R3_.SetHiding(crossr3 >= sh);
AddCloud(if ShowSRLevelsCloud then R3_ else Double.NaN , R3, Color.LIGHT_RED , Color.LIGHT_RED);


plot R4 = LinePlot(BarID = R4PHBarID, Value = R4PHValue, BarOrigin = R4PHBarOrigin);
R4.SetDefaultColor(Color.RED);
def r4v = if bar == HighestAll(R4PHBarOrigin) then h else r4v[1];
def crossr4 = if bar < HighestAll(R4PHBarOrigin) then 0 else if bar > HighestAll(R4PHBarOrigin) and c crosses HighestAll(r4v) then crossr4[1] + 1 else crossr4[1];
R4.SetHiding(crossr4 >= sh);
AddChartBubble(HighestAll(crossr4) < sh and bar == HighestAll(R4PHBarOrigin), PHValue, "R4", Color.RED, 1);

plot R4_ = LinePlot(BarID = R4PHBarID, Value = R4 + Num_Dev_up, BarOrigin = R4PHBarOrigin);
R4_.SetLineWeight(1);
R4_.SetDefaultColor(Color.LIGHT_RED);
R4_.SetHiding(crossr4 >= sh);
AddCloud(if ShowSRLevelsCloud then R4_ else Double.NaN , R4, Color.LIGHT_RED , Color.LIGHT_RED);


plot R5 = LinePlot(BarID = R5PHBarID, Value = R5PHValue, BarOrigin = R5PHBarOrigin);
R5.SetDefaultColor(Color.RED);
def r5v = if bar == HighestAll(R5PHBarOrigin) then h else r5v[1];
def crossr5 = if bar < HighestAll(R5PHBarOrigin) then 0 else if bar > HighestAll(R5PHBarOrigin) and c crosses HighestAll(r5v) then crossr5[1] + 1 else crossr5[1];
R5.SetHiding(crossr5 >= sh);
AddChartBubble(HighestAll(crossr5) < sh and bar == HighestAll(R5PHBarOrigin), PHValue, "R5", Color.RED, 1);


plot R5_ = LinePlot(BarID = R5PHBarID, Value = R5 + Num_Dev_up, BarOrigin = R5PHBarOrigin);
R5_.SetDefaultColor(Color.RED);
R5_.SetHiding(crossr5 >= sh);
AddCloud(if ShowSRLevelsCloud then R5_ else Double.NaN , R5, Color.LIGHT_RED , Color.LIGHT_RED);


plot R6 = LinePlot(BarID = R6PHBarID, Value = R6PHValue, BarOrigin = R6PHBarOrigin);
R6.SetDefaultColor(Color.RED);
def r6v = if bar == HighestAll(R6PHBarOrigin) then h else r6v[1];
def crossr6 = if bar < HighestAll(R6PHBarOrigin) then 0 else if bar > HighestAll(R6PHBarOrigin) and c crosses HighestAll(r6v) then crossr6[1] + 1 else crossr6[1];
R6.SetHiding(crossr6 >= sh);
AddChartBubble(HighestAll(crossr6) < sh and bar == HighestAll(R6PHBarOrigin), PHValue, "R6", Color.RED, 1);


plot R6_ = LinePlot(BarID = R6PHBarID, Value = R6+Num_Dev_up, BarOrigin = R6PHBarOrigin);
R6_.SetDefaultColor(Color.RED);
R6_.SetHiding(crossr6 >= sh);
AddCloud(if ShowSRLevelsCloud then R6_ else Double.NaN , R6, Color.LIGHT_RED , Color.LIGHT_RED);


plot R7 = LinePlot(BarID = R7PHBarID, Value = R7PHValue, BarOrigin = R7PHBarOrigin);
R7.SetDefaultColor(Color.RED);
def r7v = if bar == HighestAll(R7PHBarOrigin) then h else r7v[1];
def crossr7 = if bar < HighestAll(R7PHBarOrigin) then 0 else if bar > HighestAll(R7PHBarOrigin) and c crosses HighestAll(r7v) then crossr7[1] + 1 else crossr7[1];
R7.SetHiding(crossr7 >= sh);
AddChartBubble(HighestAll(crossr7) < sh and bar == HighestAll(R7PHBarOrigin), PHValue, "R7", Color.RED, 1);

plot R7_ = LinePlot(BarID = R7PHBarID, Value = R7 + Num_Dev_up, BarOrigin = R7PHBarOrigin);
R7_.SetDefaultColor(Color.RED);
R7_.SetHiding(crossr7 >= sh);
AddCloud(if ShowSRLevelsCloud then R7_ else Double.NaN , R7, Color.LIGHT_RED , Color.LIGHT_RED);

plot R8 = LinePlot(BarID = R8PHBarID, Value = R8PHValue, BarOrigin = R8PHBarOrigin);
R8.SetDefaultColor(Color.RED);
def r8v = if bar == HighestAll(R8PHBarOrigin) then h else r8v[1];
def crossr8 = if bar < HighestAll(R8PHBarOrigin) then 0 else if bar > HighestAll(R8PHBarOrigin) and c crosses HighestAll(r8v) then crossr8[1] + 1 else crossr8[1];
R8.SetHiding(crossr8 >= sh);
AddChartBubble(HighestAll(crossr8) < sh and bar == HighestAll(R8PHBarOrigin), PHValue, "R8", Color.RED, 1);


plot R8_ = LinePlot(BarID = R8PHBarID, Value = R8 + Num_Dev_up, BarOrigin = R8PHBarOrigin);
R8_.SetDefaultColor(Color.RED);
R8_.SetHiding(crossr8 >= sh);
AddCloud(if ShowSRLevelsCloud then R8_ else Double.NaN , R8, Color.LIGHT_RED , Color.LIGHT_RED);


plot R9 = LinePlot(BarID = R9PHBarID, Value = R9PHValue, BarOrigin = R9PHBarOrigin);
R9.SetDefaultColor(Color.RED);
def r9v = if bar == HighestAll(R9PHBarOrigin) then h else r9v[1];
def crossr9 = if bar < HighestAll(R9PHBarOrigin) then 0 else if bar > HighestAll(R9PHBarOrigin) and c crosses HighestAll(r9v) then crossr9[1] + 1 else crossr9[1];
R9.SetHiding(crossr9 >= sh);
AddChartBubble(HighestAll(crossr9) < sh and bar == HighestAll(R9PHBarOrigin), PHValue, "R9", Color.RED, 1);


plot R9_ = LinePlot(BarID = R9PHBarID, Value = R9 + Num_Dev_up, BarOrigin = R9PHBarOrigin);
R9_.SetDefaultColor(Color.RED);
R9_.SetHiding(crossr9 >= sh);
AddCloud(if ShowSRLevelsCloud then R9_ else Double.NaN , R9, Color.LIGHT_RED , Color.LIGHT_RED);


plot R10 = LinePlot(BarID = R10PHBarID, Value = R10PHValue, BarOrigin = R10PHBarOrigin);
R10.SetDefaultColor(Color.RED);
def r10v = if bar == HighestAll(R10PHBarOrigin) then h else r10v[1];
def crossr10 = if bar < HighestAll(R10PHBarOrigin) then 0 else if bar > HighestAll(R10PHBarOrigin) and c crosses HighestAll(r10v) then crossr10[1] + 1 else crossr10[1];
R10.SetHiding(crossr10 >= sh);
AddChartBubble(HighestAll(crossr10) < sh and bar == HighestAll(R10PHBarOrigin), PHValue, "R10", Color.RED, 1);


plot R10_ = LinePlot(BarID = R10PHBarID, Value = R10 + Num_Dev_up, BarOrigin = R10PHBarOrigin);
R10_.SetDefaultColor(Color.RED);
R10_.SetHiding(crossr10 >= sh);
AddCloud(if ShowSRLevelsCloud then R10_ else Double.NaN , R10, Color.LIGHT_RED , Color.LIGHT_RED);


plot PS1 = LinePlot(BarID = ParentLBarID, Value = ParentLow, BarOrigin = HighestAll(ParentLBarOrigin));
PS1.SetDefaultColor(Color.GREEN);
AddChartBubble(bar == HighestAll(ParentLBarOrigin), ParentLow, "A", Color.YELLOW, 0);

plot S1 = LinePlot(BarID = PLBarID, Value = PLValue, BarOrigin = PLBarOrigin);
S1.SetDefaultColor(Color.GREEN);
def s1v = if bar == HighestAll(PLBarOrigin) then l else s1v[1];
def crosss1 = if bar < HighestAll(PLBarOrigin) then 0 else if bar > HighestAll(PLBarOrigin) and c crosses HighestAll(s1v) then crosss1[1] + 1 else crosss1[1];
S1.SetHiding(crosss1 >= sh);
AddChartBubble(HighestAll(crosss1) < sh and bar == HighestAll(PLBarOrigin), PLValue, "S1", Color.GREEN, 0);


plot S2 = LinePlot(BarID = S2PLBarID,
Value = S2PLValue,
BarOrigin = S2PLBarOrigin);
S2.SetDefaultColor(Color.GREEN);
def s2v = if bar == HighestAll(S2PLBarOrigin) then l else s2v[1];
def crosss2 = if bar < HighestAll(S2PLBarOrigin) then 0 else if bar > HighestAll(S2PLBarOrigin) and c crosses HighestAll(s2v) then crosss2[1] + 1 else crosss2[1];
S2.SetHiding(crosss2 >= sh);
AddChartBubble(HighestAll(crosss2) < sh and bar == HighestAll(S2PLBarOrigin), PLValue, "S2", Color.GREEN, 0);
plot S3 = LinePlot(BarID = S3PLBarID, Value = S3PLValue, BarOrigin = S3PLBarOrigin);
S3.SetDefaultColor(Color.GREEN);
def s3v = if bar == HighestAll(S3PLBarOrigin) then l else s3v[1];
def crosss3 = if bar < HighestAll(S3PLBarOrigin) then 0 else if bar > HighestAll(S3PLBarOrigin) and c crosses HighestAll(s3v) then crosss3[1] + 1 else crosss3[1];
S3.SetHiding(crosss3 >= sh);
AddChartBubble(HighestAll(crosss3) < sh and bar == HighestAll(S3PLBarOrigin), PLValue, "S3", Color.GREEN, 0);
plot S4 = LinePlot(BarID = S4PLBarID, Value = S4PLValue, BarOrigin = S4PLBarOrigin);
S4.SetDefaultColor(Color.GREEN);
def s4v = if bar == HighestAll(S4PLBarOrigin) then l else s4v[1];
def crosss4 = if bar < HighestAll(S4PLBarOrigin) then 0 else if bar > HighestAll(S4PLBarOrigin) and c crosses HighestAll(s4v) then crosss4[1] + 1 else crosss4[1];
S4.SetHiding(crosss4 >= sh);
AddChartBubble(HighestAll(crosss4) < sh and bar == HighestAll(S4PLBarOrigin), PLValue, "S4", Color.GREEN, 0);
plot S5 = LinePlot(BarID = S5PLBarID,
Value = S5PLValue,
BarOrigin = S5PLBarOrigin);
S5.SetDefaultColor(Color.GREEN);
def s5v = if bar == HighestAll(S5PLBarOrigin) then l else s5v[1];
def crosss5 = if bar < HighestAll(S5PLBarOrigin) then 0 else if bar > HighestAll(S5PLBarOrigin) and c crosses HighestAll(s5v) then crosss5[1] + 1 else crosss5[1];
S5.SetHiding(crosss5 >= sh);
AddChartBubble(HighestAll(crosss5) < sh and bar == HighestAll(S5PLBarOrigin), PLValue, "S5", Color.GREEN, 0);
plot S6 = LinePlot(BarID = S6PLBarID, Value = S6PLValue, BarOrigin = S6PLBarOrigin);
S6.SetDefaultColor(Color.GREEN);
def s6v = if bar == HighestAll(S6PLBarOrigin) then l else s6v[1];
def crosss6 = if bar < HighestAll(S6PLBarOrigin) then 0 else if bar > HighestAll(S6PLBarOrigin) and c crosses HighestAll(s6v) then crosss6[1] + 1 else crosss6[1];
S6.SetHiding(crosss6 >= sh);
AddChartBubble(HighestAll(crosss6) < sh and bar == HighestAll(S6PLBarOrigin), PLValue, "S6", Color.GREEN, 0);
plot S7 = LinePlot(BarID = S7PLBarID, Value = S7PLValue, BarOrigin = S7PLBarOrigin);
S7.SetDefaultColor(Color.GREEN);
def s7v = if bar == HighestAll(S7PLBarOrigin) then l else s7v[1];
def crosss7 = if bar < HighestAll(S7PLBarOrigin) then 0 else if bar > HighestAll(S7PLBarOrigin) and c crosses HighestAll(s7v) then crosss7[1] + 1 else crosss7[1];
S7.SetHiding(crosss7 >= sh);
AddChartBubble(HighestAll(crosss7) < sh and bar == HighestAll(S7PLBarOrigin), PLValue, "S7", Color.GREEN, 0);
plot S8 = LinePlot(BarID = S8PLBarID, Value = S8PLValue, BarOrigin = S8PLBarOrigin);
S8.SetDefaultColor(Color.GREEN);
def s8v = if bar == HighestAll(S8PLBarOrigin) then l else s8v[1];
def crosss8 = if bar < HighestAll(S8PLBarOrigin) then 0 else if bar > HighestAll(S8PLBarOrigin) and c crosses HighestAll(s8v) then crosss8[1] + 1 else crosss8[1];
S8.SetHiding(crosss8 >= sh);
AddChartBubble(HighestAll(crosss8) < sh and bar == HighestAll(S8PLBarOrigin), PLValue, "S8", Color.GREEN, 0);
plot S9 = LinePlot(BarID = S9PLBarID, Value = S9PLValue, BarOrigin = S9PLBarOrigin);
def s9v = if bar == HighestAll(S9PLBarOrigin) then l else s9v[1];
def crosss9 = if bar < HighestAll(S9PLBarOrigin) then 0 else if bar > HighestAll(S9PLBarOrigin) and c crosses HighestAll(s9v) then crosss9[1] + 1 else crosss9[1];
S9.SetHiding(crosss9 >= sh);
AddChartBubble(HighestAll(crosss9) < sh and bar == HighestAll(S9PLBarOrigin), PLValue, "S9", Color.GREEN, 0);
S9.SetDefaultColor(Color.GREEN);
plot S10 = LinePlot(BarID = S10PLBarID, Value = S10PLValue, BarOrigin = S10PLBarOrigin);
S10.SetDefaultColor(Color.GREEN);
def s10v = if bar == HighestAll(S10PLBarOrigin) then l else s10v[1];
def crosss10 = if bar < HighestAll(S10PLBarOrigin) then 0 else if bar > HighestAll(S10PLBarOrigin) and c crosses HighestAll(s10v) then crosss10[1] + 1 else crosss10[1];
S10.SetHiding(crosss10 >= sh);
AddChartBubble(HighestAll(crosss10) < sh and bar == HighestAll(S10PLBarOrigin), PLValue, "S10", Color.GREEN, 0);

# End Code Fractal Array 11 Deep
# Trend Line

def PH_low = if bar == ParentHBarOrigin then l else PH_low[1];
def firstParentBar = Min(HighestAll(ParentLBarOrigin), HighestAll(ParentHBarOrigin));
def lastParentBar = Max(HighestAll(ParentLBarOrigin), HighestAll(ParentHBarOrigin));
def firstParent = if bar == firstParentBar and l == PH_low then PH_low else if bar == firstParentBar and l == ParentLow then ParentLow else firstParent[1];
def lastParent = if bar == lastParentBar and l == PH_low then PH_low else if bar == lastParentBar and l == ParentLow then ParentLow else lastParent[1];
def slope = (lastParent - firstParent) / (lastParentBar - firstParentBar);

plot SupportLine = if bar == ParentHBarOrigin then ParentHigh else if bar == ParentLBarOrigin then ParentLow else Double.NaN;
SupportLine.EnableApproximation();
SupportLine.SetDefaultColor(Color.GRAY);
SupportLine.SetLineWeight(2);
SupportLine.SetStyle(Curve.LONG_DASH);

plot ExtLine = if bar >= lastParentBar then (bar - lastParentBar) * slope + lastParent else Double.NaN;
ExtLine.EnableApproximation();
ExtLine.SetDefaultColor(Color.GRAY);
ExtLine.SetLineWeight(2);
ExtLine.SetStyle(Curve.LONG_DASH);
ExtLine.Hide();

AddChartBubble(WaveLabel and bar == HighestAll(bar), HighestAll(high),
"Basic Elliott Wave Rules:" + "\n" +
"Wave (2) cannot retrace past the start of Wave (1)" + "\n" +
"Wave (3) cannot be the shortest wave in a 5 wave sequence." + "\n" +
"Wave (4) cannot retrace into Wave (1)" + "\n", Color.WHITE, 1);

plot waves = if !IsNaN(PivotH) then PivotH else if !IsNaN(PivotL) then PivotL else Double.NaN;
waves.SetStyle(Curve.FIRM);
waves.EnableApproximation();
waves.SetDefaultColor(Color.CYAN);
waves.SetLineWeight(2);
waves.SetHiding(!ShowWaves);

# Wave Pattern

def ParentMaxBar = Max(ParentHBarOrigin, ParentLBarOrigin);
def ParentMinBar = Min(ParentLBarOrigin, ParentLBarOrigin);
def deltaPos = if ParentHBarOrigin == ParentMaxBar then 1 else 0;

# Clouds

AddCloud(if ShowSupportResistanceCloud then R1 else Double.NaN, S1, Color.DARK_GRAY, Color.DARK_GRAY);


ERdHUGY.jpg
You're using the manual TRUE/FALSE selection (ShowSupportResistanceCloud ) to manage the appearance of your clouds. You need to also wrap that if statement within the same type of plot if statement that the lines you are referencing uses.

Without having to time to read through the code to find the resistance portion and not being in front of TS, if the plot is returning true or false you should be able to copy it to something like:

Code:
AddCloud(
if bar == ParentHBarOrigin and ShowSupportResistanceCloud then R1 else Double.NaN, S1, Color.DARK_GRAY, Color.DARK_GRAY);
)

if the line of code to copy is returning a value then you can use something like:

Code:
AddCloud(
if defined_plot_name > 0 and ShowSupportResistanceCloud then
R1 else Double.NaN, S1, Color.DARK_GRAY, Color.DARK_GRAY);
)

The language may not be exactly correct and Double.NaN made need a value depending on the intial return because i'm not in front of TS right now but if you know how to copy and manipulate that may help as the idea if you're trying to tag along with a plot already existing. I'm sure someone else may jump in and be more specific.
 
You're using the manual TRUE/FALSE selection (ShowSupportResistanceCloud ) to manage the appearance of your clouds. You need to also wrap that if statement within the same type of plot if statement that the lines you are referencing uses.

Without having to time to read through the code to find the resistance portion and not being in front of TS, if the plot is returning true or false you should be able to copy it to something like:

Code:
AddCloud(
if bar == ParentHBarOrigin and ShowSupportResistanceCloud then R1 else Double.NaN, S1, Color.DARK_GRAY, Color.DARK_GRAY);
)

if the line of code to copy is returning a value then you can use something like:

Code:
AddCloud(
if defined_plot_name > 0 and ShowSupportResistanceCloud then
R1 else Double.NaN, S1, Color.DARK_GRAY, Color.DARK_GRAY);
)

The language may not be exactly correct and Double.NaN made need a value depending on the intial return because i'm not in front of TS right now but if you know how to copy and manipulate that may help as the idea if you're trying to tag along with a plot already existing. I'm sure someone else may jump in and be more specific.
That is for cloud between R1 y S1 , doesn't work for because I want the clouds in each R hide when the lines do it , thanks
 
I'm able to adjust the Wolfe Wave code and I'm going to change out R1, R2, R3, S1, S2, S3 with 1-5 numbers. My question is more is verifying the numbers associated with R's and S's.

@J007RMC states:

S3 Finishes out wave 5 to bottom
R3 top of wave 1
S2 bottom of wave 2
2 up to 3 top of wave 3
Down to wave 4
Wave 4 begins the sweet spot up to finish wave 5

Is S3=1, S2=3, S1=5, R3=2, R2=4, and R1=6?
Why are there 6 and not 5?

I labeled the R and S's as numbers in attached image.
 

Attachments

  • Screen Shot 2023-09-08 at 11.27.03 AM.png
    Screen Shot 2023-09-08 at 11.27.03 AM.png
    85.8 KB · Views: 243
I find the wolf wave very interesting so for the wave counts and you have it here. I use wolf waves every day with amazing results same as pivots really

S3. Finishes out wave 5 to bottom

R3 top of wave 1

S2 bottom of wave 2

2 up to 3 top of wave 3

Down to wave 4

Wave 4 begins the sweet spot up to finish wave 5

Then wait for another wave to develop using the 5- 15 min you even throw a 2min chart up for fast markets

So my suggestion is to label the waves as 1-5

I just so not see many differences waves are waves really and waves subset in between larger waves although what I use gives me fib extensions/fractals that project up and down price points. Maybe a future project. Not sure how you can do the price extension other than on the connecting wave points but If you like I can offer more information pertaining to bullish/bearish numbered patterns 1-5 and direction synopsis? all points connect so we are talking about extensions based on fib probabilities...fractals. I am not a coder sorry

View attachment 8183
Not sure if you are still using these but i recently brought them back and they are sure killing it when i find setups! If you are whats the best length you have found for the 2min and 5min chart? i find myself always adjusting it from 9 to 21
 
@BenTen A wonderful indicator its's been helping me just a fast question for a short a timeframe. what value is best for the N.

"Generally" you would not change the n value. It isn't a length or a lookback such as you find in moving averages or oscillators; where you adjust smaller if on shorter timeframes.

It is the iteration that the fold function uses for highest high and lowest low.


However, you should always test these theories out. Change the n value across various trading instruments and market conditions. And come back and tell of your findings..
 
Last edited:
@Galbs - can you publish the code for your image of the S & R?
Did you know that by clicking on a member's name, you can easily check when they were last seen on the uTS forum? It's a great way to keep track of who's been around recently, and who hasn't. Speaking of which, it looks like @Galbs hasn't been around lately. :(
 
Good evening guys and gals,

I have taken an interest in wolf waves. I have been observing Mobius/BenTen's script for them. I am not a coder but have managed to figure out how to change the labels so they work a little better for me. I have a question I am stuck on though. When looking at the screen shot, why does the "W1" label appear "out of sequence?" Why wouldn't it appear to the left of the "W2" label (as indicated by my drawn in marking)? I am betting I most likely messed something up in the code when doing the label changes. When one of you overlords of thinkscript feel bored can you help a plebian like me out? Is there a way to fix what I messed up? If I didn't mess it up, can it be fixed so the labels appear (or can be forced to always appear) in their respective sequence? Thanks in advance for any answers or help you can provide.

SPY_WOLF_WAVE_QUES1.png


Here is the code (with my pleb changes):


# Wolf Waves

# Mobius

# V01.05.22.2018

#LABEL MOD

# User Inputs

input n = 10;



# Internal Script Reference

script LinePlot {

input BarID = 0;

input Value = 0;

input BarOrigin = 0;

def ThisBar = HighestAll(BarOrigin);

def ValueLine = if BarOrigin == ThisBar

then Value

else Double.NaN;

plot P = if ThisBar - BarID <= BarOrigin

then HighestAll(ValueLine)

else Double.NaN;

}



# Variables

def o = open;

def h = high;

def l = low;

def c = close;

def x = BarNumber();

def xN = x == HighestAll(x);



# R1

def hh = fold i = 1 to n + 1

with p = 1

while p

do h > GetValue(h, -i);

def PivotH = if (x > n and

h == Highest(h, n) and

hh)

then h

else Double.NaN;

def PHValue = if !IsNaN(PivotH)

then PivotH

else PHValue[1];

def PHBarOrigin = if !IsNaN(PivotH)

then x

else PHBarOrigin[1];

def PHBarID = x - PHBarOrigin;

# R2

def R2PHValue = if PHBarOrigin != PHBarOrigin[1]

then PHValue[1]

else R2PHValue[1];

def R2PHBarOrigin = if PHBarOrigin != PHBarOrigin[1]

then PHBarOrigin[1]

else R2PHBarOrigin[1];

def R2PHBarID = x - R2PHBarOrigin;

# R3

def R3PHValue = if R2PHBarOrigin != R2PHBarOrigin[1]

then R2PHValue[1]

else R3PHValue[1];

def R3PHBarOrigin = if R2PHBarOrigin != R2PHBarOrigin[1]

then R2PHBarOrigin[1]

else R3PHBarOrigin[1];

def R3PHBarID = x - R3PHBarOrigin;



# S1

def ll = fold j = 1 to n + 1

with q = 1

while q

do l < GetValue(l, -j);

def PivotL = if (x > n and

l == Lowest(l, n) and

ll)

then l

else Double.NaN;

def PLValue = if !IsNaN(PivotL)

then PivotL

else PLValue[1];

def PLBarOrigin = if !IsNaN(PivotL)

then x

else PLBarOrigin[1];

def PLBarID = x - PLBarOrigin;

# S2

def S2PLValue = if PLBarOrigin != PLBarOrigin[1]

then PLValue[1]

else S2PLValue[1];

def S2PLBarOrigin = if PLBarOrigin != PLBarOrigin[1]

then PLBarOrigin[1]

else S2PLBarOrigin[1];

def S2PLBarID = x - S2PLBarOrigin;

# S3

def S3PLValue = if S2PLBarOrigin != S2PLBarOrigin[1]

then S2PLValue[1]

else S3PLValue[1];

def S3PLBarOrigin = if S2PLBarOrigin != S2PLBarOrigin[1]

then S2PLBarOrigin[1]

else S3PLBarOrigin[1];

def S3PLBarID = x - S3PLBarOrigin;

# S4

def S4PLValue = if S3PLBarOrigin != S3PLBarOrigin[1]

then S3PLValue[1]

else S4PLValue[1];

def S4PLBarOrigin = if S3PLBarOrigin != S3PLBarOrigin[1]

then S3PLBarOrigin[1]

else S4PLBarOrigin[1];

def S4PLBarID = x - S4PLBarOrigin;

# S5

def S5PLValue = if S4PLBarOrigin != S4PLBarOrigin[1]

then S4PLValue[1]

else S5PLValue[1];

def S5PLBarOrigin = if S4PLBarOrigin != S4PLBarOrigin[1]

then S4PLBarOrigin[1]

else S5PLBarOrigin[1];

def S5PLBarID = x - S5PLBarOrigin;



# Plots

plot W6 = LinePlot(BarID = PHBarID,

Value = PHValue,

BarOrigin = PHBarOrigin);

W6.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(PHBarOrigin), PHValue, "W6", Color.GREEN, 1);

plot W4 = LinePlot(BarID = R2PHBarID,

Value = R2PHValue,

BarOrigin = R2PHBarOrigin);

W4.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(R2PHBarOrigin), PHValue, "W4", Color.GREEN, 1);

plot W2 = LinePlot(BarID = R3PHBarID,

Value = R3PHValue,

BarOrigin = R3PHBarOrigin);

W2.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(R3PHBarOrigin), PHValue, "W2", Color.GREEN, 1);



plot W5 = LinePlot(BarID = PLBarID,

Value = PLValue,

BarOrigin = PLBarOrigin);

W5.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(PLBarOrigin), PLValue, "W5", Color.RED, 0);

plot W3 = LinePlot(BarID = S2PLBarID,

Value = S2PLValue,

BarOrigin = S2PLBarOrigin);

W3.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(S2PLBarOrigin), PLValue, "W3", Color.RED, 0);

plot W1 = LinePlot(BarID = S3PLBarID,

Value = S3PLValue,

BarOrigin = S3PLBarOrigin);

W1.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(S3PLBarOrigin), PLValue, "W1", Color.RED, 0);



# Trend Line

plot SupportLine2 = if x == HighestAll(S2PLBarOrigin)

then W3

else if x == HighestAll(PLBarOrigin)

then W5 #Parentlow

else Double.NaN;

SupportLine2.EnableApproximation();

SupportLine2.SetDefaultColor(Color.GRAY);

SupportLine2.SetLineWeight(1);

SupportLine2.SetStyle(Curve.LONG_DASH);

def slope2 = (W3 - W5) /

(HighestAll(S2PLBarOrigin) - PLBarOrigin);

plot ExtLine2 = if x >= S2PLBarOrigin

then (x - HighestAll(S2PLBarOrigin)) * slope2 + W3

else Double.NaN;

ExtLine2.EnableApproximation();

ExtLine2.SetDefaultColor(Color.GRAY);

ExtLine2.SetLineWeight(1);

ExtLine2.SetStyle(Curve.LONG_DASH);



plot SupportLine3 = if x == HighestAll(R3PHBarOrigin)

then W2

else if x == PHBarOrigin

then W6

else Double.NaN;

SupportLine3.EnableApproximation();

SupportLine3.SetDefaultColor(Color.GRAY);

SupportLine3.SetLineWeight(1);

SupportLine3.SetStyle(Curve.LONG_DASH);

def slope3 = (W6 - W2) /

(HighestAll(PHBarOrigin) - R3PHBarOrigin);

plot ExtLine3 = if x >= R3PHBarOrigin

then (x - HighestAll(R3PHBarOrigin)) * slope3 + W2

else Double.NaN;

ExtLine3.EnableApproximation();

ExtLine3.SetDefaultColor(Color.GRAY);

ExtLine3.SetLineWeight(1);

ExtLine3.SetStyle(Curve.LONG_DASH);


Thanks again for any help.

Pooze
 
  • Love
Reactions: IPA
Good evening guys and gals,

I have taken an interest in wolf waves. I have been observing Mobius/BenTen's script for them. I am not a coder but have managed to figure out how to change the labels so they work a little better for me. I have a question I am stuck on though. When looking at the screen shot, why does the "W1" label appear "out of sequence?" Why wouldn't it appear to the left of the "W2" label (as indicated by my drawn in marking)? I am betting I most likely messed something up in the code when doing the label changes. When one of you overlords of thinkscript feel bored can you help a plebian like me out? Is there a way to fix what I messed up? If I didn't mess it up, can it be fixed so the labels appear (or can be forced to always appear) in their respective sequence? Thanks in advance for any answers or help you can provide.

View attachment 20615

Here is the code (with my pleb changes):

You did nice work on your code! Since Mobius' code just plots suppot/resistance levels that do not always zig zag and are dependent on the 'n' value input, they can appear sometimes out of sequence making it hard to do what you attempted..

So this uses Mobius' original code and the following added to it to show the order 1-6 of the bubbles at support/resistance pivot h/l. This keeps the orignal S1-3 and R1-3 bubbles and numbers then 1-6 in the order thay appeared from left to right.

Code:
def na = Double.NaN;
def path  = if
x == HighestAll(PLBarOrigin) or x == HighestAll(S2PLBarOrigin) or x == HighestAll(S3PLBarOrigin) or
x == HighestAll(PHBarOrigin) or x == HighestAll(R2PHBarOrigin) or x == HighestAll(R3PHBarOrigin)
            then 1 else na;
def pcount = if !IsNaN(path) then pcount[1] + 1 else pcount[1];
def cond   = HighestAll(pcount) - pcount + 1;
def cond1  = if
        cond == 6 then 1
else if cond == 5 then 2
else if cond == 4 then 3
else if cond == 3 then 4
else if cond == 2 then 5
else 6;
AddChartBubble(!IsNaN(path), if !isnan(pivoth) then high else low,
#path + "\n" +
cond1,
Color.YELLOW,
if !isnan(pivoth) then yes else no);

Here is the full code with the above additions.

Screenshot 2024-01-23 165705.png
Code:
# Wolf Waves
# Mobius
# V01.05.22.2018

# User Inputs

input n = 10;

# Internal Script Reference

script LinePlot {

    input BarID = 0;

    input Value = 0;

    input BarOrigin = 0;

    def ThisBar = HighestAll(BarOrigin);

    def ValueLine = if BarOrigin == ThisBar

                then Value

                else Double.NaN;

    plot P = if ThisBar - BarID <= BarOrigin

             then HighestAll(ValueLine)

             else Double.NaN;

}

# Variables

def o = open;

def h = high;

def l = low;

def c = close;

def x = BarNumber();

def xN = x == HighestAll(x);

# R1

def hh = fold i = 1 to n + 1

         with p = 1

         while p

         do h > GetValue(h, -i);

def PivotH = if (x > n and

                 h == Highest(h, n) and

                 hh)

             then h

             else Double.NaN;

def PHValue = if !IsNaN(PivotH)

              then PivotH

              else PHValue[1];

def PHBarOrigin = if !IsNaN(PivotH)

                  then x

                  else PHBarOrigin[1];

def PHBarID = x - PHBarOrigin;

# R2

def R2PHValue = if PHBarOrigin != PHBarOrigin[1]

                then PHValue[1]

                else R2PHValue[1];

def R2PHBarOrigin = if PHBarOrigin != PHBarOrigin[1]

                    then PHBarOrigin[1]

                    else R2PHBarOrigin[1];

def R2PHBarID = x - R2PHBarOrigin;

# R3

def R3PHValue = if R2PHBarOrigin != R2PHBarOrigin[1]

                then R2PHValue[1]

                else R3PHValue[1];

def R3PHBarOrigin = if R2PHBarOrigin != R2PHBarOrigin[1]

                    then R2PHBarOrigin[1]

                    else R3PHBarOrigin[1];

def R3PHBarID = x - R3PHBarOrigin;

# S1

def ll = fold j = 1 to n + 1

         with q = 1

         while q

         do l < GetValue(l, -j);

def PivotL = if (x > n and

                 l == Lowest(l, n) and

                 ll)

             then l

             else Double.NaN;

def PLValue = if !IsNaN(PivotL)

              then PivotL

              else PLValue[1];

def PLBarOrigin = if !IsNaN(PivotL)

                  then x

                  else PLBarOrigin[1];

def PLBarID = x - PLBarOrigin;

# S2

def S2PLValue = if PLBarOrigin != PLBarOrigin[1]

                then PLValue[1]

                else S2PLValue[1];

def S2PLBarOrigin = if PLBarOrigin != PLBarOrigin[1]

                    then PLBarOrigin[1]

                    else S2PLBarOrigin[1];

def S2PLBarID = x - S2PLBarOrigin;

# S3

def S3PLValue = if S2PLBarOrigin != S2PLBarOrigin[1]

                then S2PLValue[1]

                else S3PLValue[1];

def S3PLBarOrigin = if S2PLBarOrigin != S2PLBarOrigin[1]

                    then S2PLBarOrigin[1]

                    else S3PLBarOrigin[1];

def S3PLBarID = x - S3PLBarOrigin;

# S4

def S4PLValue = if S3PLBarOrigin != S3PLBarOrigin[1]

                then S3PLValue[1]

                else S4PLValue[1];

def S4PLBarOrigin = if S3PLBarOrigin != S3PLBarOrigin[1]

                    then S3PLBarOrigin[1]

                    else S4PLBarOrigin[1];

def S4PLBarID = x - S4PLBarOrigin;

# S5

def S5PLValue = if S4PLBarOrigin != S4PLBarOrigin[1]

                then S4PLValue[1]

                else S5PLValue[1];

def S5PLBarOrigin = if S4PLBarOrigin != S4PLBarOrigin[1]

                    then S4PLBarOrigin[1]

                    else S5PLBarOrigin[1];

def S5PLBarID = x - S5PLBarOrigin;

# Plots

plot R1 = LinePlot(BarID = PHBarID,

                   Value = PHValue,

                   BarOrigin = PHBarOrigin);

R1.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(PHBarOrigin), PHValue, "R1", Color.GREEN, 1);

plot R2 = LinePlot(BarID = R2PHBarID,

                   Value = R2PHValue,

                   BarOrigin = R2PHBarOrigin);

R2.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(R2PHBarOrigin), PHValue, "R2", Color.GREEN, 1);

plot R3 = LinePlot(BarID = R3PHBarID,

                   Value = R3PHValue,

                   BarOrigin = R3PHBarOrigin);

R3.SetDefaultColor(Color.GREEN);

AddChartBubble(x == HighestAll(R3PHBarOrigin), PHValue, "R3", Color.GREEN, 1);

plot S1 = LinePlot(BarID = PLBarID,

                   Value = PLValue,

                   BarOrigin = PLBarOrigin);

S1.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(PLBarOrigin), PLValue, "S1", Color.RED, 0);

plot S2 = LinePlot(BarID = S2PLBarID,

                   Value = S2PLValue,

                   BarOrigin = S2PLBarOrigin);

S2.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(S2PLBarOrigin), PLValue, "S2", Color.RED, 0);

plot S3 = LinePlot(BarID = S3PLBarID,

                   Value = S3PLValue,

                   BarOrigin = S3PLBarOrigin);

S3.SetDefaultColor(Color.RED);

AddChartBubble(x == HighestAll(S3PLBarOrigin), PLValue, "S3", Color.RED, 0);

# Trend Line

plot SupportLine2 = if x == HighestAll(S2PLBarOrigin)

                    then S2

                    else if x == HighestAll(PLBarOrigin)

                         then S1  #Parentlow

                         else Double.NaN;

SupportLine2.EnableApproximation();

SupportLine2.SetDefaultColor(Color.GRAY);

SupportLine2.SetLineWeight(1);

SupportLine2.SetStyle(Curve.LONG_DASH);

def slope2 = (S2 - S1) /

             (HighestAll(S2PLBarOrigin) - PLBarOrigin);

plot ExtLine2 = if x >= S2PLBarOrigin

                then (x - HighestAll(S2PLBarOrigin)) * slope2 + S2

                else Double.NaN;

ExtLine2.EnableApproximation();

ExtLine2.SetDefaultColor(Color.GRAY);

ExtLine2.SetLineWeight(1);

ExtLine2.SetStyle(Curve.LONG_DASH);

plot SupportLine3 = if x == HighestAll(R3PHBarOrigin)

                    then R3

                    else if x == PHBarOrigin

                         then R1

                         else Double.NaN;

SupportLine3.EnableApproximation();

SupportLine3.SetDefaultColor(Color.GRAY);

SupportLine3.SetLineWeight(1);

SupportLine3.SetStyle(Curve.LONG_DASH);

def slope3 = (R1 - R3) /

             (HighestAll(PHBarOrigin) - R3PHBarOrigin);

plot ExtLine3 = if x >= R3PHBarOrigin

                then (x - HighestAll(R3PHBarOrigin)) * slope3 + R3

                else Double.NaN;

ExtLine3.EnableApproximation();

ExtLine3.SetDefaultColor(Color.GRAY);

ExtLine3.SetLineWeight(1);

ExtLine3.SetStyle(Curve.LONG_DASH);

def na = Double.NaN;
def path  = if
x == HighestAll(PLBarOrigin) or x == HighestAll(S2PLBarOrigin) or x == HighestAll(S3PLBarOrigin) or
x == HighestAll(PHBarOrigin) or x == HighestAll(R2PHBarOrigin) or x == HighestAll(R3PHBarOrigin)
            then 1 else na;
def pcount = if !IsNaN(path) then pcount[1] + 1 else pcount[1];
def cond   = HighestAll(pcount) - pcount + 1;
def cond1  = if
        cond == 6 then 1
else if cond == 5 then 2
else if cond == 4 then 3
else if cond == 3 then 4
else if cond == 2 then 5
else 6;
AddChartBubble(!IsNaN(path), if !isnan(pivoth) then high else low,
#path + "\n" +
cond1,
Color.YELLOW,
if !isnan(pivoth) then yes else no);
 
Hi everyone, I was playing with cloud functions in thinkscript again on the wolf waves indicator and came out with this so I thought I would share it. I really like this indicator so I went ahead and made it more zone based since I normally trade with zones. For this I decided use the point of control method to make the zones a bit more accurate. I'm always playing with different methods so any feedback is always appreciated!

Code:
# Wolf Waves
# Mobius
# V01.05.22.2018

# User Inputs

input n = 100;

# Internal Script Reference

script LinePlot {

    input BarID = 0;

    input Value = 0;

    input BarOrigin = 0;

    def ThisBar = HighestAll(BarOrigin);

    def ValueLine = if BarOrigin == ThisBar

                then Value

                else Double.NaN;

    plot P = if ThisBar - BarID <= BarOrigin

             then HighestAll(ValueLine)

             else Double.NaN;

}

# Variables

def o = open;

def h = high;

def l = low;

def c = close;

def x = BarNumber();

def xN = x == HighestAll(x);

# R1

def hh = fold i = 1 to n + 1

         with p = 1

         while p

         do h > GetValue(h, -i);

def PivotH = if (x > n and

                 h == Highest(h, n) and

                 hh)

             then h

             else Double.NaN;

def PHValue = if !IsNaN(PivotH)

              then PivotH

              else PHValue[1];

def PHBarOrigin = if !IsNaN(PivotH)

                  then x

                  else PHBarOrigin[1];

def PHBarID = x - PHBarOrigin;

# R2

def R2PHValue = if PHBarOrigin != PHBarOrigin[1]

                then PHValue[1]

                else R2PHValue[1];

def R2PHBarOrigin = if PHBarOrigin != PHBarOrigin[1]

                    then PHBarOrigin[1]

                    else R2PHBarOrigin[1];

def R2PHBarID = x - R2PHBarOrigin;

# R3

def R3PHValue = if R2PHBarOrigin != R2PHBarOrigin[1]

                then R2PHValue[1]

                else R3PHValue[1];

def R3PHBarOrigin = if R2PHBarOrigin != R2PHBarOrigin[1]

                    then R2PHBarOrigin[1]

                    else R3PHBarOrigin[1];

def R3PHBarID = x - R3PHBarOrigin;

# S1

def ll = fold j = 1 to n + 1

         with q = 1

         while q

         do l < GetValue(l, -j);

def PivotL = if (x > n and

                 l == Lowest(l, n) and

                 ll)

             then l

             else Double.NaN;

def PLValue = if !IsNaN(PivotL)

              then PivotL

              else PLValue[1];

def PLBarOrigin = if !IsNaN(PivotL)

                  then x

                  else PLBarOrigin[1];

def PLBarID = x - PLBarOrigin;

# S2

def S2PLValue = if PLBarOrigin != PLBarOrigin[1]

                then PLValue[1]

                else S2PLValue[1];

def S2PLBarOrigin = if PLBarOrigin != PLBarOrigin[1]

                    then PLBarOrigin[1]

                    else S2PLBarOrigin[1];

def S2PLBarID = x - S2PLBarOrigin;

# S3

def S3PLValue = if S2PLBarOrigin != S2PLBarOrigin[1]

                then S2PLValue[1]

                else S3PLValue[1];

def S3PLBarOrigin = if S2PLBarOrigin != S2PLBarOrigin[1]

                    then S2PLBarOrigin[1]

                    else S3PLBarOrigin[1];

def S3PLBarID = x - S3PLBarOrigin;

# S4

def S4PLValue = if S3PLBarOrigin != S3PLBarOrigin[1]

                then S3PLValue[1]

                else S4PLValue[1];

def S4PLBarOrigin = if S3PLBarOrigin != S3PLBarOrigin[1]

                    then S3PLBarOrigin[1]

                    else S4PLBarOrigin[1];

def S4PLBarID = x - S4PLBarOrigin;

# S5

def S5PLValue = if S4PLBarOrigin != S4PLBarOrigin[1]

                then S4PLValue[1]

                else S5PLValue[1];

def S5PLBarOrigin = if S4PLBarOrigin != S4PLBarOrigin[1]

                    then S4PLBarOrigin[1]

                    else S5PLBarOrigin[1];

def S5PLBarID = x - S5PLBarOrigin;

# Plots

plot R1 = LinePlot(BarID = PHBarID,

                   Value = PHValue,

                   BarOrigin = PHBarOrigin);

R1.SetDefaultColor(Color.WHITE);

#AddChartBubble(x == HighestAll(PHBarOrigin), PHValue, "R1", Color.GREEN, 1);

plot R2 = LinePlot(BarID = R2PHBarID,

                   Value = R2PHValue,

                   BarOrigin = R2PHBarOrigin);

R2.SetDefaultColor(Color.WHITE);

#AddChartBubble(x == HighestAll(R2PHBarOrigin), PHValue, "R2", Color.GREEN, 1);

plot R3 = LinePlot(BarID = R3PHBarID,

                   Value = R3PHValue,

                   BarOrigin = R3PHBarOrigin);

R3.SetDefaultColor(Color.WHITE);

#AddChartBubble(x == HighestAll(R3PHBarOrigin), PHValue, "R3", Color.GREEN, 1);

plot S1 = LinePlot(BarID = PLBarID,

                   Value = PLValue,

                   BarOrigin = PLBarOrigin);

S1.SetDefaultColor(Color.WHITE);

#AddChartBubble(x == HighestAll(PLBarOrigin), PLValue, "S1", Color.RED, 0);

plot S2 = LinePlot(BarID = S2PLBarID,

                   Value = S2PLValue,

                   BarOrigin = S2PLBarOrigin);

S2.SetDefaultColor(Color.WHITE);

#AddChartBubble(x == HighestAll(S2PLBarOrigin), PLValue, "S2", Color.RED, 0);

plot S3 = LinePlot(BarID = S3PLBarID,

                   Value = S3PLValue,

                   BarOrigin = S3PLBarOrigin);

S3.SetDefaultColor(Color.WHITE);

#AddChartBubble(x == HighestAll(S3PLBarOrigin), PLValue, "S3", Color.RED, 0);

# Trend Line

plot SupportLine2 = if x == HighestAll(S2PLBarOrigin)

                    then S2

                    else if x == HighestAll(PLBarOrigin)

                         then S1  #Parentlow

                         else Double.NaN;

SupportLine2.EnableApproximation();

SupportLine2.SetDefaultColor(Color.GRAY);

SupportLine2.SetLineWeight(1);

SupportLine2.SetStyle(Curve.LONG_DASH);

def slope2 = (S2 - S1) /

             (HighestAll(S2PLBarOrigin) - PLBarOrigin);

plot ExtLine2 = if x >= S2PLBarOrigin

                then (x - HighestAll(S2PLBarOrigin)) * slope2 + S2

                else Double.NaN;

ExtLine2.EnableApproximation();

ExtLine2.SetDefaultColor(Color.GRAY);

ExtLine2.SetLineWeight(1);

ExtLine2.SetStyle(Curve.LONG_DASH);

plot SupportLine3 = if x == HighestAll(R3PHBarOrigin)

                    then R3

                    else if x == PHBarOrigin

                         then R1

                         else Double.NaN;

SupportLine3.EnableApproximation();

SupportLine3.SetDefaultColor(Color.GRAY);

SupportLine3.SetLineWeight(1);

SupportLine3.SetStyle(Curve.LONG_DASH);

def slope3 = (R1 - R3) /

             (HighestAll(PHBarOrigin) - R3PHBarOrigin);

plot ExtLine3 = if x >= R3PHBarOrigin

                then (x - HighestAll(R3PHBarOrigin)) * slope3 + R3

                else Double.NaN;

ExtLine3.EnableApproximation();

ExtLine3.SetDefaultColor(Color.GRAY);

ExtLine3.SetLineWeight(1);

ExtLine3.SetStyle(Curve.LONG_DASH);

#addcloud(R2, R1, color.Cyan,color.Cyan, yes);

#=====================================================================================
#Modifed by Clark2001
#=====================================================================================
#Point of Control Formula
#Found @ https://usethinkscript.com/threads/dynamically-adding-cloud-to-horizontal-priceline.3427/
def ATR = HighestAll(if IsNaN(close[-1])
then if Average(TrueRange(high, close, low), 4) < 2
then Average(TrueRange(high, close, low), 4)
else 2
else Double.NaN);
#===================================================
input ZoneSize = 13;
input EnableZone = yes;
#Increase POC to decrease cloudSize
Def POC = ATR;
Def ShowZone = (EnableZone && POC)/ZoneSize;
input Lineweight = 1;
input LineType = PaintingStrategy.LINE;
DefineGlobalColor("CloudS", Color.GREEN);
DefineGlobalColor("CloudR", Color.RED);
#Global Color For Levels(Support)
DefineGlobalColor("UpLevels", Color.GREEN);
#Global Color For Levels(Resistance)
DefineGlobalColor("DnLevels", Color.RED);
#=====================================================================
#=====================================================================
AddCloud(R1 - ShowZone, R1 + ShowZone, GlobalColor("CloudR"), GlobalColor("CloudR"));
AddCloud(R2 - ShowZone, R2 + ShowZone, GlobalColor("CloudR"), GlobalColor("CloudR"));

#Global Levels (Color)
R1.AssignValueColor(GlobalColor("DnLevels"));
R2.AssignValueColor(GlobalColor("DnLevels"));
#=====================================================================
#=====================================================================
AddCloud(R3 - ShowZone,   R3 + ShowZone,   GlobalColor("CloudR"),   GlobalColor("CloudR"));
AddCloud(S1 - ShowZone, S1 + ShowZone, GlobalColor("CloudS"), GlobalColor("CloudS"));

#Global Levels (Color)
R3.AssignValueColor(GlobalColor("DnLevels"));
S1.AssignValueColor(GlobalColor("UpLevels"));
#=====================================================================
#=====================================================================
AddCloud(S2 - ShowZone, S2 + ShowZone, GlobalColor("CloudS"), GlobalColor("CloudS"));
AddCloud(S3 - ShowZone, S3 + ShowZone, GlobalColor("CloudS"), GlobalColor("CloudS"));

#Global Levels (Color)
S2.AssignValueColor(GlobalColor("UpLevels"));
S3.AssignValueColor(GlobalColor("UpLevels"));
#=====================================================================
#=====================================================================

R1.SetPaintingStrategy(LineType);
R1.SetLineWeight(Lineweight);

R2.SetPaintingStrategy(LineType);
R2.SetLineWeight(Lineweight);

R3.SetPaintingStrategy(LineType);
R3.SetLineWeight(Lineweight);

S1.SetPaintingStrategy(LineType);
S1.SetLineWeight(Lineweight);

S2.SetPaintingStrategy(LineType);
S2.SetLineWeight(Lineweight);

S3.SetPaintingStrategy(LineType);
S3.SetLineWeight(Lineweight);
#=====================================================================
#=====================================================================
#=====================================================================
 

Attachments

  • Screenshot 2024-03-11 142436.png
    Screenshot 2024-03-11 142436.png
    134.9 KB · Views: 63

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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