StockFetcher Forums · General Discussion · Follow Line Indicator<< >>Post Follow-up
snappyfrog
728 posts
msg #159588
Ignore snappyfrog
9/15/2022 10:28:18 AM

I am terrible at coding, so I was hoping some of you would be able to convert this to
something usable in SF. This is a tradingview code.

// © Dreadblitz
//@version=4
study(shorttitle="FLI", title="Follow Line Indicator", overlay=true)
//
BBperiod = input(defval = 21, title = "BB Period", type = input.integer, minval = 1)
BBdeviations = input(defval = 1.00, title = "BB Deviations", type = input.float, minval = 0.1, step=0.05)
UseATRfilter = input(defval = true, title = "ATR Filter", type = input.bool)
ATRperiod = input(defval = 5, title = "ATR Period", type = input.integer, minval = 1)
hl = input(defval = false, title = "Hide Labels", type = input.bool)
//
BBUpper=sma (close,BBperiod)+stdev(close, BBperiod)*BBdeviations
BBLower=sma (close,BBperiod)-stdev(close, BBperiod)*BBdeviations
//
TrendLine = 0.0
iTrend = 0.0
buy = 0.0
sell = 0.0
//
BBSignal = close>BBUpper? 1 : close//
if BBSignal == 1 and UseATRfilter == 1
TrendLine:=low-atr(ATRperiod)
if TrendLine TrendLine:=TrendLine[1]
if BBSignal == -1 and UseATRfilter == 1
TrendLine:=high+atr(ATRperiod)
if TrendLine>TrendLine[1]
TrendLine:=TrendLine[1]
if BBSignal == 0 and UseATRfilter == 1
TrendLine:=TrendLine[1]

//
if BBSignal == 1 and UseATRfilter == 0
TrendLine:=low
if TrendLine TrendLine:=TrendLine[1]
if BBSignal == -1 and UseATRfilter == 0
TrendLine:=high
if TrendLine>TrendLine[1]
TrendLine:=TrendLine[1]
if BBSignal == 0 and UseATRfilter == 0
TrendLine:=TrendLine[1]
//
iTrend:=iTrend[1]
if TrendLine>TrendLine[1]
iTrend:=1
if TrendLine iTrend:=-1
//
buy:=iTrend[1]==-1 and iTrend==1 ? 1 : na
sell:=iTrend[1]==1 and iTrend==-1? 1 : na
//
plot(TrendLine, color=iTrend > 0?color.blue:color.red ,style=plot.style_line,linewidth=2,transp=0,title="Trend Line")
plotshape(buy == 1 and hl == false? TrendLine-atr(8) :na, text='💣', style= shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, offset=0, transp=0,size=size.auto)
plotshape(sell == 1 and hl == false ?TrendLine+atr(8):na, text='🔨', style=shape.labeldown, location=location.absolute, color=color.red, textcolor=color.white, offset=0, transp=0,size=size.auto)
//
alertcondition(sell == 1 ,title="Sell",message="Sell")
alertcondition(buy == 1 ,title="Buy",message="Buy")
alertcondition(buy == 1 or sell == 1 ,title="Buy/Sell",message="Buy/Sell")

snappyfrog
728 posts
msg #159589
Ignore snappyfrog
9/15/2022 10:35:05 AM

"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."

So, this shouldn't be so hard to make a scan after all. I will give it a try later tonight - after trading session.

StockFetcher Forums · General Discussion · Follow Line Indicator<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.