부피 가중된 평균 가격 전략

저자:차오장, 날짜: 2023-12-29 16:31:33
태그:

img

전반적인 설명

볼륨 가중화 평균 가격 (Volume Weighted Average Price, VWAP) 전략은 특정 시간 동안 주식의 평균 가격을 추적하는 전략이다. 전략은 VWAP를 기준으로 사용하고 가격이 VWAP 이상 또는 아래에 넘어가면 긴 또는 짧은 포지션을 취한다. 또한 거래를 관리하기 위해 스톱 로스 및 수익 조건을 설정한다.

전략 논리

이 전략은 먼저 전형적인 가격 (고위, 낮은 가격 및 가까운 가격의 평균) 을 부피와 부피의 합으로 곱하여 계산합니다. 그 다음 VWAP는 전형적인 가격-용량 제품의 합을 부피의 합으로 나누면서 계산됩니다. 가격이 VWAP를 넘을 때 길게 이동합니다. 가격이 아래로 넘을 때 짧게 이동합니다.

긴 포지션의 이익 취득 조건은 가격이 입상 가격보다 3% 상승할 때 닫을 것입니다. Stop loss 조건은 가격이 입상 가격보다 1% 떨어질 때입니다. 짧은 포지션에도 비슷한 조건이 적용됩니다.

이점 분석

VWAP 전략의 주요 장점은 다음과 같습니다.

  1. 잘 알려진 VWAP 통계를 거래 신호의 기준으로 사용하여 전략을 더 효과적입니다.

  2. Vwap 신호와 스톱 로스/이익 취득을 모두 활용하여 트렌드로부터 이익을 얻고 손실을 제한할 수 있습니다.

  3. 단순하고 명확한 논리, 이해하기 쉽고 실행하기 쉽습니다.

위험 분석

이 전략에는 몇 가지 위험도 있습니다.

  1. VWAP는 미래의 가격을 예측할 수 없으므로 신호가 지연될 수 있습니다.

  2. 스톱 로즈는 너무 넓어 잠재적인 손실을 증가시킬 수 있습니다.

  3. 더 긴 백테스트는 더 많은 신호를 의미합니다. 실제 성능은 다를 수 있습니다.

이러한 위험은 매개 변수 조정, 스톱 로스 알고리즘 최적화 등으로 감소될 수 있습니다.

최적화 방향

전략을 최적화하는 몇 가지 방법은 다음과 같습니다.

  1. 가장 좋은 계산 기간을 찾기 위해 VWAP 매개 변수를 최적화합니다.

  2. 다른 추적 정지 알고리즘을 테스트합니다. 예를 들어 이동 평균 정지, 파라볼 SAR.

  3. VWAP 신호를 필터링하기 위해 다른 지표를 결합합니다. 예를 들어 볼링거 밴드 (Bollinger Bands).

결론

요약하자면, VWAP 전략은 이 중요한 통계자료의 예측력을 활용하고, 장기적 긍정적 인 기대를 달성하기 위해 손해를 멈추고/이익을 취합니다. 그러나 더 큰 수익성을 위해 시장 변동 위험을 줄이기 위해 추가 최적화 및 다른 전략과 결합이 필요합니다.


/*backtest
start: 2023-11-28 00:00:00
end: 2023-12-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("VWAP Strategy by Royce Mars", overlay=true)

cumulativePeriod = input(14, "Period")

var float cumulativeTypicalPriceVolume = 0.0
var float cumulativeVolume = 0.0

typicalPrice = (high + low + close) / 3
typicalPriceVolume = typicalPrice * volume
cumulativeTypicalPriceVolume := cumulativeTypicalPriceVolume + typicalPriceVolume
cumulativeVolume := cumulativeVolume + volume
vwapValue = cumulativeTypicalPriceVolume / cumulativeVolume

// Buy condition: Price crosses over VWAP
buyCondition = crossover(close, vwapValue)

// Short condition: Price crosses below VWAP
shortCondition = crossunder(close, vwapValue)

// Profit-taking condition for long positions: Sell long position when profit reaches 3%
profitTakingLongCondition = close / strategy.position_avg_price >= 1.03

// Profit-taking condition for short positions: Cover short position when profit reaches 3%
profitTakingShortCondition = close / strategy.position_avg_price <= 0.97

// Stop loss condition for long positions: Sell long position when loss reaches 1%
stopLossLongCondition = close / strategy.position_avg_price <= 0.99

// Stop loss condition for short positions: Cover short position when loss reaches 1%
stopLossShortCondition = close / strategy.position_avg_price >= 1.01

// Strategy Execution
strategy.entry("Buy", strategy.long, when=buyCondition)
strategy.close("Buy", when=shortCondition or profitTakingLongCondition or stopLossLongCondition)

strategy.entry("Short", strategy.short, when=shortCondition)
strategy.close("Short", when=buyCondition or profitTakingShortCondition or stopLossShortCondition)

// Plot VWAP on the chart
plot(vwapValue, color=color.blue, title="VWAP")


더 많은