이것은 VWAP, MACD 및 RSI의 삼중 기술 지표에 기반한 양적 거래 전략이다. 이 전략은 VWAP, 이동 평균 동향 분산 지표 (MACD) 및 상대적으로 약한 지표 (RSI) 의 복수의 신호를 결합하여 시장의 매수 기회를 식별한다. 이 전략은 백분율 중지 손실 장치를 사용하여 위험을 관리하고 전략 포지션 관리를 사용하여 자금 사용을 최적화한다.
이 전략의 핵심 논리는 세 가지 주요 지표에 대한 통합 분석에 기초하고 있습니다.
구매 조건은 다음과 같습니다:
판매 조건은 다음과 같습니다:
이 전략은 VWAP, MACD 및 RSI의 세 가지 클래식 기술 지표를 통합하여 비교적 완전한 거래 시스템을 구축합니다. 전략은 설계에서 신호의 신뢰성 및 위험 관리에 초점을 맞추고, 다중 지표 크로스 검증을 통해 거래 품질을 향상시킵니다. 최적화가 필요한 부분이 있지만, 전체적인 프레임 워크는 합리적이며 확장성이 좋습니다.
/*backtest
start: 2024-10-27 00:00:00
end: 2024-11-26 00:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("pbs", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Input for take-profit and stop-loss
takeProfitPercent = input.float(0.5, title="Take Profit (%)", step=0.1) / 100
stopLossPercent = input.float(0.25, title="Stop Loss (%)", step=0.1) / 100
macdFastLength = input.int(12, title="MACD Fast Length")
macdSlowLength = input.int(26, title="MACD Slow Length")
macdSignalLength = input.int(9, title="MACD Signal Length")
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level", step=1)
rsiOversold = input.int(30, title="RSI Oversold Level", step=1)
vwap = ta.vwap(close)
[macdLine, signalLine, _] = ta.macd(close, macdFastLength, macdSlowLength, macdSignalLength)
macdHistogram = macdLine - signalLine
rsi = ta.rsi(close, rsiLength)
plot(vwap, color=color.purple, linewidth=2, title="VWAP")
hline(rsiOverbought, "Overbought", color=color.red, linestyle=hline.style_dotted)
hline(rsiOversold, "Oversold", color=color.green, linestyle=hline.style_dotted)
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
// Buy Condition
longCondition = ta.crossover(close, vwap) and macdHistogram > 0 and rsi < rsiOverbought
// Sell Condition
shortCondition = ta.crossunder(close, vwap) and macdHistogram < 0 and rsi > rsiOversold
// Execute trades based on conditions
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Take Profit/Stop Loss", "Long", limit=close * (1 + takeProfitPercent), stop=close * (1 - stopLossPercent))
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit/Stop Loss", "Short", limit=close * (1 - takeProfitPercent), stop=close * (1 + stopLossPercent))
// Plot Buy/Sell Signals
plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal")
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal")