Translate from TradingView Indicator:Trendline Pivots [QuantVue]
Forums › ProRealTime English forum › ProBuilder support › Translate from TradingView Indicator:Trendline Pivots [QuantVue]
- This topic has 5 replies, 4 voices, and was last updated 1 month ago by roccafragius.
-
-
09/20/2024 at 1:22 PM #237877
I see in TV a very useful Indicator, please find below the description from TV:
Trendline PivotsThe Trend Line Pivot Indicator works by automatically drawing and recognizing downward trendlines originating from and connecting pivot highs or upward trendlines originating from and connecting pivot lows.
These trendlines serve as reference points of potential resistance and support within the market.
Once identified, the trend line will continue to be drawn and progress with price until one of two conditions is met: either the price closes(default setting) above or below the trend line, or the line reaches a user-defined maximum length.
If the price closes(default setting) above a down trend line or below an up trend line, an “x” is displayed, indicating the resistance or support has been broken. At the same time, the trend line transforms into a dashed format, enabling clear differentiation from active non-breached trend lines.
This indicator is fully customizable from line colors, pivot length, the number lines you wish to see on your chart and works on any time frame and any market.
09/20/2024 at 3:58 PM #237888Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums. Thanks 🙂
I moved the topic from the Italian forum.
09/25/2024 at 4:29 PM #238012Here you have the traslation:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182defparam drawonlastbaronly=true//-----------------------------------------------////PRC_TrendLine pivots//version = 0//25.09.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-----------------------------------------------////-----Inputs------------------------------------////-----------------------------------------------//maxLines=4pivLen=9//-----------------------------------------------////-----Pivots High and Low-----------------------////-----------------------------------------------//src1 = lowsrc2 = highleftbars=pivLenrightbars=pivLen//---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]//drawpoint(barindex[rightbars],src1[rightbars],2)coloured("red",80)$crossdw[z+1]=0z = z + 1endif//---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]//drawpoint(barindex[rightbars],src2[rightbars],2)coloured("blue",80)$crossup[t+1]=0t=t+1endif//-----------------------------------------------////-----Line definition---------------------------////-----------------------------------------------////(x-x1)/(x2-x1) = (y-y1)/(y2-y1)//x = barindex//y = y1+(barindex-x1)*(y2-y1)/(x2-x1)if islastbarupdate then//---Pivots low linefor i=z-maxLines*2 to z do$y2[i] = $ply[i]$x2[i] = $plx[i]$y1[i] = $ply[max(i-1,0)]$x1[i] = $plx[max(i-1,0)]for j=$plx[i] downto 0 do$xl[i] = barindex[j]$yl[i] = $y1[i]+(barindex[j]-$x1[i])*($y2[i]-$y1[i])/($x2[i]-$x1[i])if $xl[i]>$x2[i] and $y2[i]>$y1[i] and low[j] < $yl[i] then$crossdw[i]=1drawsegment($x1[i],$y1[i],barindex[j],$yl[i])style(dottedline,2)coloured("blue")breakelsif $xl[i]>$x2[i] and $y2[i]>$y1[i] and $crossdw[i]=0 thendrawsegment($x1[i],$y1[i],barindex,$ply[max(i-1,0)]+(barindex-$plx[max(i-1,0)])*($ply[i]-$ply[max(i-1,0)])/($plx[i]-$plx[max(i-1,0)]))style(line,2)coloured("green")endifnextnext//---Pivots high linefor k=t-maxLines*2 to t do$y22[k] = $phy[k]$x22[k] = $phx[k]$y11[k] = $phy[max(k-1,0)]$x11[k] = $phx[max(k-1,0)]for n=$phx[k] downto 0 do$xh[k] = barindex[n]$yh[k] = $y11[k]+(barindex[n]-$x11[k])*($y22[k]-$y11[k])/($x22[k]-$x11[k])if $xh[k]>$x22[k] and $y22[k]<$y11[k] and high[n] > $yh[k] then$crossup[k]=1drawsegment($x11[k],$y11[k],barindex[n],$yh[k])style(dottedline,2)coloured("orange")breakelsif $xh[k]>$x22[k] and $y22[k]<$y11[k] and $crossup[k]=0 thendrawsegment($x11[k],$y11[k],barindex,$y11[k]+(barindex-$x11[k])*($y22[k]-$y11[k])/($x22[k]-$x11[k]))style(line,2)coloured("red")endifnextnextendif//-----------------------------------------------//return09/26/2024 at 7:55 AM #23803409/26/2024 at 8:36 AM #23804109/26/2024 at 1:43 PM #238072Thank you so much Ivan!!!
-
AuthorPosts
Find exclusive trading pro-tools on