Double Brown's Exponential Smoother (DBES)
// 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("DBES", overlay = true)
source = input.source(close, "Source")
alpha = input.float(0.007, "Alpha", 0.001, 1, 0.001)

bes(source, alpha)=>
    var float smoothed = na
    smoothed := na(smoothed) ? source : alpha * source + (1 - alpha) * nz(smoothed[1])

dbes()=>
    e1 = bes(source, alpha)
    e2 = bes(e1, alpha)
    dema = 2 * e1 - e2

plot(dbes(), "DBES", color.red)
