//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")
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
