Bot trad

153
//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")

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.