Nicolas

Follow Line Indicator

Category: Indicators By: Nicolas Created: April 3, 2020, 10:42 AM
April 3, 2020, 10:42 AM
Indicators
12 Comments
Follow Line Indicator

The FollowLine indicator is a trend following indicator. The blue/red lines are activated when the price closes above the upper Bollinger band or below the lower one.

Once the trigger of the trend direction is made, the FollowLine will be placed at High or Low (depending of the trend).

An ATR filter can be selected to place the line at a more distance level than the normal mode settled at candles Highs/Lows.

//PRC_FollowLine | indicator
//03.04.2020
//Nicolas @ www.prorealcode.com
//converted from MT4 code
//Sharing ProRealTime knowledge

// --- settings 
BBperiod      = 21
BBdeviations  = 1
ATRperiod     = 5
UseATRfilter  = 0 //0=false ; 1=true
// --- end of settings 


BBUpper=average[BBperiod](close)+std[BBperiod]*BBdeviations
BBLower=average[BBperiod](close)-std[BBperiod]*BBdeviations
//-----------------------------------------------------------------------------------
if(close>BBUpper) then
 BBSignal=1
endif
if(close<BBLower) then 
 BBSignal=-1
endif

if(BBSignal>0) then
 if(UseATRfilter) then 
  TrendLine=low-averagetruerange[ATRperiod]
 endif
 if(not UseATRfilter) then 
  TrendLine=low
 endif
 if(TrendLine<TrendLine[1]) then 
  TrendLine=TrendLine[1]
 endif
endif
//---
if(BBSignal<0) then 
 if(UseATRfilter) then 
  TrendLine=high+averagetruerange[ATRperiod]
 endif
 if(not UseATRfilter) then 
  TrendLine=high
 endif
 if(TrendLine>TrendLine[1]) then 
  TrendLine=TrendLine[1]
 endif
endif
//---

iTrend=iTrend[1]
if(TrendLine>TrendLine[1]) then 
 iTrend=1
endif
if(TrendLine<TrendLine[1]) then 
 iTrend=-1
endif

if itrend>0 then 
 r=0
 g=191
 b=255
else
 r=220
 g=20
 b=60
endif

return trendline coloured(r,g,b) style(line,2)

 

Download
Filename: PRC_FollowLine-indicator.itf
Downloads: 953
Nicolas
Nicolas Legend
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

warengold
5 months ago
#

Hi, can you tell me how i can implement into the price chart because if i insert the indicator it always set in the down side nit directly on the chart

 

Best Regard

Maartin

Nicolas
5 months ago
#

Click on price and add it from there.

supertiti
3 years ago
#

Quand tu pourras si tu peux nous coder la troisième couleur cela améliorerait les trades court terme. merci beaucoup.

supertiti
3 years ago
#

Bonjour Nicolas, Je ne comprend pas bien , le trend change de couleur quand les prix sont au dessus/dessous des bandes de Bollinger; mais quand les prix reviennent à l'intérieur la couleur reste identique. Serait-il possible d'avoir une troisième couleur dans cette zone "neutre" merci ,bonne journée

Nicolas
3 years ago
#

Oui ce serait possible, cependant l'indicateur est bien prévu pour conserver la couleur de la même tendance tant qu'on ne traverse pas le côté opposé des bandes de Bollinger.

PhilipSchultz
6 years ago
#

Hi Nicolas, can i backtest this indicator? And if so, how do i do it? I have tried, but don´t suce

Nicolas
6 years ago
#

Sure, use the forums to create a new topic to ask for it Please respect the posting rules and describe precisely your query.

dg007
6 years ago
#

BUON GIORNO E' POSSIBILE AVERE UN CHIARIMENTO?GRAZIE MILLE

Nicolas
6 years ago
#

Poni qui la tua domanda se è correlata a questo indicatore, altrimenti apri un nuovo argomento nel forum appropriato e segui le regole di pubblicazione. Grazie.

sai000
6 years ago
#

can i use this in trading view plotform

Nicolas
6 years ago
#

No, all codes on our website are to be used with ProRealTime: https://www.prorealtime.com/en/

DaxRider
6 years ago
#

Nice indicator thank you Nicolas

ProRealCode ProRealCode
Loading...