//version=5
strategy("COTI 4H Swing Strategy - MA & RSI", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Input MA dan RSI
maShort = ta.sma(close, 7)
maMid = ta.sma(close, 25)
maLong = ta.sma(close, 99)
rsi = ta.rsi(close, 14)
rsiShort = ta.rsi(close, 6)
// Entry Buy: Harga dekat MA99 dan RSI mendekati oversold
buyCondition = close > maLong and close < maMid and rsi < 45 and ta.crossover(rsiShort, rsi)
if (buyCondition)
strategy.entry("Buy", strategy.long)
// Exit: Take profit saat harga mendekati MA25 atau RSI overbought
takeProfit = close > maMid and rsi > 65
if (takeProfit)
strategy.close("Buy")
// Stop Loss: Jika harga turun di bawah MA99
stopLoss = close < maLong * 0.98
if (stopLoss)
strategy.close("Buy")
// Plot MA
plot(maShort, color=color.yellow, title="MA 7")
plot(maMid, color=color.red, title="MA 25")
plot(maLong, color=color.purple, title="MA 99")
strategy("COTI 4H Swing Strategy - MA & RSI", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Input MA dan RSI
maShort = ta.sma(close, 7)
maMid = ta.sma(close, 25)
maLong = ta.sma(close, 99)
rsi = ta.rsi(close, 14)
rsiShort = ta.rsi(close, 6)
// Entry Buy: Harga dekat MA99 dan RSI mendekati oversold
buyCondition = close > maLong and close < maMid and rsi < 45 and ta.crossover(rsiShort, rsi)
if (buyCondition)
strategy.entry("Buy", strategy.long)
// Exit: Take profit saat harga mendekati MA25 atau RSI overbought
takeProfit = close > maMid and rsi > 65
if (takeProfit)
strategy.close("Buy")
// Stop Loss: Jika harga turun di bawah MA99
stopLoss = close < maLong * 0.98
if (stopLoss)
strategy.close("Buy")
// Plot MA
plot(maShort, color=color.yellow, title="MA 7")
plot(maMid, color=color.red, title="MA 25")
plot(maLong, color=color.purple, title="MA 99")
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
