Vonasi

Trend Lines and Trend Channel

Category: Indicators By: Vonasi Created: April 2, 2020, 2:15 PM
April 2, 2020, 2:15 PM
Indicators
6 Comments
Trend Lines and Trend Channel

This indicator only works on PRT v11 onwards.

This indicator draws trend lines from the last bar on the chart based on the previous p candles.

You can also draw channels above and below the main trend line. The steeper the trend line the further apart these are and the shallower the trend line the closer together they are. Their spacing can be adjusted using the ‘Multiple’ setting. The channel lines can be added or removed with the ‘Upper’ and ‘Lower’ settings.

The trend lines and channel lines are projected into the future by p bars and into the past by p bars. These can be removed or displayed with the ‘Past’ and ‘Future’ settings.

The calculations can be done using either pure price movements of price movements as a percentage of the previous close. The ‘Percentage’ setting allows you to choose which.

The trend lines are green if they are rising and red if they are declining.

If you apply the indicator multiple times to your price chart with different settings for ‘p’ then you can get a feeling for short, medium and long term trends and be able to visualise where price might be in the future.

As always I advise downloading and importing to get full functionality.

//Trend Lines and Trend Channel
//PRT v11
//By Vonasi
//Date: 20200401

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 = 0 to 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 past then
   drawsegment(barindex,close,barindex-p,close - mydiff)coloured(r,g,0)
  endif
  if future then
   drawsegment(barindex,close,barindex+p,close + mydiff)coloured(r,g,0)
  endif

  if upper then
   hh = abs(mydiff)*multiple
   if past then
    drawsegment(barindex,close+hh,barindex-p,close-mydiff+hh)coloured(r,g,0)
   endif
   if future then
    drawsegment(barindex,close+hh,barindex+p,close+mydiff+hh)coloured(r,g,0)
   endif
  endif

  if lower then
   ll = abs(mydiff)*multiple
   if past then
    drawsegment(barindex,close-ll,barindex-p,close-mydiff-ll)coloured(r,g,0)
   endif
   if future then
    drawsegment(barindex,close-ll,barindex+p,close+mydiff-ll)coloured(r,g,0)
   endif
  endif
 endif
 endif
endif

return

 

Download
Filename: Trend-Lines-and-Trend-Channel.itf
Downloads: 445
Vonasi
Vonasi Master
V-oyaging ON A S-mall I-ncome
Author’s Profile

Comments

chicoteca
6 years ago
#

Buenas, no consigo que se me muestre en el chart de DAX. ¿Cómo procedo? Gracias.-

kenssa
6 years ago
#

import through the indicator page/window in the Proreal time

bob789
6 years ago
#

Once you download it, how do you upload it into PRT? thanks

Nicolas
6 years ago
#

How to import file page: in the help section of the website explains howto

Vonasi
6 years ago
#

An update to this indicator with some improvements and new features can now be found here: https://www.prorealcode.com/topic/trend-lines-and-trend-channel-update/

Maxime Baudin
6 years ago
#

Thank you Vonasi

ProRealCode ProRealCode
Loading...