
이 전략은 상대적으로 강하고 약한 지수 ((RSI) 에 기반한 동적 전략으로, 수동으로 정지 (stop) (TP) 와 정지 (stop) (SL) 를 설정하는 기능과 결합된다. 전략의 주요 아이디어는 RSI 지표를 통해 시장의 과매매와 과매매 상태를 포착하는 것이며, 최근 최고 가격과 최저 가격에 대한 일일 마감 가격의 위치를 고려하는 동시에, 진입 시기를 판단하는 것이다.
이 전략은 RSI 동적 지표에 기반한 거래 프레임워크를 제공하며, 수동적인 스톱-로스 기능을 도입하여 거래자가 자신의 위험 선호와 시장 관점에 따라 포지션을 관리 할 수 있습니다. 그러나 전략의 성과는 크게 변수 선택과 시장 상황에 달려 있습니다. 따라서 거래자는 이 전략을 신중하게 사용하고 충분한 피드백과 최적화를 수행하며 다른 형태의 분석과 위험 관리 기술을 결합하여 더 안정적인 거래 성과를 얻습니다.
//@version=5
strategy("RSI Strategy with Manual TP and SL", overlay=true)
// Strategy Parameters
length = input(14, title="RSI Length")
overSold = input(30, title="Oversold Level")
overBought = input(70, title="Overbought Level")
trail_profit_pct = input.float(20, title="Trailing Profit (%)")
// RSI Calculation
vrsi = ta.rsi(close, length)
// Entry Conditions for Long Position
rsi_crossed_below_30 = vrsi > overSold and ta.sma(vrsi, 2) <= overSold // RSI crossed above 30
daily_close_above_threshold = close > (ta.highest(close, 50) * 0.7) // Daily close above 70% of the highest close in the last 50 bars
// Entry Conditions for Short Position
rsi_crossed_above_70 = vrsi < overBought and ta.sma(vrsi, 2) >= overBought // RSI crossed below 70
daily_close_below_threshold = close < (ta.lowest(close, 50) * 1.3) // Daily close below 130% of the lowest close in the last 50 bars
// Entry Signals
if (rsi_crossed_below_30 and daily_close_above_threshold)
strategy.entry("RsiLE", strategy.long, comment="RsiLE")
if (rsi_crossed_above_70 and daily_close_below_threshold)
strategy.entry("RsiSE", strategy.short, comment="RsiSE")
// Manual Take Profit and Stop Loss
tp_percentage = input.float(1, title="Take Profit (%)")
sl_percentage = input.float(1, title="Stop Loss (%)")
long_tp = strategy.position_avg_price * (1 + tp_percentage / 100)
long_sl = strategy.position_avg_price * (1 - sl_percentage / 100)
short_tp = strategy.position_avg_price * (1 - tp_percentage / 100)
short_sl = strategy.position_avg_price * (1 + sl_percentage / 100)
strategy.exit("TP/SL Long", "RsiLE", limit=long_tp, stop=long_sl)
strategy.exit("TP/SL Short", "RsiSE", limit=short_tp, stop=short_sl)