//version=5
indicator("BTC EMA20/50 + RSI + TP/SL", overlay=true)
// === INPUTS ===
emaFastLen = input.int(20, title="EMA Fast (20)")
emaSlowLen = input.int(50, title="EMA Slow (50)")
rsiLen = input.int(14, title="RSI Period")
rsiSrc = input.source(close, title="RSI Source")
tpPercent = input.float(2.0, title="Take Profit (%)", minval=0.1)
slPercent = input.float(1.0, title="Stop Loss (%)", minval=0.1)
// === INDICATOR CALC ===
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
rsi = ta.rsi(rsiSrc, rsiLen)
// === SIGNAL CONDITIONS ===
buySignal = ta.crossover(rsi, 50) and emaFast > emaSlow and close > emaFast
sellSignal = ta.crossunder(rsi, 50) and emaFast < emaSlow and close < emaFast
// === TP & SL LEVELS ===
var float buyEntry = na
var float sellEntry = na
var float buyTP = na
var float sellTP = na
var float buySL = na
var float sellSL = na
if (buySignal)
buyEntry := close
buyTP := buyEntry * (1 + tpPercent / 100)
buySL := buyEntry * (1 - slPercent / 100)
if (sellSignal)
sellEntry := close
sellTP := sellEntry * (1 - tpPercent / 100)
sellSL := sellEntry * (1 + slPercent / 100)
// === PLOT SIGNALS ===
plotshape(buySignal, title="Buy", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === PLOT TP/SL LINES ===
plot(buyTP, title="Buy TP", color=color.green, linewidth=1, style=plot.style_linebr, offset=0)
plot(buySL, title="Buy SL", color=color.red, linewidth=1, style=plot.style_linebr, offset=0)
plot(sellTP, title="Sell TP", color=color.green, linewidth=1, style=plot.style_linebr, offset=0)
plot(sellSL, title="Sell SL", color=color.red, linewidth=1, style=plot.style_linebr, offset=0)
// === ALERTS ===
alertcondition(buySignal, title="Buy Signal", message="BUY: EMA20>EMA50 and RSI>50")
alertcondition(sellSignal, title="Sell Signal", message="SELL: EMA20<EMA50 and RSI<50")
indicator("BTC EMA20/50 + RSI + TP/SL", overlay=true)
// === INPUTS ===
emaFastLen = input.int(20, title="EMA Fast (20)")
emaSlowLen = input.int(50, title="EMA Slow (50)")
rsiLen = input.int(14, title="RSI Period")
rsiSrc = input.source(close, title="RSI Source")
tpPercent = input.float(2.0, title="Take Profit (%)", minval=0.1)
slPercent = input.float(1.0, title="Stop Loss (%)", minval=0.1)
// === INDICATOR CALC ===
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
rsi = ta.rsi(rsiSrc, rsiLen)
// === SIGNAL CONDITIONS ===
buySignal = ta.crossover(rsi, 50) and emaFast > emaSlow and close > emaFast
sellSignal = ta.crossunder(rsi, 50) and emaFast < emaSlow and close < emaFast
// === TP & SL LEVELS ===
var float buyEntry = na
var float sellEntry = na
var float buyTP = na
var float sellTP = na
var float buySL = na
var float sellSL = na
if (buySignal)
buyEntry := close
buyTP := buyEntry * (1 + tpPercent / 100)
buySL := buyEntry * (1 - slPercent / 100)
if (sellSignal)
sellEntry := close
sellTP := sellEntry * (1 - tpPercent / 100)
sellSL := sellEntry * (1 + slPercent / 100)
// === PLOT SIGNALS ===
plotshape(buySignal, title="Buy", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === PLOT TP/SL LINES ===
plot(buyTP, title="Buy TP", color=color.green, linewidth=1, style=plot.style_linebr, offset=0)
plot(buySL, title="Buy SL", color=color.red, linewidth=1, style=plot.style_linebr, offset=0)
plot(sellTP, title="Sell TP", color=color.green, linewidth=1, style=plot.style_linebr, offset=0)
plot(sellSL, title="Sell SL", color=color.red, linewidth=1, style=plot.style_linebr, offset=0)
// === ALERTS ===
alertcondition(buySignal, title="Buy Signal", message="BUY: EMA20>EMA50 and RSI>50")
alertcondition(sellSignal, title="Sell Signal", message="SELL: EMA20<EMA50 and RSI<50")
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
