Repaints Elliot Wave Indicator for ThinkorSwim

Repaints

DPM

Member
Hi guys. Been banging my head against the wall trying to find an indicator that applies Elliot Waves on a 5,10,15 min time frame. Do we currently have any existing Elliot Wave script for ThinkorSwim? Maybe it doesn't exist. But if it does, let me know. Thanks

The only thing I could find under ThinkorSwim studies is ElliotOscillator. According to TOS, it's "used to identify waves for implementation of Elliott Wave Theory."

Code:
declare lower;

input shortLength = 5;
input longLength = 35;

def price = (high + low) / 2;
plot ElliotOsc = Average(price, shortLength) - Average(price, longLength);
plot ZeroLine = 0;

ElliotOsc.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
ElliotOsc.SetLineWeight(3);
ElliotOsc.DefineColor("Positive", Color.UPTICK);
ElliotOsc.DefineColor("Negative", Color.DOWNTICK);
ElliotOsc.AssignValueColor(if ElliotOsc > 0 then ElliotOsc.color("Positive") else ElliotOsc.color("Negative"));
ZeroLine.setDefaultColor(getColor(8));
 

Volatility Trading Range

VTR is a momentum indicator that shows if a stock is overbought or oversold based on its Weekly and Monthly average volatility trading range.

Download the indicator

@DPM To the best of my knowledge don't think there exists a true TOS study that counts Elliott Waves. Even the folks at Elliott Wave International have two different interpretations of counts whenever they publish a forecast - a preferred count and and alternate count. I have been a subscriber to EWI publications for several years now
 
@tomsk thanks for the reply. It might be doable. I've been toying around with TOS's ZIG ZAG High Low indicator and plugging fib #'s into the percentage reversal tab. Not sure if I'm onto something or not. If anyone has any ideas, please let me know. Thanks

YzZgKe8.png
 

Attachments

  • YzZgKe8.png
    YzZgKe8.png
    226.4 KB · Views: 188
@DPM You are absolutely right - the closest thing that comes to waves is indeed the ZigZag High Low indicator available as a standard TOS study. however it is not Elliott Waves though. You may also like to look at a study I posted called Zag Zag High Low Stats and turn on some of the bubbles via the user interface input selector

https://usethinkscript.com/threads/zigzag-high-low-stats.1073/
 
Last edited:
Hey guys, do you know if there is a ElliotWave plot indicator for Daily timeframe? Thanks

Code:
#StudyName:     BLT_HarndogLazyFractalPivotsV2
#Version/Date:    v2 01-13-2016                  TOS.mx Link: http://tos.mx/P0dS0H   
#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 n = 10;
input WaveLabel = no;
input ShowWaves = no;
input ShowSupportResistanceCloud = yes;
input select_aggperiod = {default "Current", "Higher"};
input higheragg = aggregationPeriod.THREE_MIN;
input sethiding_crosses_required = 1;
def   sh = sethiding_crosses_required;
 
 
# 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) ;
}
addLabel(1, "Aggregation for Pivots at "+if select_aggperiod==select_aggperiod."current" then "current" else +higheragg/60000+"min"+" chart", color.white);
def bar = BarNumber();
def BBar = bar == HighestAll(bar);
# 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;
# 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.GREEN);
addChartBubble(Bar == HighestAll(ParentHBarOrigin), ParentHigh, "B", color.yellow, 1);
plot R1 = LinePlot(BarID = PHBarID, 
                   Value = PHValue, 
                   BarOrigin = PHBarOrigin);
R1.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R2 = LinePlot(BarID = R2PHBarID, 
                   Value = R2PHValue, 
                   BarOrigin = R2PHBarOrigin);
R2.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R3 = LinePlot(BarID = R3PHBarID, 
                   Value = R3PHValue, 
                   BarOrigin = R3PHBarOrigin);
R3.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R4 = LinePlot(BarID = R4PHBarID, 
                   Value = R4PHValue, 
                   BarOrigin = R4PHBarOrigin);
R4.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R5 = LinePlot(BarID = R5PHBarID, 
                   Value = R5PHValue, 
                   BarOrigin = R5PHBarOrigin);
R5.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R6 = LinePlot(BarID = R6PHBarID, 
                   Value = R6PHValue, 
                   BarOrigin = R6PHBarOrigin);
R6.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R7 = LinePlot(BarID = R7PHBarID, 
                   Value = R7PHValue, 
                   BarOrigin = R7PHBarOrigin);
R7.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R8 = LinePlot(BarID = R8PHBarID, 
                   Value = R8PHValue, 
                   BarOrigin = R8PHBarOrigin);
R8.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R9 = LinePlot(BarID = R9PHBarID, 
                   Value = R9PHValue, 
                   BarOrigin = R9PHBarOrigin);
R9.SetDefaultColor(Color.GREEN);
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.green, 1);
plot R10 = LinePlot(BarID = R10PHBarID, 
                   Value = R10PHValue, 
                   BarOrigin = R10PHBarOrigin);
R10.SetDefaultColor(Color.GREEN);
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.green, 1);
 
 
plot PS1 = LinePlot(BarID = ParentLBarID, 
                   Value = ParentLow, 
                   BarOrigin = HighestAll(ParentLBarOrigin));
PS1.SetDefaultColor(Color.RED);
AddChartBubble(Bar == HighestAll(ParentLBarOrigin), ParentLow, "A", Color.Yellow, 0);
plot S1 = LinePlot(BarID = PLBarID, 
                   Value = PLValue, 
                   BarOrigin = PLBarOrigin);
S1.SetDefaultColor(Color.RED);
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.red, 0);
plot S2 = LinePlot(BarID = S2PLBarID, 
                   Value = S2PLValue, 
                   BarOrigin = S2PLBarOrigin);
S2.SetDefaultColor(Color.RED);
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.red, 0);
plot S3 = LinePlot(BarID = S3PLBarID, 
                   Value = S3PLValue, 
                   BarOrigin = S3PLBarOrigin);
S3.SetDefaultColor(Color.RED);
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.red, 0);
plot S4 = LinePlot(BarID = S4PLBarID, 
                   Value = S4PLValue, 
                   BarOrigin = S4PLBarOrigin);
S4.SetDefaultColor(Color.RED);
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.red, 0);
plot S5 = LinePlot(BarID = S5PLBarID, 
                   Value = S5PLValue, 
                   BarOrigin = S5PLBarOrigin);
S5.SetDefaultColor(Color.RED);
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.red, 0);
plot S6 = LinePlot(BarID = S6PLBarID, 
                   Value = S6PLValue, 
                   BarOrigin = S6PLBarOrigin);
S6.SetDefaultColor(Color.RED);
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.red, 0);
plot S7 = LinePlot(BarID = S7PLBarID, 
                   Value = S7PLValue, 
                   BarOrigin = S7PLBarOrigin);
S7.SetDefaultColor(Color.RED);
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.red, 0);
plot S8 = LinePlot(BarID = S8PLBarID, 
                   Value = S8PLValue, 
                   BarOrigin = S8PLBarOrigin);
S8.SetDefaultColor(Color.RED);
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.red, 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.red, 0);
S9.SetDefaultColor(Color.RED);
plot S10 = LinePlot(BarID = S10PLBarID, 
                   Value = S10PLValue, 
                   BarOrigin = S10PLBarOrigin);
S10.SetDefaultColor(Color.RED);
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.red, 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);
 
Read post#2.

As a heads up for those interested Elliott Wave International will be having an open house this coming week, their forecasts for indices, metals, forex, commodities, bonds will be available to check out. All absolutely free just for this coming week.
 
Thank you Tomsk. Do you if they will be providing an ToS ElliotWave plot strategies?

btw, i saw above you mentioned that you dont think it exits. I thought you meant that for shorter timeframes. Did you mean it doesnt exist for Daily too? Thanks agian
 
Nope - they just provide a forecast of the underlying wave structure - which almost requires the reader to be already familiar with the two modalities of motive waves and corrective waves. Their forecast covers daily, weekly, monthly, and even down to intraday 15 minutes. I've been a subscriber for years. All the best
 
I have it but EW has many possibilities and using indicators does not do justice. That indicators is on the dust collection for years
 
@NahuelPatricioRodriguez Here's the code you requested.

Code:
# Elliot Wave Oscillator with bands
#Horserider 5/17/2020

declare lower;

input price = hl2;
input HistoType = {default STD, ROC};
input SmoothLength = 5;

def valueDiff;
def value;
def showBands;
switch (HistoType) {
case STD:
value = double.nan;
valueDiff = (Average(price, 5) - Average(price, 35));
showBands = 1;
case ROC:
# ROC is smoothed with a SMA
value = (Average(price, 10) - Average(price, 70));
valueDiff = Average(value - value[1], SmoothLength);
showBands = 0;
}

# --- start Breakout Bands logic ---
#
# AdvanceGetOscillator Breakout Bands logic ported
# from [codebase.mql4.com]
# and [fxcodebase.com]...

def coeff_num = 2;
def coeff_denom = 39;

def barNum = if IsNaN( close ) then Double.NaN else barNumber();
def coeff = coeff_num / ( coeff_denom + 1 );
def diff = ValueDiff;

rec _upLine = if barNum == 1 then
if diff >= 0 then
diff * coeff + diff * ( 1 - Coeff )
else
0
else
if diff >= 0 then
diff * coeff + _upLine[1] * ( 1 - Coeff )
else
_upLine[1];
rec _dnLine = if barNum == 1 then
if diff < 0 then
diff * coeff + diff * ( 1 - Coeff )
else
0
else
if diff < 0 then
diff * coeff + _dnLine[1] * ( 1 - Coeff )
else
_dnLine[1];

plot UpLine = if showBands then _upLine else double.nan;
plot DownLine = if showBands then _dnLine else double.nan;

UpLine.SetDefaultColor(GetColor(9));
UpLine.SetLineWeight(2);
DownLine.SetDefaultColor(GetColor(9));
DownLine.SetLineWeight(2);

# --- end Breakout Band logic ---
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(GetColor(7));
plot Osc = valueDiff;
plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;


Osc.SetDefaultColor(GetColor(5));
Osc.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Osc.SetLineWeight(3);
Osc.DefineColor("Positive and Up", Color.GREEN);
Osc.DefineColor("Positive and Down", Color.DARK_GREEN);
Osc.DefineColor("Negative and Down", Color.RED);
Osc.DefineColor("Negative and Up", Color.DARK_RED);
Osc.AssignValueColor(if Osc >= 0 then if Osc > Osc[1] then Osc.color("Positive and Up") else Osc.color("Positive and Down") else if Osc < Osc[1] then Osc.color("Negative and Down") else Osc.color("Negative and Up"));
 
Hello, I would like to quickly draw diverse Elliott wave points on chart i.e. just manually the A,B,C,1,2,3 points when analyzing the chart. Is there a draw function in TOS? I can't find any. Thanks
 
@arod49
Code:
declare lower;

input shortLength = 5;
input longLength = 35;
input displace = 0;

def price = (high + low) / 2;
plot ElliotOsc = Average(price[-displace], shortLength) - Average(price[-displace], longLength);
plot ZeroLine = 0;

ElliotOsc.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
ElliotOsc.SetLineWeight(3);
ElliotOsc.DefineColor("Positive", Color.UPTICK);
ElliotOsc.DefineColor("Negative", Color.DOWNTICK);
ElliotOsc.AssignValueColor(if ElliotOsc > 0 then ElliotOsc.color("Positive") else ElliotOsc.color("Negative"));
ZeroLine.setDefaultColor(getColor(8));
 
I'm looking for the maximum and the minimum of each oscillator valley.
with a minimum of four bars, draw a line minus -38% of the maximum when it is bullish and when ewo is less than 0 it is bearish it would be +38% of the minimum point.. to find the maximum you must have ewo greater than 0, have a minimum of 4 bars and be greater than the line +38% of the minimum point

oDVgZ7b.jpg
vnVfB3T.jpg
qE2uWzB.jpg

someone help me I'm looking for the maximum and the minimum of each oscillator valley.
with a minimum of four bars, draw a line minus -38% of the maximum when it is bullish and when ewo is less than 0 it is bearish it would be +38% of the minimum point.. to find the maximum you must have ewo greater than 0, have a minimum of 4 bars and be greater than the line +38% of the minimum point
 

Attachments

  • oDVgZ7b.jpg
    oDVgZ7b.jpg
    72.5 KB · Views: 1,637
  • vnVfB3T.jpg
    vnVfB3T.jpg
    86.9 KB · Views: 1,575
Last edited by a moderator:
How would you script for, say, the 5th positive bar.... on Elliot Oscillator .... or 3rd negative bar etc....
 
How would you script for, say, the 5th positive bar.... on Elliot Oscillator .... or 3rd negative bar etc....


when creating scans, it can be difficult because they are hard to debug.

if i am going to make a scan, i make a lower chart study first, then when it works, i change it to be a scan.
with a lower study, you can add bubbles and lines, to have visual outputs, to verify things are working as expected.


---------------------------------


scan code
you will have to manually change the values of the 2 inputs in the code, to change what the scan looks for.

when making a scan study, make sure there is only 1 plot formula, and it plots a true or false value.


Code:
input positive_bars = yes;
input bars_after_crossing_zero = 5;

def barz = (bars_after_crossing_zero - 1);
def eo = ElliotOscillator().ElliotOsc;
def x = (eo[barz] crosses 0);

plot z = (positive_bars and eo > 0 or !positive_bars and eo < 0) and x;
#


------------------------


this is the lower study i made to test out my formulas

Code:
declare lower;

input positive_bars = yes;
input bars_after_crossing_zero = 5;

def barz = (bars_after_crossing_zero - 1);
def eo = ElliotOscillator().ElliotOsc;
def x = (eo[barz] crosses 0);

plot z = (positive_bars and eo > 0 or !positive_bars and eo < 0) and x;

addlabel(z,
( bars_after_crossing_zero + 
(if positive_bars then " Positive " else " Negative ") +
" bars after a crossing")
, color.yellow);
#

look for the 4th negative bar after a crossing
positive_bars = no
bars_after_crossing_zero = 4
6nKFrVu.jpg



---------------

https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/E-F/ElliotOscillator


if you want to know how many bars have elapsed after a crossing, here is a counting study
https://usethinkscript.com/threads/...-since-below-n-day-average.13515/#post-113265
 

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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