Fast and Slow Trend-Line Momentum [Loxx]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © loxx

//@version=5
indicator("Fast and Slow Trend-Line Momentum [Loxx]", 
     shorttitle = "FSTLM [Loxx]", 
     overlay = false, 
     timeframe="", 
     timeframe_gaps = true)
     
import loxx/loxxfsrrdspfilts/1

greencolor = #2DD204
redcolor = #D2042D 
lightgreencolor = #96E881 
lightredcolor =  #DF4F6C  
darkGreenColor = #1B7E02  
darkRedColor =   #93021F  

src = input.source(close, title="Source", group = "Basic Settings")
colorbars = input.bool(false, "Color bars?", group= "UI Options")

FTLM = loxxfsrrdspfilts.fatl(src)  - loxxfsrrdspfilts.rftl(src)

STLM = loxxfsrrdspfilts.satl(src)  - loxxfsrrdspfilts.rstl(src)

coloroutf = FTLM >= 0 ? greencolor : redcolor

coloroutfs = STLM >= 0 ? greencolor : redcolor


zl = plot(0, color = bar_index % 2 ? color.gray : na) 

outst = plot(STLM, color = coloroutfs, linewidth = 1)

outft = plot(FTLM, color = color.white, linewidth = 2)

fill(outft, zl, color = color.new(color.white, 70))
fill(outst, zl, color = color.new(coloroutfs, 80))

barcolor(colorbars ? coloroutf : na)


