커뮤니티
5분봉챠트에서 10분봉,20분봉의 값 구하기
2011-10-31 16:20:17
517
글번호 44296
안녕하십니까?
5분봉챠트에서 10분봉, 20분봉의 시가,종가,고가,저가를 구하고자 합니다.
idx10 = TimeToMinutes(stime)%10;
idx20 = TimeToMinutes(stime)%20;
if dayindex == 0 Then {
idx5 = 0; idx10 = 0; idx20 = 0;
cnt5 = 0; cnt10 = 0; cnt20 = 0;
}
if dayindex == 0 or (idx10 <= idx10[1] and stime > stime[1]) Then{
O10[cnt10] = O;
C10[cnt10] = C;
H10[cnt10] = H;
L10[cnt10] = L;
cnt10 = cnt10 + 1;
}
if dayindex == 0 or (idx20 <= idx20[1] and stime > stime[1]) Then{
O20[cnt20] = O;
C20[cnt20] = C;
H20[cnt20] = H;
L20[cnt20] = L;
cnt20 = cnt20 + 1;
}
이때 가령 09:20분 또는 09:40분에서 10분봉과 20분봉의 시가, 종가, 고가, 저가 값이
동일하게 출력됩니다.
문제점을 지적해 주시기 바랍니다.
답변 4
예스스탁 예스스탁 답변
2011-10-31 17:24:58
안녕하세요
예스스탁입니다.
작성하신 식에 초기화만 있고
고가와 저가 갱신하는 내용이 없습니다.
식을 수정했습니다.
var : idx10(0),idx20(0),cnt10(0),cnt20(0);
Array : O10[200](0),H10[200](0),L10[200](0),C10[200](0);
Array : O20[200](0),H20[200](0),L20[200](0),C20[200](0);
idx10 = TimeToMinutes(stime)%10;
idx20 = TimeToMinutes(stime)%20;
if dayindex == 0 Then {
cnt10 = 0;
cnt20 = 0;
}
if dayindex == 0 or (idx10 <= idx10[1] and stime > stime[1]) Then{
cnt10 = cnt10 + 1;
O10[cnt10] = O;
H10[cnt10] = H;
L10[cnt10] = L;
C10[cnt10] = C;
}
if H > H10[cnt10] Then
H10[cnt10] = H;
if L < L10[cnt10] Then
L10[cnt10] = L;
C10[cnt10] = C;
if dayindex == 0 or (idx20 <= idx20[1] and stime > stime[1]) Then{
cnt20 = cnt20 + 1;
O20[cnt20] = O;
H20[cnt20] = H;
L20[cnt20] = L;
C20[cnt20] = C;
}
if H > H20[cnt20] Then
H20[cnt20] = H;
if L < L20[cnt20] Then
L20[cnt20] = L;
C20[cnt10] = C;
plot1(H10[cnt10]);
plot2(L10[cnt10]);
plot3(H20[cnt20]);
plot4(L20[cnt20]);
즐거운 하루되세요
> 사하라 님이 쓴 글입니다.
> 제목 : 5분봉챠트에서 10분봉,20분봉의 값 구하기
> 안녕하십니까?
5분봉챠트에서 10분봉, 20분봉의 시가,종가,고가,저가를 구하고자 합니다.
idx10 = TimeToMinutes(stime)%10;
idx20 = TimeToMinutes(stime)%20;
if dayindex == 0 Then {
idx5 = 0; idx10 = 0; idx20 = 0;
cnt5 = 0; cnt10 = 0; cnt20 = 0;
}
if dayindex == 0 or (idx10 <= idx10[1] and stime > stime[1]) Then{
O10[cnt10] = O;
C10[cnt10] = C;
H10[cnt10] = H;
L10[cnt10] = L;
cnt10 = cnt10 + 1;
}
if dayindex == 0 or (idx20 <= idx20[1] and stime > stime[1]) Then{
O20[cnt20] = O;
C20[cnt20] = C;
H20[cnt20] = H;
L20[cnt20] = L;
cnt20 = cnt20 + 1;
}
이때 가령 09:20분 또는 09:40분에서 10분봉과 20분봉의 시가, 종가, 고가, 저가 값이
동일하게 출력됩니다.
문제점을 지적해 주시기 바랍니다.
회원
2011-10-31 17:49:42
회원 님에 의해 삭제된 답변입니다.
회원
2011-10-31 17:52:36
회원 님에 의해 삭제된 답변입니다.
예스스탁 예스스탁 답변
2011-10-31 18:13:18
안녕하세요
예스스탁입니다.
var : idx10(0),idx20(0),cnt10(0),cnt20(0),cnt(0);
Array : O10[200](0),H10[200](0),L10[200](0),C10[200](0);
Array : O20[200](0),H20[200](0),L20[200](0),C20[200](0);
idx10 = TimeToMinutes(stime)%10;
idx20 = TimeToMinutes(stime)%20;
if dayindex == 0 or (idx10 <= idx10[1] and stime > stime[1]) Then{
O10[0] = O;
H10[0] = H;
L10[0] = L;
C10[0] = C;
for cnt = 1 to 100{
O10[cnt] = O10[cnt-1][1];
H10[cnt] = H10[cnt-1][1];
L10[cnt] = L10[cnt-1][1];
C10[cnt] = C10[cnt-1][1];
}
}
if H > H10[0] Then
H10[0] = H;
if L < L10[0] Then
L10[0] = L;
C10[0] = C;
if dayindex == 0 or (idx20 <= idx20[1] and stime > stime[1]) Then{
O20[0] = O;
H20[0] = H;
L20[0] = L;
C20[0] = C;
for cnt = 1 to 100{
O20[cnt] = O20[cnt-1][1];
H20[cnt] = H20[cnt-1][1];
L20[cnt] = L20[cnt-1][1];
C20[cnt] = C20[cnt-1][1];
}
}
if H > H20[0] Then
H20[0] = H;
if L < L20[0] Then
L20[0] = L;
C20[0] = C;
plot1(H10[0]);
plot2(L10[0]);
plot3(H20[0]);
plot4(L20[0]);
MessageLog("H10 %.2f H20 %.2f L10 %.2f L20 %.2f",H10[0],H20[0],L10[0],L20[0]);
차트와 메세지로그 모두 정상출력 확인했습니다.
가령 H10[0]은 현재, 1봉전은 H10[1], 두봉전은 H10[2]와 같이 모든 변수 사용하시면 됩니다.
이전 값은 필요한 봉수 만큼 for문 횟수를 줄여주셔서 사용하시면
수식의 가독성이 높아집니다.
즐거운 하루되세요
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 5분봉챠트에서 10분봉,20분봉의 값 구하기
> 안녕하세요
예스스탁입니다.
작성하신 식에 초기화만 있고
고가와 저가 갱신하는 내용이 없습니다.
식을 수정했습니다.
var : idx10(0),idx20(0),cnt10(0),cnt20(0);
Array : O10[200](0),H10[200](0),L10[200](0),C10[200](0);
Array : O20[200](0),H20[200](0),L20[200](0),C20[200](0);
idx10 = TimeToMinutes(stime)%10;
idx20 = TimeToMinutes(stime)%20;
if dayindex == 0 Then {
cnt10 = 0;
cnt20 = 0;
}
if dayindex == 0 or (idx10 <= idx10[1] and stime > stime[1]) Then{
cnt10 = cnt10 + 1;
O10[cnt10] = O;
H10[cnt10] = H;
L10[cnt10] = L;
C10[cnt10] = C;
}
if H > H10[cnt10] Then
H10[cnt10] = H;
if L < L10[cnt10] Then
L10[cnt10] = L;
C10[cnt10] = C;
if dayindex == 0 or (idx20 <= idx20[1] and stime > stime[1]) Then{
cnt20 = cnt20 + 1;
O20[cnt20] = O;
H20[cnt20] = H;
L20[cnt20] = L;
C20[cnt20] = C;
}
if H > H20[cnt20] Then
H20[cnt20] = H;
if L < L20[cnt20] Then
L20[cnt20] = L;
C20[cnt10] = C;
plot1(H10[cnt10]);
plot2(L10[cnt10]);
plot3(H20[cnt20]);
plot4(L20[cnt20]);
즐거운 하루되세요
> 사하라 님이 쓴 글입니다.
> 제목 : 5분봉챠트에서 10분봉,20분봉의 값 구하기
> 안녕하십니까?
5분봉챠트에서 10분봉, 20분봉의 시가,종가,고가,저가를 구하고자 합니다.
idx10 = TimeToMinutes(stime)%10;
idx20 = TimeToMinutes(stime)%20;
if dayindex == 0 Then {
idx5 = 0; idx10 = 0; idx20 = 0;
cnt5 = 0; cnt10 = 0; cnt20 = 0;
}
if dayindex == 0 or (idx10 <= idx10[1] and stime > stime[1]) Then{
O10[cnt10] = O;
C10[cnt10] = C;
H10[cnt10] = H;
L10[cnt10] = L;
cnt10 = cnt10 + 1;
}
if dayindex == 0 or (idx20 <= idx20[1] and stime > stime[1]) Then{
O20[cnt20] = O;
C20[cnt20] = C;
H20[cnt20] = H;
L20[cnt20] = L;
cnt20 = cnt20 + 1;
}
이때 가령 09:20분 또는 09:40분에서 10분봉과 20분봉의 시가, 종가, 고가, 저가 값이
동일하게 출력됩니다.
문제점을 지적해 주시기 바랍니다.
다음글
이전글