//@version=5 strategy(“RSI(6) Buy at 30, EMA(34) Sell with Stop Loss”, overlay=true)
// 변수 설정 rsiPeriod = 6 emaPeriod = 54 buyLevel = 30 positionSize = 0.02
RSI와 EMA를 계산합니다. rsiValue = ta.rsi(close, rsiPeriod) emaValue = ta.ema(close, emaPeriod)
구매 조건: RSI 30 이하 buySignal = ta.crossunder(rsiValue, buyLevel)
판매 조건: EMA 54보다 높습니다. sellSignal = close > emaValue
// 상장 개시 가격 기록 var float entryPrice = na
if (buySignal and strategy.position_size == 0) strategy.entry(“Buy”, strategy.long, qty=positionSize) entryPrice:= close // 구매 시의 오픈 가격을 기록합니다.
// Stop Loss 로직: 0.5%로 설정 if (strategy.position_size > 0) stopLossPrice = entryPrice * 0.995 // 0.5% 스톱로스 if (close <= stopLossPrice) strategy.close ((“Buy”, comment=“Stop Loss”) // 평준화 지점을 막기
EMA 54보다 높을 때 평준화 if (strategy.position_size > 0 and sellSignal) strategy.close(“Buy”, comment=“Take Profit”) // 조건부 평점점