
이 전략은 거래량 가중 평균 가격 (VWAP) 과 이동 평균 동향 분산 (MACD) 을 결합한 정량 거래 전략이다. 이 전략은 가격 운동 지표와 거래량 가중치를 결합하여 시장 추세 방향에 따라 최적의 입출시기를 찾는다. 전략은 VWAP를 중요한 가격 참조 수준으로 사용하고, 동시에 MACD 지표를 사용하여 시장 운동의 변화를 포착하여 거래에서 더 정확한 구매 및 판매 위치를 구현한다.
전략의 핵심 논리는 다음과 같은 핵심 요소에 기초합니다.
VWAP-MACD 이중 지표 전략은 거래량 중화 및 동력 분석을 결합하여 거래 의사 결정에 대한 신뢰할 수있는 기술 지원을 제공합니다. 전략은 합리적이고 논리적으로 명확하며 실용성과 확장성을 갖추고 있습니다. 지속적인 최적화 및 위험 관리의 개선을 통해 전략은 실제 거래에서 안정적인 수익을 얻을 수 있습니다.
/*backtest
start: 2025-01-08 00:00:00
end: 2025-02-06 08:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("VWAP + MACD Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=200)
// VWAP Calculation
vwapValue = ta.vwap(close)
// MACD Settings
fastLength = input.int(12, title="MACD Fast Length")
slowLength = input.int(26, title="MACD Slow Length")
signalSmoothing = input.int(9, title="MACD Signal Smoothing")
// MACD Calculation
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)
macdHistogram = macdLine - signalLine
// Plot VWAP
plot(vwapValue, color=color.orange, title="VWAP")
// Plot MACD
hline(0, "Zero Line", color=color.gray)
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.red, title="Signal Line")
plot(macdHistogram, color=(macdHistogram >= 0 ? color.green : color.red), style=plot.style_histogram, title="MACD Histogram")
// Long Condition: MACD crosses above Signal and price is above VWAP
longCondition = ta.crossover(macdLine, signalLine) and close > vwapValue
if (longCondition)
strategy.entry("Long", strategy.long)
// Short Condition: MACD crosses below Signal and price is below VWAP
shortCondition = ta.crossunder(macdLine, signalLine) and close < vwapValue
if (shortCondition)
strategy.entry("Short", strategy.short)
// Exit Long: MACD crosses below Signal or price crosses below VWAP
exitLong = ta.crossunder(macdLine, signalLine) or close < vwapValue
if (exitLong)
strategy.close("Long")
// Exit Short: MACD crosses above Signal or price crosses above VWAP
exitShort = ta.crossover(macdLine, signalLine) or close > vwapValue
if (exitShort)
strategy.close("Short")