Test

26
//version=4
study("MACD Buy/Sell Signals", shorttitle="MACD Signals", overlay=true)

// Input parameters
fast_length = input(12, title="Fast Length")
slow_length = input(26, title="Slow Length")
signal_smoothing = input(9, title="Signal Smoothing")

// MACD calculation
[macdLine, signalLine, _] = macd(close, fast_length, slow_length, signal_smoothing)

// Sinyal buy dan sell
buySignal = crossover(macdLine, signalLine)
sellSignal = crossunder(macdLine, signalLine)

// Plot sinyal pada chart
plotshape(series=buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// Plot MACD dan garis sinyal (opsional)
plot(macdLine, title="MACD Line", color=color.blue)
plot(signalLine, title="Signal Line", color=color.orange)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.