Repaints Elliot Wave Indicator for ThinkorSwim



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."

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.DefineColor("Positive", Color.UPTICK);
ElliotOsc.DefineColor("Negative", Color.DOWNTICK);
ElliotOsc.AssignValueColor(if ElliotOsc > 0 then ElliotOsc.color("Positive") else ElliotOsc.color("Negative"));
@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
    226.4 KB · Views: 203
@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
Last edited:
Hey guys, do you know if there is a ElliotWave plot indicator for Daily timeframe? Thanks

#StudyName:     BLT_HarndogLazyFractalPivotsV2
#Version/Date:    v2 01-13-2016         Link:   
#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:               Link:
# Notes:        The idea is based on Mobius Fractal Pivot Array
# 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 
            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
             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));
addChartBubble(Bar == HighestAll(ParentHBarOrigin), ParentHigh, "B", color.yellow, 1);
plot R1 = LinePlot(BarID = PHBarID, 
                   Value = PHValue, 
                   BarOrigin = PHBarOrigin);
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];
addChartBubble(highestall(crossr1)<sh and Bar == HighestAll(PHBarOrigin), PHvalue, "R1",, 1);
plot R2 = LinePlot(BarID = R2PHBarID, 
                   Value = R2PHValue, 
                   BarOrigin = R2PHBarOrigin);
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];
addChartBubble(highestall(crossr2)<sh and Bar == HighestAll(R2PHBarOrigin), PHvalue, "R2",, 1);
plot R3 = LinePlot(BarID = R3PHBarID, 
                   Value = R3PHValue, 
                   BarOrigin = R3PHBarOrigin);
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];
addChartBubble(highestall(crossr3)<sh and Bar == HighestAll(R3PHBarOrigin), PHvalue, "R3",, 1);
plot R4 = LinePlot(BarID = R4PHBarID, 
                   Value = R4PHValue, 
                   BarOrigin = R4PHBarOrigin);
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];
addChartBubble(highestall(crossr4)<sh and Bar == HighestAll(R4PHBarOrigin), PHvalue, "R4",, 1);
plot R5 = LinePlot(BarID = R5PHBarID, 
                   Value = R5PHValue, 
                   BarOrigin = R5PHBarOrigin);
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];
addChartBubble(highestall(crossr5)<sh and Bar == HighestAll(R5PHBarOrigin), PHvalue, "R5",, 1);
plot R6 = LinePlot(BarID = R6PHBarID, 
                   Value = R6PHValue, 
                   BarOrigin = R6PHBarOrigin);
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];
addChartBubble(highestall(crossr6)<sh and Bar == HighestAll(R6PHBarOrigin), PHvalue, "R6",, 1);
plot R7 = LinePlot(BarID = R7PHBarID, 
                   Value = R7PHValue, 
                   BarOrigin = R7PHBarOrigin);
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];
addChartBubble(highestall(crossr7)<sh and Bar == HighestAll(R7PHBarOrigin), PHvalue, "R7",, 1);
plot R8 = LinePlot(BarID = R8PHBarID, 
                   Value = R8PHValue, 
                   BarOrigin = R8PHBarOrigin);
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];
addChartBubble(highestall(crossr8)<sh and Bar == HighestAll(R8PHBarOrigin), PHvalue, "R8",, 1);
plot R9 = LinePlot(BarID = R9PHBarID, 
                   Value = R9PHValue, 
                   BarOrigin = R9PHBarOrigin);
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];
addChartBubble(highestall(crossr9)<sh and Bar == HighestAll(R9PHBarOrigin), PHvalue, "R9",, 1);
plot R10 = LinePlot(BarID = R10PHBarID, 
                   Value = R10PHValue, 
                   BarOrigin = R10PHBarOrigin);
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];
addChartBubble(highestall(crossr10)<sh and Bar == HighestAll(R10PHBarOrigin), PHvalue, "R10",, 1);
plot PS1 = LinePlot(BarID = ParentLBarID, 
                   Value = ParentLow, 
                   BarOrigin = HighestAll(ParentLBarOrigin));
AddChartBubble(Bar == HighestAll(ParentLBarOrigin), ParentLow, "A", Color.Yellow, 0);
plot S1 = LinePlot(BarID = PLBarID, 
                   Value = PLValue, 
                   BarOrigin = PLBarOrigin);
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];
addChartBubble(highestall(crosss1)<sh and Bar == HighestAll(PLBarOrigin), PLvalue, "S1",, 0);
plot S2 = LinePlot(BarID = S2PLBarID, 
                   Value = S2PLValue, 
                   BarOrigin = S2PLBarOrigin);
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];
addChartBubble(highestall(crosss2)<sh and Bar == HighestAll(S2PLBarOrigin), PLvalue, "S2",, 0);
plot S3 = LinePlot(BarID = S3PLBarID, 
                   Value = S3PLValue, 
                   BarOrigin = S3PLBarOrigin);
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];
addChartBubble(highestall(crosss3)<sh and Bar == HighestAll(S3PLBarOrigin), PLvalue, "S3",, 0);
plot S4 = LinePlot(BarID = S4PLBarID, 
                   Value = S4PLValue, 
                   BarOrigin = S4PLBarOrigin);
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];
addChartBubble(highestall(crosss4)<sh and Bar == HighestAll(S4PLBarOrigin), PLvalue, "S4",, 0);
plot S5 = LinePlot(BarID = S5PLBarID, 
                   Value = S5PLValue, 
                   BarOrigin = S5PLBarOrigin);
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];
addChartBubble(highestall(crosss5)<sh and Bar == HighestAll(S5PLBarOrigin), PLvalue, "S5",, 0);
plot S6 = LinePlot(BarID = S6PLBarID, 
                   Value = S6PLValue, 
                   BarOrigin = S6PLBarOrigin);
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];
addChartBubble(highestall(crosss6)<sh and Bar == HighestAll(S6PLBarOrigin), PLvalue, "S6",, 0);
plot S7 = LinePlot(BarID = S7PLBarID, 
                   Value = S7PLValue, 
                   BarOrigin = S7PLBarOrigin);
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];
addChartBubble(highestall(crosss7)<sh and Bar == HighestAll(S7PLBarOrigin), PLvalue, "S7",, 0);
plot S8 = LinePlot(BarID = S8PLBarID, 
                   Value = S8PLValue, 
                   BarOrigin = S8PLBarOrigin);
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];
addChartBubble(highestall(crosss8)<sh and Bar == HighestAll(S8PLBarOrigin), PLvalue, "S8",, 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];
addChartBubble(highestall(crosss9)<sh and Bar == HighestAll(S9PLBarOrigin), PLvalue, "S9",, 0);
plot S10 = LinePlot(BarID = S10PLBarID, 
                   Value = S10PLValue, 
                   BarOrigin = S10PLBarOrigin);
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];
addChartBubble(highestall(crosss10)<sh and Bar == HighestAll(S10PLBarOrigin), PLvalue, "S10",, 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),
def lastParentBar = Max(HighestAll(ParentLBarOrigin),
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;
plot ExtLine = if bar >= lastParentBar
               then (bar - lastParentBar) * Slope + lastParent
               else double.nan;
AddChartBubble(WaveLabel and bar == HighestAll(bar), 
"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;
# 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.

# 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 []
# and []...

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 )
if diff >= 0 then
diff * coeff + _upLine[1] * ( 1 - Coeff )
rec _dnLine = if barNum == 1 then
if diff < 0 then
diff * coeff + diff * ( 1 - Coeff )
if diff < 0 then
diff * coeff + _dnLine[1] * ( 1 - Coeff )

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


# --- end Breakout Band logic ---
plot ZeroLine = 0;
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.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
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.DefineColor("Positive", Color.UPTICK);
ElliotOsc.DefineColor("Negative", Color.DOWNTICK);
ElliotOsc.AssignValueColor(if ElliotOsc > 0 then ElliotOsc.color("Positive") else ElliotOsc.color("Negative"));
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


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


  • oDVgZ7b.jpg
    72.5 KB · Views: 1,732
  • vnVfB3T.jpg
    86.9 KB · Views: 1,664
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.

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

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;

( 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


if you want to know how many bars have elapsed after a crossing, here is a counting study

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
306 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.