Perfect Trend Line 2

Category: Indicators By: Nicolas Created: November 5, 2020, 2:37 PM
November 5, 2020, 2:37 PM
Indicators
58 Comments

This is a variation of a well known perfect trend line indicator (the initial version can be found here: Perfect Trend Line

This version is adding a sort of signals filtering which helps in cleaning up some false signals that are there in the original version.

Usage :

  • You can use the arrows (dots) as early signals
  • You can use the appearance of the color candle as signal for entry or re-entry
//PRC_PerfectTrendLine 2 | indicator
//05.11.2020
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from MT5 version (original author mladen)
//enhanced version by Nicolas

// --- settings
SlowLength         = 7 // Slow length
FastLength         = 3 // Fast length
// --- end of settings

fasthigh = Highest[SlowLength](high)//[1]
fastlow  = Lowest[SlowLength](low)//[1]
slowhigh = Highest[FastLength](high)//[1]
slowlow  = Lowest[FastLength](low)//[1]

if high<slowhigh then
 thighs=slowhigh 
else 
 thighs=high
endif
if low>slowlow then 
 tlows=slowlow
else
 tlows=low
endif 
if high<fasthigh then 
 thighf=fasthigh
else
 thighf=high
endif 
if low>fastlow then 
 tlowf=fastlow
else
 tlowf=low
endif

if close>slowln[1] then 
 slowln=tlows
else
 slowln=thighs
endif
if close>fastln[1] then 
 fastln=tlowf
else
 fastln=thighf
endif

once trend=-1
if close<slowln and close<fastln then 
 trend=1
endif
if close>slowln and close>fastln then 
 trend=0
endif

if trend<>trend[1] then
 if trend=0 then
  r=30
  g=144
  b=255
 else
  r=200
  g=20
  b=60
 endif
 drawtext("●",barindex,fastln,Dialog,Bold,10) coloured(r,g,b)
endif
drawcandle(open,high,low,close) coloured(168,168,168)
if trend=0 then 
 if close>slowln then
  drawcandle(open,high,low,close) coloured(30,144,255)
 endif
elsif trend=1 then 
  if close<slowln then 
   drawcandle(open,high,low,close) coloured(200,20,60)
  endif
endif


return fastln coloured(30,144,255) as "fast line",slowln coloured(200,20,60) as "slow line", trend as "trend"

 

Download
Filename: PRC_PerfectTrendLine-2.itf
Downloads: 1262
Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Logo Logo
Loading...