Momentum Sparkler (MS)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © peacefulLizard50262

//@version=5 
indicator("Momentum Sparkler", overlay = true, max_bars_back = 5000)
source = input.source(close, "Source")
length = input.int(45, "Length", 1)
lines = array.new<line>(length)
if barstate.islast
    for i = 0 to length
        array.push(lines, line.new(bar_index, source , bar_index+i, source + (source-source[i]), color= color.from_gradient(i, 0, length, color.new(color.red, 5 + i*2 - 5), color.new(color.green, 5 + i*2 - 5))))

if barstate.isconfirmed
    for i = 0 to array.size(lines) - 1
        line.delete(array.get(lines, i))