
이것은 상대적으로 강한 지표 ((RSI) 를 기반으로 한 동적 거래 전략이며, 유연한 손실 메커니즘을 결합합니다. 이 전략은 시장의 과매매 지역을 대상으로 거래하며, 가격의 반동 기회를 포착하여 수익을 얻습니다. 전략의 핵심은 RSI 지표를 통해 잠재적인 과매매 상태를 식별하고, 포지션을 구축한 후 백분율 스톱을 사용하여 위험을 제어하며, 상기 고점을 돌파하는 것과 결합하여 수익이 끝난 신호입니다.
이 전략은 다음과 같은 몇 가지 핵심 요소에 기반을 두고 있습니다.
이것은 잘 설계된 거래 전략이며, RSI 과잉 판매 판단과 손해 중지 메커니즘을 결합하여 위험 제어와 수익 기회의 포착 사이의 균형이 잘 잡힌다. 전략은 조정성이 강하며, 다양한 시장 환경에서 매개 변수를 최적화하여 성능을 향상시키는 데 적합하다. 약간의 잠재적인 위험이 있지만, 제안된 최적화 방향을 통해 전략의 안정성과 수익성을 더욱 향상시킬 수 있다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("RSI Strategy with Adjustable RSI and Stop-Loss", overlay=false,
default_qty_type=strategy.fixed, default_qty_value=2,
initial_capital=10000, pyramiding=2,
commission_type=strategy.commission.percent, commission_value=0.05,
slippage=1)
// Input fields for RSI parameters
rsi_length = input.int(8, title="RSI Length", minval=1)
rsi_threshold = input.float(28, title="RSI Threshold", minval=1, maxval=50)
// Input for Stop-Loss percentage
stop_loss_percent = input.float(5, title="Stop-Loss Percentage", minval=0.1, maxval=100)
// Calculate the RSI
rsi = ta.rsi(close, rsi_length)
// Condition for buying: RSI below the defined threshold
buyCondition = rsi < rsi_threshold
// Condition for selling: Close price higher than yesterday's high
sellCondition = close > ta.highest(high, 1)[1]
// Calculate the Stop-Loss level based on the entry price
var float stop_loss_level = na
if (buyCondition)
stop_loss_level := close * (1 - stop_loss_percent / 100)
strategy.entry("Long", strategy.long)
// Create Stop-Loss order
strategy.exit("Stop-Loss", from_entry="Long", stop=stop_loss_level)
// Selling signal
if (sellCondition)
strategy.close("Long")
// Optional: Plot the RSI for visualization
plot(rsi, title="RSI", color=color.blue)
hline(rsi_threshold, "RSI Threshold", color=color.red)