Swinglines
Forums › ProRealTime English forum › ProBuilder support › Swinglines
- This topic has 8 replies, 3 voices, and was last updated 3 years ago by robertogozzi.
Tagged: drawsegment, swing, Swinglines
-
-
04/25/2019 at 4:10 PM #97140
I am trying to build an indicator as shown in this screenshot from youtube.
This gentleman is Ira Epstein and posts his end of day financial videos on YouTube.
The indicator I am referring is a swingline (the one in gold color that connects highs and lows in the screenshot).
I would like to see what is the low and the high let’s say 50 bars ago, and check each following bar at a time looking for:
- higher highs
- lower lows
- inside days
- outside days up
- outside days down
(which he mentions here https://www.youtube.com/watch?v=CVrfDOVKLlE ) and connect the points to be connected.
The original indicator is copyrighed but I am only trying to replicate it looking at his videos and listening what he said.
Could some good soul please post a simple code to connect all the lows in a chart from, let’s say, 50 bars ago?
I need this simple kick-off because I can’t understand how “drawsegment” works in practice.
04/25/2019 at 4:34 PM #9714412345N = 50For i = N DownTo 1DRAWSEGMENT(barindex[i],low[i],barindex[i-1],low[i-1])coloured(0,128,0,255)NextReturnNot tested.
1 user thanked author for this post.
04/25/2019 at 7:54 PM #97160Thanks
This is the indicator I thought.
The original one is proprietary to Ira Epstein, and I tried only to replicate it looking at his charts posted on youtube videos and trying to understand the logic in which he combined the data.
Surely it has some flaws but it seems to work the way I wanted.
Let’s call it a Beta version
PS
@Roberto/NicolasCould you please modify the title of this thread to “Swinglines”? In case one tries to search it.
Swinglines1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556//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]//higher highs higher lowsif HH thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=1//lower highs lower lowselsif LL thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=0//inside dayelsif ID then//if after uptrendif flag=1 OR flag=3 or flag=4 thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=4//if after downtrendelsif flag=0 OR flag=2 or flag=5 thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=5endif//outside day upelsif ODU thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=2//outside day downelsif ODD thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=3elseendifReturn1 user thanked author for this post.
04/25/2019 at 8:49 PM #9716704/28/2019 at 4:51 PM #97307Some 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 🙂
Swinglines123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172//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 lowsif HH thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=1//lower highs lower lowselsif LL thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=0//inside dayelsif ID then//if after uptrendif flag=1 OR flag=3 OR flag=5 OR flag=7 thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=4//if after downtrendelsif flag=0 OR flag=2 OR flag=4 OR flag=6 thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=5endif//outside day upelsif ODU thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=2//outside day downelsif ODD thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=3//outside day dojielsif DOJI then//if after uptrendif flag=1 OR flag=3 OR flag=5 OR flag=7 thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=6//if after downtrendelsif flag=0 OR flag=2 or flag=4 OR flag=6 thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=7endifendifReturn1 user thanked author for this post.
05/23/2019 at 5:42 PM #99264Version 2.0
I changed the way Outside Days are treated because Swinglines didn’t replicate 100% what I see in Ira’s Youtube videos
It “seems” to me that in those cases the close of the day before is compared with the close of the current day
Swing Lines 2.0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172//Swing Lines 2.0 (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 lowsif HH thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=1//lower highs lower lowselsif LL thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=0//inside dayelsif ID then//if after uptrendif flag=1 OR flag=3 OR flag=5 OR flag=7 thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=4//if after downtrendelsif flag=0 OR flag=2 OR flag=4 OR flag=6 thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=5endif//outside day up down or doji and close1<close0elsif (ODU or ODD or DOJI) AND close[1]<close[0] thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=2//outside day up down or doji and close1>close0elsif (ODU or ODD or DOJI) AND close[1]>close[0] thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=3//outside day up down or doji and close1=close0elsif (ODU or ODD or DOJI) AND close[1]=close[0] then//if after uptrendif flag=1 OR flag=3 OR flag=5 OR flag=7 thenDRAWSEGMENT(x1,y1,barindex[0],low[0])coloured(0,0,0)x1=barindex[0]y1=low[0]flag=6//if after downtrendelsif flag=0 OR flag=2 or flag=4 OR flag=6 thenDRAWSEGMENT(x1,y1,barindex[0],high[0])coloured(0,0,0)x1=barindex[0]y1=high[0]flag=7endifendifReturn1 user thanked author for this post.
03/20/2021 at 4:57 PM #164757Hello Ciccio, been following your posts for a few months now because I found you while I was looking for a swing line indicator for my Thinkorswim platform. I am not familiar with the ProRealTime platform you use but it looks similar to mine. I have been looking for a person to make me an indicator (like you have done here) that would work on TOS, however I have been unable to find anyone that’s interested in making me one. My question to you would you consider making me an indicator just like the one you have here that will work on Thinkorswim? Thanks for looking.
airgb58
03/20/2021 at 5:35 PM #164759Unfortunately I don’t know Thinkorswim, so I cannot help you.
Let’s hope someone else can help you in this matter 🙂03/20/2021 at 5:38 PM #164760Sorry, but this forum is devoted to ProRealTime only, so we can freely convert any code TO ProRealTime, not the other way round.
You can apply for paid services at https://www.prorealcode.com/trading-programming-services/, but I don’t know if they can do it.
1 user thanked author for this post.
-
AuthorPosts