Wing's Trend Lines Indicator
Forums › ProRealTime English forum › ProBuilder support › Wing's Trend Lines Indicator
- This topic has 2 replies, 2 voices, and was last updated 7 years ago by juanj.
-
-
09/08/2017 at 11:23 AM #45799
Hello.
I thought I would make a thread for this indicator I submitted to the library. Details about it you can find here: https://www.prorealcode.com/prorealtime-indicators/wings-trend-lines/
A lot of people have asked about the trend lines included in ProRealTime, but you can’t access them in your strategies. Well, now you sort of can, or something even better.
If you want to discuss improvements or how to use for your trading (manual or automated) you can do that here.
If anyone wants to help, we could try to update the indicator to the 10.3 version. We should be able to draw the lines into the future, so they don’t just stop at the recent bar. Alternatively, we could also work on removing the ugly vertical changes of the lines when there is a trend shift. Improvements can also be made to the way that it draws lines, by basing them on something else than RSI. Combining this indicator with one that displays high/low/open/close of previous day, and one that is able to draw other important horizontal leves could have great potential. It would be a lot of levels though.
This is the main ‘indicator’ I use when I trade the DAX manually (100 tick TF). It has worked great for me. Sometimes you will be able draw trend lines too that the indicator can’t, and sometimes it draws indicators you would not have see yourself.
1 user thanked author for this post.
09/08/2017 at 11:27 AM #45804This is the code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174//////////////////////////////////////////////////////// Wing's Trend Lines - (Support and Resistance)//// Made by user "Wing" of ProRealCode.com// https://www.prorealcode.com/user/wing///////////////////////////////////////////////////////// Parameter:// p = 7 // 'lookback' / scale// LinesDisplayed=12//////////////////////////////////////////////////rs=RSI[p]once t1=0once t2=0once t3=0once t4=0once b1=0once b2=0once b3=0once b4=0once top=0// Note that the numbers 1-2-3-4 may be corresponding to the default RSI parameter of 7. So that should perhaps be changed if you want different parametersif rs[4]>70 and high[4]>high[3] and high[4]>high[2] and high[4]>high[1] and high[4]>high and top=0 thent4=t3t3=t2t2=t1t1=barindex-4top=6endifif rs[4]<30 and low[4]<low[3] and low[4]<low[2] and low[4]<low[1] and low[4]<low and top=0 thenb4=b3b3=b2b2=b1b1=barindex-4top=6endifif top>0 thentop=top-1endif// topsif high[barindex-t2]>high[barindex-t1] thenlinet1=high[barindex-t2]-(((barindex-t2)*sqrt(square(high[barindex-t1]-high[barindex-t2])))/(t1-t2))elselinet1=high[barindex-t2]+(((barindex-t2)*sqrt(square(high[barindex-t1]-high[barindex-t2])))/(t1-t2))endifif high[barindex-t3]>high[barindex-t2] thenlinet2=high[barindex-t3]-(((barindex-t3)*sqrt(square(high[barindex-t2]-high[barindex-t3])))/(t2-t3))elselinet2=high[barindex-t3]+(((barindex-t3)*sqrt(square(high[barindex-t2]-high[barindex-t3])))/(t2-t3))endifif high[barindex-t3]>high[barindex-t1] thenlinet21=high[barindex-t3]-(((barindex-t3)*sqrt(square(high[barindex-t1]-high[barindex-t3])))/(t1-t3))elselinet21=high[barindex-t3]+(((barindex-t3)*sqrt(square(high[barindex-t1]-high[barindex-t3])))/(t1-t3))endifif high[barindex-t4]>high[barindex-t1] thenlinet3=high[barindex-t4]-(((barindex-t4)*sqrt(square(high[barindex-t1]-high[barindex-t4])))/(t1-t4))elselinet3=high[barindex-t4]+(((barindex-t4)*sqrt(square(high[barindex-t1]-high[barindex-t4])))/(t1-t4))endifif high[barindex-t4]>high[barindex-t2] thenlinet31=high[barindex-t4]-(((barindex-t4)*sqrt(square(high[barindex-t2]-high[barindex-t4])))/(t2-t4))elselinet31=high[barindex-t4]+(((barindex-t4)*sqrt(square(high[barindex-t2]-high[barindex-t4])))/(t2-t4))endifif high[barindex-t4]>high[barindex-t3] thenlinet32=high[barindex-t4]-(((barindex-t4)*sqrt(square(high[barindex-t3]-high[barindex-t4])))/(t3-t4))elselinet32=high[barindex-t4]+(((barindex-t4)*sqrt(square(high[barindex-t3]-high[barindex-t4])))/(t3-t4))endif// botsif low[barindex-b2]>low[barindex-b1] thenlineb1=low[barindex-b2]-(((barindex-t2)*sqrt(square(low[barindex-b1]-low[barindex-b2])))/(b1-b2))elselineb1=low[barindex-b2]+(((barindex-b2)*sqrt(square(low[barindex-b1]-low[barindex-b2])))/(b1-b2))endifif low[barindex-b3]>low[barindex-b2] thenlineb2=low[barindex-b3]-(((barindex-b3)*sqrt(square(low[barindex-b2]-low[barindex-b3])))/(b2-b3))elselineb2=low[barindex-b3]+(((barindex-b3)*sqrt(square(low[barindex-b2]-low[barindex-b3])))/(b2-b3))endifif low[barindex-b3]>low[barindex-b1] thenlineb21=low[barindex-b3]-(((barindex-b3)*sqrt(square(low[barindex-b1]-low[barindex-b3])))/(b1-b3))elselineb21=low[barindex-b3]+(((barindex-b3)*sqrt(square(low[barindex-b1]-low[barindex-b3])))/(b1-b3))endifif low[barindex-b4]>low[barindex-b1] thenlineb3=low[barindex-b4]-(((barindex-b4)*sqrt(square(low[barindex-b1]-low[barindex-b4])))/(b1-b4))elselineb3=low[barindex-b4]+(((barindex-b4)*sqrt(square(low[barindex-b1]-low[barindex-b4])))/(b1-b4))endifif low[barindex-b4]>low[barindex-b2] thenlineb31=low[barindex-b4]-(((barindex-b4)*sqrt(square(low[barindex-b2]-low[barindex-b4])))/(b2-b4))elselineb31=low[barindex-b4]+(((barindex-b4)*sqrt(square(low[barindex-b2]-low[barindex-b4])))/(b2-b4))endifif low[barindex-b4]>low[barindex-b3] thenlineb32=low[barindex-b4]-(((barindex-b4)*sqrt(square(low[barindex-b3]-low[barindex-b4])))/(b3-b4))elselineb32=low[barindex-b4]+(((barindex-b4)*sqrt(square(low[barindex-b3]-low[barindex-b4])))/(b3-b4))endif// return values//resistance=(linet1+ linet2+ linet21+ linet3+ linet31+ linet32)/6//support=(lineb1+ lineb2+ lineb21+ lineb3+ lineb31+ lineb32)/6//midpoint=(resistance+support)/2if linesdisplayed<12 thenlineb32=linet1endifif linesdisplayed<11 thenlinet32=linet1endifif linesdisplayed<10 thenlineb31=linet1endifif linesdisplayed<9 thenlinet31=linet1endifif linesdisplayed<8 thenlineb3=linet1endifif linesdisplayed<7 thenlinet3=linet1endifif linesdisplayed<6 thenlineb21=linet1endifif linesdisplayed<5 thenlinet21=linet1endifif linesdisplayed<4 thenlineb2=linet1endifif linesdisplayed<3 thenlinet2=linet1endifif linesdisplayed<2 thenlineb1=linet1endifreturn linet1, linet2, linet21, linet3, linet31, linet32, lineb1, lineb2, lineb21, lineb3, lineb31, lineb321 user thanked author for this post.
09/08/2017 at 11:59 AM #45808@Wing the strategy I recently posted calculates trend lines based on the tangent trigonometry function. It works on the basis of using the bar count between two points as the opposite value and the point value as the adjacent value. I then calculate the angle using TAN(bar count/points). If needed you can also calculate the length of the diagonal line using Pythagorean theory (x2 + y2 = z2).
-
AuthorPosts
Find exclusive trading pro-tools on