TrendLine BreakOuts
Forums › ProRealTime forum Italiano › Supporto ProOrder › TrendLine BreakOuts
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
10/18/2025 at 9:30 AM #252715
Hi Ivan, great work. I’d love to try this indicator in an automated system, but I don’t understand what I should do to trigger an entry signal with the red or green arrows.
Thanks
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144//--------------------------------------------------////PRC_TrendLine BreakOuts by chartprime//version = 0//27.11.2024//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//--------------------------------------------------//// Inputs//--------------------------------------------------//period=9pivottype=1 // 1 means wicks // 0 means BodyshowtrendUP=1 //BooleanshowtrendDN=1 //Boolean//--------------------------------------------------//// Pivots High and Low//--------------------------------------------------//leftbars=periodrightbars=max(1,floor(period/2))if pivottype thensrc1 = lowsrc2 = highelsesrc1 = min(open,close)src2 = max(open,close)endif//---Pivots Lowif src1 > src1[rightbars] and lowest[rightbars](src1) > src1[rightbars] and src1[rightbars] < lowest[leftbars](src1)[rightbars+1] then$PLy[z+1]=src1[rightbars]$PLx[z+1]=barindex[rightbars]z=z+1//y=(x-x1)*slope+y1if $PLy[z]>$PLy[z-1] then$slopeL[z]=($PLy[z]-$PLy[z-1])/($PLx[z]-$PLx[z-1])endifendif//---Pivots Highif src2 < src2[rightbars] and highest[rightbars](src2)<src2[rightbars] and src2[rightbars]>highest[leftbars](src2)[rightbars+1] then$PHy[t+1]=src2[rightbars]$PHx[t+1]=barindex[rightbars]t=t+1//y=(x-x1)*slope+y1if $PHy[t]<$PHy[t-1] then$slope[t]=($PHy[t]-$PHy[t-1])/($PHx[t]-$PHx[t-1])endifendif//--------------------------------------------------////Volatility for TP and SL//--------------------------------------------------//Zband=min(averagetruerange[30](close)*0.3,close*(0.3/100))[20]/2//--------------------------------------------------//// Draw trendlines and trading signals//--------------------------------------------------////Trendline and Long positionsif islastbarupdate and showtrendUP thenfor i=t downto 4 doif $PHy[i-1]<$PHy[i-2] thenx1=$PHx[i-2]y1=$PHy[i-2]for j=$PHx[i-1]+1 to barindex dox2=jy2=y1+(x2-x1)*$slope[i-1]if close[barindex-j]>y2 thentp=high[barindex-j]+(Zband[barindex-j]*20)sl=low[barindex-j]-(Zband[barindex-j]*20)breakendifnextfor k=x2+1 to barindex doif high[barindex-k]>=tp thenx3=ksellprice=max(tp,open[barindex-k])win=1breakelsif low[barindex-k]<=sl thenx3=ksellprice=min(sl,open[barindex-k])win=0breakelsex3=barindexendifnextif x2<$PHx[i] thendrawsegment(x1,y1,x2,y2)coloured("darkgreen")drawtext("▲",x2,y2-0.25*tr[1])coloured("green")drawsegment(x2,tp,x3,tp)style(dottedline)coloured("green")drawsegment(x2,sl,x3,sl)style(dottedline)coloured("darkred")drawsegment(x2,y2,x2,tp)style(dottedline4,1)coloured("green")drawsegment(x2,y2,x2,sl)style(dottedline4,1)coloured("green")if x3<>barindex thendrawpoint(x3,sellprice,1)coloured("orange")drawtext("✖",x3,sellprice+0.25*tr[1])coloured("green")endifendifendifnextendif//---TrendLine and Short positionsif islastbarupdate and showtrendDN thenfor i=z downto 4 doif $PLy[i-1]>$PLy[i-2] thenx1=$PLx[i-2]y1=$PLy[i-2]for j=$PLx[i-1]+1 to barindex dox2=jy2=y1+(x2-x1)*$slopeL[i-1]if close[barindex-j]<y2 thensl=high[barindex-j]+(Zband[barindex-j]*20)tp=low[barindex-j]-(Zband[barindex-j]*20)breakendifnextfor k=x2+1 to barindex doif high[barindex-k]>=sl thenx3=ksellprice=max(sl,open[barindex-k])win=0breakelsif low[barindex-k]<=tp thenx3=ksellprice=min(tp,open[barindex-k])win=1breakelsex3=barindexendifnextif x2<$PLx[i] thendrawsegment(x1,y1,x2,y2)coloured("darkred")drawtext("▼",x2,y2+0.50*tr[1])coloured("darkred")drawsegment(x2,tp,x3,tp)style(dottedline)coloured("green")drawsegment(x2,sl,x3,sl)style(dottedline)coloured("darkred")drawsegment(x2,y2,x2,tp)style(dottedline4,1)coloured("green")drawsegment(x2,y2,x2,sl)style(dottedline4,1)coloured("green")if x3<>barindex thendrawpoint(x3,sellprice,1)coloured("orange")drawtext("✖",x3,sellprice+0.25*tr[1])coloured("darkred")endifendifendifnextendif//--------------------------------------------------//return10/20/2025 at 9:50 AM #252749Buongiorno. Per poterlo fare devi dimenticare il frammento islastbarupdate. Bisogna monitorare gli ultimi due massimi o minimi e calcolare il valore Y della retta che li unisce. In questo modo, quando il prezzo supera questa retta, allora entri long o short.
1 user thanked author for this post.
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on
Similar topics: