
이 전략은 윌리엄스 지표 ((%R), 이동 평균 트렌드 지표 ((MACD) 및 지수 이동 평균 ((EMA) 를 기반으로 한 다중 지표 조합 전략이다. 시장의 과매매 상태를 판단하여 동력 지표의 변화 추세와 평행선 지지를 결합하여 전체 트렌드 추적 거래 시스템을 구축한다. 이 전략은 입시 신호의 생성뿐만 아니라 완벽한 위험 관리 장치를 설계했다.
이 전략은 다음의 세 가지 핵심 지표에 기반을 두고 있습니다.
전략은 위의 세 가지 조건을 동시에 충족시킬 때만 입장을 열 수 있습니다. 또한, 전략은 리스크 수익률 기반의 중지 중지 손실 메커니즘을 포함합니다. 고정된 중지 손실 비율과 리스크 수익률을 설정하여 각 거래의 위험을 제어합니다.
이 전략은 다중 기술 지표의 협동 협동으로, 비교적 완벽한 트렌드 추적 거래 시스템을 구축한다. 전략의 주요 특징은 신호 신뢰도가 높고, 위험 제어 명확하지만, 또한 약간의 낙후성 및 변수 감수성 문제가 있다. 제안 된 최적화 방향에 의해, 전략에는 추가로 향상 할 여지가 있다. 실장 적용 시, 먼저 재검토를 통해 충분히 검증 된 변수 포지션을 제안하고, 시장 특성과 결합하여 타깃적 최적화를 수행한다.
/*backtest
start: 2025-02-19 00:00:00
end: 2025-02-23 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
//@version=5
strategy("Williams %R & MACD Swing Strategy", overlay=true)
// INPUTS
length_wpr = input(14, title="Williams %R Length")
overbought = input(-20, title="Overbought Level")
oversold = input(-80, title="Oversold Level")
// MACD Inputs
fastLength = input(12, title="MACD Fast Length")
slowLength = input(26, title="MACD Slow Length")
signalSmoothing = input(9, title="MACD Signal Smoothing")
// EMA for Trend Confirmation
ema_length = input(55, title="EMA Length")
ema55 = ta.ema(close, ema_length)
// INDICATORS
wpr = ta.wpr(length_wpr)
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)
// LONG ENTRY CONDITIONS
longCondition = ta.crossover(wpr, oversold) and ta.crossover(macdLine, signalLine) and close > ema55
if longCondition
strategy.entry("Long", strategy.long)
// SHORT ENTRY CONDITIONS
shortCondition = ta.crossunder(wpr, overbought) and ta.crossunder(macdLine, signalLine) and close < ema55
if shortCondition
strategy.entry("Short", strategy.short)
// RISK MANAGEMENT
riskRewardRatio = input(1.5, title="Risk-Reward Ratio")
stopLossPerc = input(2, title="Stop Loss %") / 100
takeProfitPerc = stopLossPerc * riskRewardRatio
longSL = strategy.position_avg_price * (1 - stopLossPerc)
longTP = strategy.position_avg_price * (1 + takeProfitPerc)
shortSL = strategy.position_avg_price * (1 + stopLossPerc)
shortTP = strategy.position_avg_price * (1 - takeProfitPerc)
strategy.exit("Take Profit / Stop Loss", from_entry="Long", loss=longSL, profit=longTP)
strategy.exit("Take Profit / Stop Loss", from_entry="Short", loss=shortSL, profit=shortTP)