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)
You must be logged in to post a comment.
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
Hi Nicolas, can i backtest this indicator? And if so, how do i do it? I have tried, but don´t suce
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