I have made a few improvements to my PRTv11 Trend Lines and Trend Channel indicator.
You can now set a StartBack period. This allows you to draw the trend lines that would have been shown StartBack bars ago. So for example if you set p to 100 and StartBack also to 100 you can see what lines would have been projected forward for 100 bars from 100 bars back in history so you can see how price behaved in the last 100 bars compared to what the trend lines drew.
There is also now the option to remove the middle trend line. this allows you to just show the upper and lower channels if you wish to.
There is now also the option to display the pivot point at the central point of the middle line. This is useful when using the StartBack feature as it shows you exactly where in the history the lines are being drawn from.
//Trend Lines and Trend Channel v2
//PRT v11
//By Vonasi
//Date: 20200406
// p = 100
//Percentage = 1
//Lower = 1
//Upper = 1
//Past = 1
//Future = 1
//Multiple = 1
//StartBack = 0
//PivotPoint = 1
//Middle = 1
if p < barindex then
if barindex >= p-1 then
if percentage then
$diff[barindex] = ((close-open)/(close[1]))
else
$diff[barindex] = close-open
endif
if islastbarupdate then
mydiff = 0
for a = startback to startback+p-1
if percentage then
mydiff = mydiff+($diff[barindex-a]*close)
else
mydiff = mydiff+($diff[barindex-a])
endif
next
r = 128
g = 0
if mydiff >=0 then
r = 0
g = 128
endif
if pivotpoint then
drawpoint(barindex-startback,close[startback],2)coloured(r,g,0)
endif
if middle then
if past then
drawsegment(barindex-startback,close[startback],barindex-p-startback,close[startback] - mydiff)coloured(r,g,0)
endif
if future then
drawsegment(barindex-startback,close[startback],barindex+p-startback,close[startback] + mydiff)coloured(r,g,0)
endif
endif
if upper then
hh = abs(mydiff)*multiple
if past then
drawsegment(barindex-startback,close[startback]+hh,barindex-p-startback,close[startback]-mydiff+hh)coloured(r,g,0)
endif
if future then
drawsegment(barindex-startback,close[startback]+hh,barindex+p-startback,close[startback]+mydiff+hh)coloured(r,g,0)
endif
endif
if lower then
ll = abs(mydiff)*multiple
if past then
drawsegment(barindex-startback,close[startback]-ll,barindex-p-startback,close[startback]-mydiff-ll)coloured(r,g,0)
endif
if future then
drawsegment(barindex-startback,close[startback]-ll,barindex+p-startback,close[startback]+mydiff-ll)coloured(r,g,0)
endif
endif
endif
endif
endif
return