Untitled

 avatar
unknown
plain_text
2 months ago
901 B
4
Indexable
//@version=5
indicator("Custom DWMA Buy/Sell Signals", overlay=true)

// Input parameters
length = input.int(14, title="Length")
src = input(close, title="Source")

// Double Weighted Moving Average (DWMA)
dwma = ta.sma(ta.sma(src, length), length)

// Plot DWMA
plot(dwma, color=color.blue, title="DWMA")

// Buy/Sell Signal Logic
buy_signal = ta.crossover(src, dwma)
sell_signal = ta.crossunder(src, dwma)

// Plot Buy/Sell Signals
plotshape(series=buy_signal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sell_signal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// Alerts
alertcondition(buy_signal, title="Buy Signal Alert", message="BUY Signal Generated")
alertcondition(sell_signal, title="Sell Signal Alert", message="SELL Signal Generated")
Editor is loading...
Leave a Comment