커뮤니티
문의드립니다
2015-04-22 12:18:17
202
글번호 85298
아래 지표에 추세방향전환 지점 꼭지점에있는 켄들에 가격(고가.저가.종가.시가)을
해당 켄들부터 수평으로,다음 추세전환전까지 표시하는 라인을 아래지표에 추가 부탁드립니다
Input:전환율(0.5);
Var:j(0),상승(100),하락(-100),상승률(0),하락률(0),기준고(0),기준저(0),
기준고Bar(0),기준저Bar(0),추세(0),ZZ(0),TL1(0),TL2(0);
Array:고[20](0),저[20](0),고Bar[20](0),저Bar[20](0),고Idx[20](0),저Idx[20](0);
상승률 = 1 + (전환율/100);
하락률 = 1 - (전환율/100);
#---------------------------------------------------------#
# Index()와 마찬가지로 1봉이 바뀔 때마다 1씩 증가
#---------------------------------------------------------#
for j = 1 to 19 {
고Bar[j] = 고Bar[j] + 1;
저Bar[j] = 저Bar[j] + 1;
고Idx[j] = Index - 고Bar[j];
저Idx[j] = Index - 저Bar[j];
}
#---------------------------------------------------------#
# 최근 고,저 갱신
#---------------------------------------------------------#
if 기준고 <= H or 기준고 == 0 then {
기준고 = H;
기준고Bar = 0;
}
else
기준고Bar = 기준고Bar + 1;
if 기준저 >= L or 기준저 == 0 then {
기준저 = L;
기준저Bar = 0;
}
else
기준저Bar = 기준저Bar + 1;
#---------------------------------------------------------#
# 파동 계산 Main
#---------------------------------------------------------#
if 기준고 * 하락률 <= H[1] and 기준고 * 하락률 > H then
추세 = 하락;
else if 기준저 * 상승률 >= L[1] and 기준저 * 상승률 < L then
추세 = 상승;
if 추세[1] == 상승 and 추세 == 하락 then {
for j = 18 downto 1 {
고[j+1] = 고[j];
고Bar[j+1] = 고Bar[j];
고Idx[j+1] = 고Idx[j];
}
고[1] = 기준고;
고Bar[1] = 기준고Bar;
고Idx[1] = Index - 고Bar[1];
ZZ = 기준고;
기준고 = H;
기준고Bar = 0;
기준저 = L;
기준저Bar = 0;
}
if 추세[1] == 하락 and 추세 == 상승 then {
for j = 18 downto 1 {
저[j+1] = 저[j];
저Bar[j+1] = 저Bar[j];
저Idx[j+1] = 저Idx[j];
}
저[1] = 기준저;
저Bar[1] = 기준저Bar;
저Idx[1] = Index - 저Bar[1];
ZZ = 기준저;
기준저 = L;
기준저Bar = 0;
기준고 = H;
기준고Bar = 0;
}
if ZZ[1] != ZZ then {
if 추세 == 상승 Then{
TL1 = TL_New(sdate[고bar[1]],stime[고bar[1]],고[1],sdate[저bar[1]],stime[저bar[1]],저[1]);
TL_SetColor(TL1,BLUE);
}
if 추세 == 하락 Then{
TL1 = TL_New(sdate[저bar[1]],stime[저bar[1]],저[1],sdate[고bar[1]],stime[고bar[1]],고[1]);
TL_SetColor(TL1,RED);
}
}
TL_Delete(TL2);
if ZZ[1] == ZZ then {
if 추세 == 상승 Then{
TL2 = TL_New(sdate[저bar[1]],stime[저bar[1]],저[1],sdate,stime,c);
TL_SetColor(TL2,RED);
}
if 추세 == 하락 Then{
TL2 = TL_New(sdate[고bar[1]],stime[고bar[1]],고[1],sdate,stime,c);
TL_SetColor(TL2,BLUE);
}
}
답변 1
예스스탁 예스스탁 답변
2015-04-22 15:53:19
안녕하세요
예스스탁입니다.
Input:전환율(0.5);
Var:j(0),상승(100),하락(-100),상승률(0),하락률(0),기준고(0),기준저(0),
기준고Bar(0),기준저Bar(0),추세(0),ZZ(0),TL1(0),TL2(0);
var : TL11(0),TL12(0),TL13(0),TL14(0);
var : TL21(0),TL22(0),TL23(0),TL24(0);
Array:고[20](0),저[20](0),고Bar[20](0),저Bar[20](0),고Idx[20](0),저Idx[20](0);
상승률 = 1 + (전환율/100);
하락률 = 1 - (전환율/100);
#---------------------------------------------------------#
# Index()와 마찬가지로 1봉이 바뀔 때마다 1씩 증가
#---------------------------------------------------------#
for j = 1 to 19 {
고Bar[j] = 고Bar[j] + 1;
저Bar[j] = 저Bar[j] + 1;
고Idx[j] = Index - 고Bar[j];
저Idx[j] = Index - 저Bar[j];
}
#---------------------------------------------------------#
# 최근 고,저 갱신
#---------------------------------------------------------#
if 기준고 <= H or 기준고 == 0 then {
기준고 = H;
기준고Bar = 0;
}
else
기준고Bar = 기준고Bar + 1;
if 기준저 >= L or 기준저 == 0 then {
기준저 = L;
기준저Bar = 0;
}
else
기준저Bar = 기준저Bar + 1;
#---------------------------------------------------------#
# 파동 계산 Main
#---------------------------------------------------------#
if 기준고 * 하락률 <= H[1] and 기준고 * 하락률 > H then
추세 = 하락;
else if 기준저 * 상승률 >= L[1] and 기준저 * 상승률 < L then
추세 = 상승;
if 추세[1] == 상승 and 추세 == 하락 then {
for j = 18 downto 1 {
고[j+1] = 고[j];
고Bar[j+1] = 고Bar[j];
고Idx[j+1] = 고Idx[j];
}
고[1] = 기준고;
고Bar[1] = 기준고Bar;
고Idx[1] = Index - 고Bar[1];
ZZ = 기준고;
기준고 = H;
기준고Bar = 0;
기준저 = L;
기준저Bar = 0;
}
if 추세[1] == 하락 and 추세 == 상승 then {
for j = 18 downto 1 {
저[j+1] = 저[j];
저Bar[j+1] = 저Bar[j];
저Idx[j+1] = 저Idx[j];
}
저[1] = 기준저;
저Bar[1] = 기준저Bar;
저Idx[1] = Index - 저Bar[1];
ZZ = 기준저;
기준저 = L;
기준저Bar = 0;
기준고 = H;
기준고Bar = 0;
}
if ZZ[1] != ZZ then {
if 추세 == 상승 Then{
TL1 = TL_New(sdate[고bar[1]],stime[고bar[1]],고[1],sdate[저bar[1]],stime[저bar[1]],저[1]);
TL_SetColor(TL1,BLUE);
TL11 = TL_New(sdate[고bar[1]],stime[고bar[1]],O[고bar[1]],sdate[저bar[1]],stime[저bar[1]],O[고bar[1]]);
if H[고bar[1]] > max(O[고bar[1]],C[고bar[1]]) Then
TL12 = TL_New(sdate[고bar[1]],stime[고bar[1]],H[고bar[1]],sdate[저bar[1]],stime[저bar[1]],h[고bar[1]]);
if L[고bar[1]] < min(O[고bar[1]],C[고bar[1]]) Then
TL13 = TL_New(sdate[고bar[1]],stime[고bar[1]],L[고bar[1]],sdate[저bar[1]],stime[저bar[1]],L[고bar[1]]);
TL14 = TL_New(sdate[고bar[1]],stime[고bar[1]],c[고bar[1]],sdate[저bar[1]],stime[저bar[1]],c[고bar[1]]);
}
if 추세 == 하락 Then{
TL1 = TL_New(sdate[저bar[1]],stime[저bar[1]],저[1],sdate[고bar[1]],stime[고bar[1]],고[1]);
TL_SetColor(TL1,RED);
TL11 = TL_New(sdate[저bar[1]],stime[저bar[1]],O[저bar[1]],sdate[고bar[1]],stime[고bar[1]],O[저bar[1]]);
if H[저bar[1]] > max(O[저bar[1]],C[저bar[1]]) Then
TL12 = TL_New(sdate[저bar[1]],stime[저bar[1]],h[저bar[1]],sdate[고bar[1]],stime[고bar[1]],h[저bar[1]]);
if L[저bar[1]] < min(O[저bar[1]],C[저bar[1]]) Then
TL13 = TL_New(sdate[저bar[1]],stime[저bar[1]],l[저bar[1]],sdate[고bar[1]],stime[고bar[1]],l[저bar[1]]);
TL14 = TL_New(sdate[저bar[1]],stime[저bar[1]],c[저bar[1]],sdate[고bar[1]],stime[고bar[1]],c[저bar[1]]);
}
}
TL_Delete(TL2);
TL_Delete(TL21);
TL_Delete(TL22);
TL_Delete(TL23);
TL_Delete(TL24);
if ZZ[1] == ZZ then {
if 추세 == 상승 Then{
TL2 = TL_New(sdate[저bar[1]],stime[저bar[1]],저[1],sdate,stime,c);
TL_SetColor(TL2,RED);
TL21 = TL_New(sdate[저bar[1]],stime[저bar[1]],O[저bar[1]],sdate,stime,O[저bar[1]]);
if H[저bar[1]] > max(O[저bar[1]],C[저bar[1]]) Then
TL22 = TL_New(sdate[저bar[1]],stime[저bar[1]],h[저bar[1]],sdate,stime,h[저bar[1]]);
if L[저bar[1]] < min(O[저bar[1]],C[저bar[1]]) Then
TL23 = TL_New(sdate[저bar[1]],stime[저bar[1]],l[저bar[1]],sdate,stime,l[저bar[1]]);
TL24 = TL_New(sdate[저bar[1]],stime[저bar[1]],c[저bar[1]],sdate,stime,c[저bar[1]]);
}
if 추세 == 하락 Then{
TL2 = TL_New(sdate[고bar[1]],stime[고bar[1]],고[1],sdate,stime,c);
TL_SetColor(TL2,BLUE);
TL21 = TL_New(sdate[고bar[1]],stime[고bar[1]],O[고bar[1]],sdate,stime,O[고bar[1]]);
if H[고bar[1]] > max(O[고bar[1]],C[고bar[1]]) Then
TL22 = TL_New(sdate[고bar[1]],stime[고bar[1]],H[고bar[1]],sdate,stime,h[고bar[1]]);
if L[고bar[1]] < min(O[고bar[1]],C[고bar[1]]) Then
TL23 = TL_New(sdate[고bar[1]],stime[고bar[1]],L[고bar[1]],sdate,stime,L[고bar[1]]);
TL24 = TL_New(sdate[고bar[1]],stime[고bar[1]],c[고bar[1]],sdate,stime,c[고bar[1]]);
}
}
즐거운 하루되세요
> 해피데이m 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 아래 지표에 추세방향전환 지점 꼭지점에있는 켄들에 가격(고가.저가.종가.시가)을
해당 켄들부터 수평으로,다음 추세전환전까지 표시하는 라인을 아래지표에 추가 부탁드립니다
Input:전환율(0.5);
Var:j(0),상승(100),하락(-100),상승률(0),하락률(0),기준고(0),기준저(0),
기준고Bar(0),기준저Bar(0),추세(0),ZZ(0),TL1(0),TL2(0);
Array:고[20](0),저[20](0),고Bar[20](0),저Bar[20](0),고Idx[20](0),저Idx[20](0);
상승률 = 1 + (전환율/100);
하락률 = 1 - (전환율/100);
#---------------------------------------------------------#
# Index()와 마찬가지로 1봉이 바뀔 때마다 1씩 증가
#---------------------------------------------------------#
for j = 1 to 19 {
고Bar[j] = 고Bar[j] + 1;
저Bar[j] = 저Bar[j] + 1;
고Idx[j] = Index - 고Bar[j];
저Idx[j] = Index - 저Bar[j];
}
#---------------------------------------------------------#
# 최근 고,저 갱신
#---------------------------------------------------------#
if 기준고 <= H or 기준고 == 0 then {
기준고 = H;
기준고Bar = 0;
}
else
기준고Bar = 기준고Bar + 1;
if 기준저 >= L or 기준저 == 0 then {
기준저 = L;
기준저Bar = 0;
}
else
기준저Bar = 기준저Bar + 1;
#---------------------------------------------------------#
# 파동 계산 Main
#---------------------------------------------------------#
if 기준고 * 하락률 <= H[1] and 기준고 * 하락률 > H then
추세 = 하락;
else if 기준저 * 상승률 >= L[1] and 기준저 * 상승률 < L then
추세 = 상승;
if 추세[1] == 상승 and 추세 == 하락 then {
for j = 18 downto 1 {
고[j+1] = 고[j];
고Bar[j+1] = 고Bar[j];
고Idx[j+1] = 고Idx[j];
}
고[1] = 기준고;
고Bar[1] = 기준고Bar;
고Idx[1] = Index - 고Bar[1];
ZZ = 기준고;
기준고 = H;
기준고Bar = 0;
기준저 = L;
기준저Bar = 0;
}
if 추세[1] == 하락 and 추세 == 상승 then {
for j = 18 downto 1 {
저[j+1] = 저[j];
저Bar[j+1] = 저Bar[j];
저Idx[j+1] = 저Idx[j];
}
저[1] = 기준저;
저Bar[1] = 기준저Bar;
저Idx[1] = Index - 저Bar[1];
ZZ = 기준저;
기준저 = L;
기준저Bar = 0;
기준고 = H;
기준고Bar = 0;
}
if ZZ[1] != ZZ then {
if 추세 == 상승 Then{
TL1 = TL_New(sdate[고bar[1]],stime[고bar[1]],고[1],sdate[저bar[1]],stime[저bar[1]],저[1]);
TL_SetColor(TL1,BLUE);
}
if 추세 == 하락 Then{
TL1 = TL_New(sdate[저bar[1]],stime[저bar[1]],저[1],sdate[고bar[1]],stime[고bar[1]],고[1]);
TL_SetColor(TL1,RED);
}
}
TL_Delete(TL2);
if ZZ[1] == ZZ then {
if 추세 == 상승 Then{
TL2 = TL_New(sdate[저bar[1]],stime[저bar[1]],저[1],sdate,stime,c);
TL_SetColor(TL2,RED);
}
if 추세 == 하락 Then{
TL2 = TL_New(sdate[고bar[1]],stime[고bar[1]],고[1],sdate,stime,c);
TL_SetColor(TL2,BLUE);
}
}
다음글
이전글