
이 전략은 RSI (상대적으로 약한 지표) 와 트렌드 평균선을 결합한 이중 필터링 거래 시스템이다. 이 전략은 RSI의 오버 바이 오버 소드 신호와 장기 트렌드 평균선을 결합하여 일선 수준에서 거래한다. 전략의 핵심은 거래의 정확성과 신뢰성을 높이기 위해 전통적인 RSI 거래 신호의 기초에 트렌드 필터를 추가하는 것이다.
이 전략은 다음과 같은 핵심 구성 요소에 기반합니다.
이 전략은 RSI와 트렌드 일률을 결합하여 안정적인 거래 시스템을 구축한다. 전략은 합리적인 설계, 명확한 운영 규칙, 좋은 실용성을 가지고 있다. 합리적인 위험 관리와 지속적인 최적화를 통해 이 전략은 실제 거래에서 안정적인 수익을 올릴 것으로 보인다.
/*backtest
start: 2025-02-13 00:00:00
end: 2025-02-20 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"DOGE_USDT"}]
*/
//@version=5
strategy("Leading Indicator Strategy – Daily Signals", overlay=true,
pyramiding=1, initial_capital=100000,
default_qty_type=strategy.percent_of_equity, default_qty_value=100)
/// **Inputs for Customization**
rsiLength = input.int(14, minval=1, title="RSI Period")
oversold = input.float(30.0, minval=1, maxval=50, title="Oversold Level")
overbought = input.float(70.0, minval=50, maxval=100, title="Overbought Level")
maLength = input.int(200, minval=1, title="Trend MA Period")
useTrendFilter = input.bool(true, title="Use Trend Filter (MA)",
tooltip="Require price above MA for buys and below MA for sells")
/// **Indicator Calculations**
rsiValue = ta.rsi(close, rsiLength) // RSI calculation
trendMA = ta.sma(close, maLength) // Long-term moving average
/// **Signal Conditions** (RSI crosses with optional trend filter)
buySignal = ta.crossover(rsiValue, oversold) // RSI crosses above oversold level
sellSignal = ta.crossunder(rsiValue, overbought) // RSI crosses below overbought level
bullCond = buySignal and (not useTrendFilter or close > trendMA) // final Buy condition
bearCond = sellSignal and (not useTrendFilter or close < trendMA) // final Sell condition
/// **Trade Execution** (entries and exits with alerts)
if bullCond
strategy.close("Short", alert_message="Buy Signal – Closing Short") // close short position if open
strategy.entry("Long", strategy.long, alert_message="Buy Signal – Enter Long") // go long
if bearCond
strategy.close("Long", alert_message="Sell Signal – Closing Long") // close long position if open
strategy.entry("Short", strategy.short, alert_message="Sell Signal – Enter Short") // go short
/// **Plotting** (MA and signal markers for clarity)
plot(trendMA, color=color.orange, linewidth=2, title="Trend MA")
plotshape(bullCond, title="Buy Signal", style=shape.labelup, location=location.belowbar,
color=color.green, text="BUY", textcolor=color.white)
plotshape(bearCond, title="Sell Signal", style=shape.labeldown, location=location.abovebar,
color=color.red, text="SELL", textcolor=color.white)
// (Optional) Plot RSI in a separate pane for reference:
// plot(rsiValue, title="RSI", color=color.blue)
// hline(oversold, title="Oversold", color=color.gray, linestyle=hline.style_dotted)
// hline(overbought, title="Overbought", color=color.gray, linestyle=hline.style_dotted)