안녕하세요.
거래량 가중 평균 (VWAP) 을 계산하려고 하는데요.
분봉에서 vwap 을 보려고 하는데 계산 값이랑 다른 차트에서 본 값이랑 조금 달라서요.
hlc3 = (h+l+c)/3;
vwap = AccumN(hlc3*Volume, DayIndex) / AccumN(Volume, DayIndex);
다음과 같이 계산 했는데 잘못 된점이 뭔지 알려주시면 감사하겠습니다.
참고로 VWAP 정의는 다음을 참고했습니다.
There are five steps in calculating VWAP:
1. Calculate the Typical Price for the period. [(High + Low + Close)/3)]
2. Multiply the Typical Price by the period Volume (Typical Price x Volume)
3. Create a Cumulative Total of Typical Price. Cumulative(Typical Price x Volume)
4. Create a Cumulative Total of Volume. Cumulative(Volume)
5. Divide the Cumulative Totals.
VWAP = Cumulative(Typical Price x Volume) / Cumulative(Volume)
답변 1
예스스탁
예스스탁 답변
2019-12-30 12:42:31
안녕하세요
예스스탁입니다.
1
inputs : Length(20);
var : Price(0),VSum(0),VWMA(0);
Price = (H+L+C)/3;
VSum = AccumN( v, Length ) ;
VWMA = AccumN( Price * v , Length ) / VSum;
plot1(Vwma);
2
위 식은 최근 N개봉이 기준입니다.
올려주신 수식은 당일평균인데 당일평균값은 아래와 같이 작성하시면 됩니다.
inputs : Length(20);
var : Price(0),VSum(0),PVsum(0),VWMA(0);
Price = (H+L+C)/3;
if Bdate != bdate[1] Then
{
Vsum = 0;
PVsum = 0;
}
VSum = Vsum + V;
PVsum = PVsum + Price*V;
VWMA = PVsum/VSum;
plot1(Vwma);
새해 좋은 일만 가득하시길 기원합니다.
> hiphepho 님이 쓴 글입니다.
> 제목 : 수식 질문 드립니다.
> 안녕하세요.
거래량 가중 평균 (VWAP) 을 계산하려고 하는데요.
분봉에서 vwap 을 보려고 하는데 계산 값이랑 다른 차트에서 본 값이랑 조금 달라서요.
hlc3 = (h+l+c)/3;
vwap = AccumN(hlc3*Volume, DayIndex) / AccumN(Volume, DayIndex);
다음과 같이 계산 했는데 잘못 된점이 뭔지 알려주시면 감사하겠습니다.
참고로 VWAP 정의는 다음을 참고했습니다.
There are five steps in calculating VWAP:
1. Calculate the Typical Price for the period. [(High + Low + Close)/3)]
2. Multiply the Typical Price by the period Volume (Typical Price x Volume)
3. Create a Cumulative Total of Typical Price. Cumulative(Typical Price x Volume)
4. Create a Cumulative Total of Volume. Cumulative(Volume)
5. Divide the Cumulative Totals.
VWAP = Cumulative(Typical Price x Volume) / Cumulative(Volume)