OPEN-SOURCE SCRIPT

DSL Oscillator Emeson Bareno

//version=5
indicator("DSL Oscillator", overlay=false)

// Input Parameters
length = input.int(14, minval=1, title="Length")
smoothing1 = input.int(3, minval=1, title="First Smoothing Length")
smoothing2 = input.int(3, minval=1, title="Second Smoothing Length")

// Calculate Price Data
price = close

// Double Smoothing Process
ema1 = ta.ema(price, smoothing1)
ema2 = ta.ema(ema1, smoothing2)

// DSL Calculation
dsl = ta.ema(ema2, length)

// Signal Thresholds
buy_level = input.float(0.1, title="Buy Threshold", tooltip="Threshold for generating buy signals")
sell_level = input.float(-0.1, title="Sell Threshold", tooltip="Threshold for generating sell signals")

// Buy and Sell Signals
buy_signal = ta.crossover(dsl, buy_level)
sell_signal = ta.crossunder(dsl, sell_level)

// Plot DSL Oscillator
plot(dsl, color=color.blue, linewidth=2, title="DSL Oscillator")
hline(buy_level, "Buy Level", color=color.green, linestyle=hline.style_dotted)
hline(sell_level, "Sell Level", color=color.red, linestyle=hline.style_dotted)

// Signal Markers
plotshape(buy_signal, style=shape.labelup, color=color.green, location=location.belowbar, size=size.small, title="Buy Signal")
plotshape(sell_signal, style=shape.labeldown, color=color.red, location=location.abovebar, size=size.small, title="Sell Signal")
Bands and ChannelsBreadth IndicatorsCandlestick analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer