안녕하세요.
다음은 VPVR(Visible Range Volume Profile)지표중 POC(Point of Control) 라인만 구현하고 싶어서 만들었는데
계속 오류가 납니다. 수정 부탁드립니다.
input: rangeStart(1), rangeEnd(100), priceStep(1), priceRange(100);
var: priceVolumeSum(0), maxVolume(0), POC(0);
var: i(0), j(0), tempPrice(0), tempVol(0), tempIdx(0);
array: volumeProfile ; // 배열 크기를 101로 설정하고 초기값을 0으로 설정
// 볼륨 프로파일을 초기화
for i = 0 to 100 begin
volumeProfile[i] = 0;
end;
// 범위 내 각 봉에 대해 볼륨 프로파일을 계산
for i = rangeStart to rangeEnd begin
tempPrice = Close[i];
tempVol = Volume[i];
tempIdx = int((tempPrice - Low[rangeEnd]) / priceStep);
if tempIdx >= 0 and tempIdx <= 100 then
volumeProfile[tempIdx] = volumeProfile[tempIdx] + tempVol;
end;
end;
// 최대 거래량이 발생한 가격(POC)을 찾음
for j = 0 to 100 begin
if volumeProfile[j] > maxVolume then begin
maxVolume = volumeProfile[j];
POC = Low[rangeEnd] + j * priceStep;
end;
end;
// POC를 차트에 라인으로 표시
if POC != 0 then
Plot("POC Line", POC, Gray, 2);
end;
답변 1
예스스탁
예스스탁 답변
2024-06-13 11:09:12
안녕하세요
예스스탁입니다.
input: rangeStart(1), rangeEnd(100), priceStep(1), priceRange(100);
var: priceVolumeSum(0), maxVolume(0), POC(0);
var: i(0), j(0), tempPrice(0), tempVol(0), tempIdx(0);
array: volumeProfile[101](0) ; // 배열 크기를 101로 설정하고 초기값을 0으로 설정
// 볼륨 프로파일을 초기화
for i = 0 to 100 begin
volumeProfile[i] = 0;
end;
// 범위 내 각 봉에 대해 볼륨 프로파일을 계산
for i = rangeStart to rangeEnd
begin
tempPrice = Close[i];
tempVol = Volume[i];
tempIdx = int((tempPrice - Low[rangeEnd]) / priceStep);
if tempIdx >= 0 and tempIdx <= 100 then
Begin
volumeProfile[tempIdx] = volumeProfile[tempIdx] + tempVol;
end;
end;
// 최대 거래량이 발생한 가격(POC)을 찾음
for j = 0 to 100 begin
if volumeProfile[j] > maxVolume then begin
maxVolume = volumeProfile[j];
POC = Low[rangeEnd] + j * priceStep;
end;
end;
// POC를 차트에 라인으로 표시
if POC != 0 then
Plot1(POC,"POC Line", Gray,Def, 2);
즐거운 하루되세요
> cooparoo 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 안녕하세요.
다음은 VPVR(Visible Range Volume Profile)지표중 POC(Point of Control) 라인만 구현하고 싶어서 만들었는데
계속 오류가 납니다. 수정 부탁드립니다.
input: rangeStart(1), rangeEnd(100), priceStep(1), priceRange(100);
var: priceVolumeSum(0), maxVolume(0), POC(0);
var: i(0), j(0), tempPrice(0), tempVol(0), tempIdx(0);
array: volumeProfile ; // 배열 크기를 101로 설정하고 초기값을 0으로 설정
// 볼륨 프로파일을 초기화
for i = 0 to 100 begin
volumeProfile[i] = 0;
end;
// 범위 내 각 봉에 대해 볼륨 프로파일을 계산
for i = rangeStart to rangeEnd begin
tempPrice = Close[i];
tempVol = Volume[i];
tempIdx = int((tempPrice - Low[rangeEnd]) / priceStep);
if tempIdx >= 0 and tempIdx <= 100 then
volumeProfile[tempIdx] = volumeProfile[tempIdx] + tempVol;
end;
end;
// 최대 거래량이 발생한 가격(POC)을 찾음
for j = 0 to 100 begin
if volumeProfile[j] > maxVolume then begin
maxVolume = volumeProfile[j];
POC = Low[rangeEnd] + j * priceStep;
end;
end;
// POC를 차트에 라인으로 표시
if POC != 0 then
Plot("POC Line", POC, Gray, 2);
end;