# swings or waves

L

#### lee-I-O=coke-A

##### New member
BEN or any kind individual;

This is fairly new to me, so I might not know the appropriate terminology, please bear with me.
I am not sure even if I picked the proper category, thank you.

Everyone needs to start somewhere, I might not know what I am doing now, but when I am accomplished, I will surely pass it along.

I am requesting help for code that will provide the 3 desired results that could possibly help me.

First, Code that will define 5 ( swings or waves ).
Second, code to identify that the 5th ( swing or wave ) is complete.
Third, code that will authenticate that the 5th ( swing or wave ) is longer than the 3rd swing.

Is this complicated?

What ever you can do for me will be deeply appreciated.

#### BenTen

Staff
VIP
Is this related to Elliott wave by any chance? See if this can be any help to ya (but I doubt it)

Code:
## Mobius' swing high/low script.
## Added Fib retracements and extensions

# The number of bars to look back.
input n = 20;

# Set minDollarRange > 0 to turn off 0.382 and 0.618 Fibs,
# when dollar value of HighLine - LowLine range is less than
# chosen minDollarRange. Set to zero to ignore setting.
input minDollarRange = 200.0;

# Allow lines to be drawn in expansion area (Yes).
input rightExt = Yes;

def H = high;
def L = low;
def cBar = barNumber();
def PH;
def PL;

def isH = fold i = 1 to n + 1 with p = 1
while p do H > getValue(H, -i);

PH = if (cBar > n and H == Highest(H, n) and isH) then H
else double.NaN;

def isL = fold j = 1 to n + 1 with q = 1
while q do L < getValue(L, -j);

PL = if (cBar > n and L == Lowest(L, n) and isL) then l
else double.NaN;

rec PHL = if !IsNaN(PH) then PH else PHL[1];
rec PLL = if !IsNaN(PL) then PL else PLL[1];

def bOk = !IsNaN(h) or rightExt;

plot HighLine = if bOk and PHL > 0 then PHL else double.NaN;
HighLine.SetDefaultColor(Color.Light_Red);
HighLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HighLine.SetLineWeight(1);

plot LowLine = if bOk and PLL > 0 then PLL else double.NaN;
LowLine.SetDefaultColor(Color.Light_Green);
LowLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LowLine.SetLineWeight(1);

########################################
## Fib Retracements

def Ext0_382 = 0.382;
def Ext0_618 = 0.618;
def Ext0_2 = 0.2;
def Ext0_8 = 0.8;

def rHi = HighLine;
def rLo = LowLine;

def tmidP = (rHi + rLo) / 2;
def range = rHi - rLo;
def F0_382 = rHi - (range * Ext0_382);
def F0_618 = rHi - (range * Ext0_618);
def F0_2 = rHi - (range * Ext0_2);
def F0_8 = rHi - (range * Ext0_8);

def rangeValue = (AbsValue(range) / tickSize()) * tickValue();

def rangeValueOK = minDollarRange <= rangeValue;

plot FibMid = tmidP;
plot Fib0_382 = if !rangeValueOK then Double.NaN else F0_382;
plot Fib0_618 = if !rangeValueOK then Double.NaN else F0_618;
plot Fib0_2 = F0_2;
plot Fib0_8 = F0_8;

FibMid.HideTitle();
FibMid.SetDefaultColor(Color.White);
FibMid.SetPaintingStrategy(PaintingStrategy.DASHES);
FibMid.SetLineWeight(1);

Fib0_382.HideTitle();
Fib0_382.SetDefaultColor(Color.Gray);
Fib0_382.SetPaintingStrategy(PaintingStrategy.DASHES);

Fib0_618.HideTitle();
Fib0_618.SetDefaultColor(Color.Gray);
Fib0_618.SetPaintingStrategy(PaintingStrategy.DASHES);

Fib0_2.HideTitle();
Fib0_2.SetDefaultColor(Color.Gray);
Fib0_2.SetPaintingStrategy(PaintingStrategy.DASHES);

Fib0_8.HideTitle();
Fib0_8.SetDefaultColor(Color.Gray);
Fib0_8.SetPaintingStrategy(PaintingStrategy.DASHES);

########################################
## Fib Extensions

def FH_382 = range + if !IsNaN(h) then F0_382 else F0_382[1];
;

plot FibH_382 = FH_382;

FibH_382.HideTitle();
FibH_382.SetDefaultColor(Color.Cyan);
FibH_382.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
FibH_382.SetLineWeight(1);

def FL_618 = (if !IsNaN(h) then F0_618 else F0_618[1]) - range;

plot FibL_618 = FL_618;

FibL_618.HideTitle();
FibL_618.SetDefaultColor(Color.Magenta);
FibL_618.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
FibL_618.SetLineWeight(1);

L

#### lee-I-O=coke-A

##### New member
I presume that benten was the person trying to help me, appreciate it. # 1 This is my first posting, I do not know the ins & outs yet. #2 I am a senior citizen. #3 Seriously, I lost my memory, and this is helping me to keep my mind active and is helping in my recovery. # 4 I have not coded ( COBOL ) in 30 years, I really am enjoying the journey right now. # 5 Is a wave and a swing the same thing? # 6 I forgot to add the 4th condition, I am trying to purse. I was really trying to use the 3 conditions in a SCAN, not a chart, I apologize. Again, whatever you can do to help me, I appreciate

Can someone enlighten me, how I can donate for future participation. Also what is VIP status, what is needed to achieve. THANKS Bernie

#### markos

##### Well-known member
VIP
@lee-I-O=coke-A Hi Bernie, and welcome to useThinkScript.com. I am a senior citizen living with brain injury as well.
I do not mean this to be short or snippy:

Please migrate to the tutorial section and look at the Universe of ThinkScript. If one has been created, you'll find it in there.

There is also this post https://usethinkscript.com/threads/wolf-waves-trendline-breakouts-indicator-for-thinkorswim.66/

Google "SyracusePro Thinkscript". I believe that Victor has worked with Elliot, Kondriedtiff and Wolf Waves among others.

Questions: Have you scheduled a platform tour? You are entitled to one. Please contact ThinkorSwim support and ask for one to be scheduled.
Be sure to write down 10 questions to ask that are of interest to you so that your time is well spent.

Why are you starting with such an extremely difficult study to start with? I'd suggest starting smaller.

As far as your last line above, VIP status can be searched for in the Box above.

#### BenTen

Staff
VIP

As far as everything else, @markos pretty much covered them in his response above.

B

#### Buckbull

##### Member
Is there an Indicator somewhere that draws a dot on the swing highs and lows ? I did some searching in here and havent found anything . Thanks

L

#### lee-I-O=coke-A

##### New member
What I was trying to do was

I wanted the highest SWING at the top of the screen

Next have the 2 black candles right after the swing HIGH

And lastly I wanted the 2 black candles to be as close as possible to be Last 2 candles on this chart

def peak = ( close < close[1] and close[1] < close[2] and close[2] > close[3] and close[3] > close[4]) ;

plot scan = peak;

plot scan highestall (high);

input length = 20;

def = islongblack = islongblack(length);

plot twolongblack = islongblack[1] and islongblack;

L

#### lee-I-O=coke-A

##### New member
Can someone kindly review my code, and provide the revised code to make this happen. thank you

L

#### lee-I-O=coke-A

##### New member
def peak = ( close < close[1] and close[1] < close[2] and close[2] < close[3] and close[3] < close[4]) and close[4] > close[5] and close [5] > close[6]
;
plot arrowdown = close[4];
arrowdown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);
Arrowdown.SetDefaultColor(Color.WHITE);
Arrowdown.SetLineWeight(4);

Would someone kindly point me in the right direction, please.

My objective is to place a down arrow over close[4] the highest point in the pivot

L

#### lee-I-O=coke-A

##### New member
would like to utilize this script I retrieved from "fun with thinkscript"
but I don't know what is missing to plot this to the chart.
I was hoping that robert or someone was available to help me make this happen.
I am new and do not understand the switch concept.

input xyz = {"major", default "minor"};

def R3;
def R2;
def R1;
def PP;
def S1;
def S2;
def S3;
switch (xyz) {
case "major":
PP = MajorCalculation;
R1 = MajorCalculation;
R2 = MajorCalculation;
R3 = MajorCalculation;
S1 = MajorCalculation;
S2 = MajorCalculation;
S3 = MajorCalculation;
case "minor":
PP = MinorCalculation;
R1 = MinorCalculation;
R2 = MinorCalculation;
R3 = MinorCalculation;
S1 = MinorCalculation;
S2 = MinorCalculation;
S3 = MinorCalculation;
}

plot PP = if Switch == 1 then MinorCalculation else MajorCalculation;