//version=5
indicator("Multi-Indicator Strategy", overlay=true)

// Parameter RSI
rsiPeriod = input(14, title="RSI Period")
overboughtLevel = input(70, title="Overbought Level")
oversoldLevel = input(30, title="Oversold Level")
rsiValue = ta.rsi(close, rsiPeriod)

// Parameter Moving Average
maLength = input(50, title="Moving Average Length")
ma = ta.sma(close, maLength)

// Parameter MACD
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)

// Sinyal beli dan jual berdasarkan gabungan indikator
buySignal = ta.crossover(rsiValue, oversoldLevel) and close > ma and macdLine > signalLine
sellSignal = ta.crossunder(rsiValue, overboughtLevel) and close < ma and macdLine < signalLine

// Plot tanda beli dan jual pada chart
plotshape(series=buySignal, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellSignal, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// Eksekusi buy dan sell
if (buySignal)
strategy.entry("Buy", strategy.long)

if (sellSignal)
strategy.close("Buy")
Chart PatternsTechnical IndicatorsTrend Analysis

Wyłączenie odpowiedzialności