평균 가격 볼륨 가치 전략


생성 날짜: 2023-12-29 16:31:33 마지막으로 수정됨: 2023-12-29 16:31:33
복사: 0 클릭수: 686
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

평균 가격 볼륨 가치 전략

개요

평균 가격대 거래량 가치 (VWAP) 전략은 특정 시간 동안의 주식의 평균 가격을 추적하는 전략이다. 이 전략은 VWAP를 기준으로 삼아, 가격이 VWAP보다 높거나 낮을 때 포지션을 열거나 다치게 한다. 또한 거래를 관리하기 위해 중지 및 중지 조건을 설정한다.

전략 원칙

이 전략은 먼저 전형적인 가격 (최고 가격, 최저 가격, 그리고 종결 가격의 평균값) 과 거래량 곱셈의 합과 거래량 곱셈의 합을 계산한다. 그리고 거래량 곱셈의 합을 거래량 곱셈으로 나누어서 VWAP 값을 계산한다. 가격이 위쪽으로 VWAP를 통과할 때, 더 많이 하고, 가격이 아래쪽으로 통과할 때, 공백을 만든다.

다중 포지션의 정지 조건은 가격이 입시 가격보다 3% 상승했을 때 정지; 정지 조건은 가격이 입시 가격보다 1% 떨어졌을 때 정지. 공백 포지션도 비슷한 조건이다.

우위 분석

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

  1. VWAP를 거래 신호의 기준으로 삼아 전략의 효율성을 높였습니다.

  2. 동시에 VWP 신호와 스톱로스를 사용하여 트렌드에서 이익을 얻을 수 있고 손실을 줄일 수 있습니다.

  3. 전략적 논리는 간단하고 명확하며, 이해하기 쉽고 구현하기 쉽습니다.

위험 분석

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

  1. VWAP는 미래의 가격을 예측할 수 없기 때문에 VWAP 신호가 지연될 수 있습니다.

  2. 손실을 증가시킬 수 있는 너무 느슨한 중지 조건 설정;

  3. 추적 시간이 길고 거래 신호가 많을수록 실디 효과는 달라질 수 있다.

이러한 위험은 변수를 조정하거나, 손해 중지 알고리즘을 최적화하는 등의 방법으로 감소시킬 수 있다.

최적화 방향

이 전략은 다음과 같은 방향으로 최적화될 수 있습니다.

  1. VWAP 파라미터를 최적화하여 최적의 계산주기를 찾습니다.

  2. 이동식 중지, 지수 이동식 중지 등의 다른 손실 추적 알고리즘을 테스트할 수 있습니다.

  3. VWAP 신호 오류를 방지하기 위해 필터로 다른 지표와 결합 할 수 있습니다. 예를 들어 양력 지표, 브린 밴드 지표 등.

요약하다

전체적으로, 평균 가격 거래량 가치 전략은 VWP의 중요한 지표의 예측력을 활용하여 장기적으로 긍정적 인 수익을 얻을 수 있도록 중지 중지 조건을 설정합니다. 그러나 시장의 변동으로 인한 위험을 줄이고 전략의 수익을 높이기 위해 다른 전략을 더 최적화하고 조합해야합니다.

전략 소스 코드
/*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")