Some changes (for sake of completeness).
There are some things that still don’t convince me looking at Ira’s videos
Inside days seem always to revert the swinglines
Outside days seem always to bring the swing line to the side of the bar where the opening is.
That’s the pattern that seems to appear.
If some guy (joining his courses) can be more clear and post here what’s the real “thing”, he will be appreciated (without disclosing proprietary informations).
By now it seems the indicator I built replicates 99% of the times Ira’s one.
All credits to Ira of course 🙂
//Swing Lines (from an idea by Ira Epstein)
HH=high[0]>high[1] AND low[0]>=low[1]
LL=high[0]<=high[1] AND low[0]<low[1]
ID=high[0]<=high[1] AND low[0]>=low[1]
ODU=high[0]>high[1] AND low[0]<low[1] AND close[0]>open[0]
ODD=high[0]>high[1] AND low[0]<low[1] AND close[0]<open[0]
DOJI=high[0]>high[1] AND low[0]<low[1] AND close[0]=open[0]
//higher highs higher lows
if HH then
DRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)
x1=barindex[0]
y1=high[0]
flag=1
//lower highs lower lows
elsif LL then
DRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)
x1=barindex[0]
y1=low[0]
flag=0
//inside day
elsif ID then
//if after uptrend
if flag=1 OR flag=3 OR flag=5 OR flag=7 then
DRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)
x1=barindex[0]
y1=low[0]
flag=4
//if after downtrend
elsif flag=0 OR flag=2 OR flag=4 OR flag=6 then
DRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)
x1=barindex[0]
y1=high[0]
flag=5
endif
//outside day up
elsif ODU then
DRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)
x1=barindex[0]
y1=low[0]
flag=2
//outside day down
elsif ODD then
DRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)
x1=barindex[0]
y1=high[0]
flag=3
//outside day doji
elsif DOJI then
//if after uptrend
if flag=1 OR flag=3 OR flag=5 OR flag=7 then
DRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)
x1=barindex[0]
y1=low[0]
flag=6
//if after downtrend
elsif flag=0 OR flag=2 or flag=4 OR flag=6 then
DRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)
x1=barindex[0]
y1=high[0]
flag=7
endif
endif
Return