커뮤니티
Data2에 대한 식으로 변경
2016-11-29 19:04:16
116
글번호 104497
안녕하세요?
아래의 지표식을 data2에 대한 식으로 변경해 봤는데 잘 안되는군요.
부탁 좀 드립니다.
=================================================================
#==========================================#
# 지 표 명 : 피보나치 되돌림비율
# 작 성 자 : 수식지왕
# 블 로 그 : http://yahoosir.blog.me
#==========================================#
input:방향(1),시작년월(200606);
Var:j(0),k(0),고(0),저(0),고Bar(0),저Bar(0);
Array:r[7](0),fr[7](0);
#==============================================================================#
# 초기처리 (Initialize Routine)
#==============================================================================#
r[0] = 0;
r[1] = 0.236;
r[2] = 0.382;
r[3] = 0.50;
r[4] = 0.618;
r[5] = 0.764;
r[6] = 1;
#==============================================================================#
# 메인처리 (Main Routine)
#==============================================================================#
고Bar = 고Bar + 1;
저Bar = 저Bar + 1;
#=========================================================#
# 상승방향
#=========================================================#
If 방향 >= 0 Then
{
#---------------------------------------------------------#
# 최고/최저점 계산
#---------------------------------------------------------#
if INT(DATE/100) >= 시작년월 and
고 < H then
{
고 = H;
고Bar = 0;
}
if INT(DATE/100) == 시작년월 and
(저 == 0 or 저 > L) then
{
저 = L;
저Bar = 0;
}
#---------------------------------------------------------#
# Fibonacci Retracements 계산
#---------------------------------------------------------#
k = Highest(H,저Bar+1);
for j = 0 to 6
{
fr[j] = 저 + ((k - 저) * r[j]);
}
}
#=========================================================#
# 하락방향
#=========================================================#
Else
{
#---------------------------------------------------------#
# 최고/최저점 계산
#---------------------------------------------------------#
if INT(DATE/100) == 시작년월 and
고 < H then
{
고 = H;
고Bar = 0;
}
if INT(DATE/100) >= 시작년월 and
(저 == 0 or 저 > L) then
{
저 = L;
저Bar = 0;
}
#---------------------------------------------------------#
# Fibonacci Retracements 계산
#---------------------------------------------------------#
k = Lowest(L,고Bar+1);
for j = 0 to 6 {
fr[j] = 고 - ((고 - k) * r[j]);
}
}
#==============================================================================#
# 지표출력
#==============================================================================#
Plot1(fr[0], "0%",Iff(방향>=0,BLACK,LBLUE));
Plot2(fr[1], "24%",Iff(방향>=0,BLUE,LGREEN));
Plot3(fr[2], "38%",Iff(방향>=0,GREEN,LCYAN));
Plot4(fr[3], "50%",Iff(방향>=0,CYAN,PINK));
Plot5(fr[4], "62%",Iff(방향>=0,RED,LMAGENTA));
Plot6(fr[5], "76%",Iff(방향>=0,MAGENTA,LYELLOW));
Plot7(fr[6],"100%",Iff(방향>=0,GRAY,BWHITE));
답변 1
예스스탁 예스스탁 답변
2016-11-30 10:37:58
안녕하세요
예스스탁입니다.
input:방향(1),시작년월(200606);
Var:j(0,data2),k(0,data2),고(0,data2),저(0,data2),고Bar(0,data2),저Bar(0,data2);
Array:r[7](0,data2),fr[7](0,data2);
#==============================================================================#
# 초기처리 (Initialize Routine)
#==============================================================================#
r[0] = 0;
r[1] = 0.236;
r[2] = 0.382;
r[3] = 0.50;
r[4] = 0.618;
r[5] = 0.764;
r[6] = 1;
#==============================================================================#
# 메인처리 (Main Routine)
#==============================================================================#
고Bar = 고Bar + 1;
저Bar = 저Bar + 1;
#=========================================================#
# 상승방향
#=========================================================#
If 방향 >= 0 Then
{
#---------------------------------------------------------#
# 최고/최저점 계산
#---------------------------------------------------------#
if data2(INT(DATE/100) >= 시작년월 and
고 < H) then
{
고 = data2(H);
고Bar = 0;
}
if data2(INT(DATE/100) == 시작년월 and
(저 == 0 or 저 > L)) then
{
저 = data2(L);
저Bar = 0;
}
#---------------------------------------------------------#
# Fibonacci Retracements 계산
#---------------------------------------------------------#
k = data2(Highest(H,저Bar+1));
for j = 0 to 6
{
fr[j] = 저 + ((k - 저) * r[j]);
}
}
#=========================================================#
# 하락방향
#=========================================================#
Else
{
#---------------------------------------------------------#
# 최고/최저점 계산
#---------------------------------------------------------#
if data2(INT(DATE/100) == 시작년월 and
고 < H) then
{
고 = data2(H);
고Bar = 0;
}
if data2(INT(DATE/100) >= 시작년월 and
(저 == 0 or 저 > L)) then
{
저 = data2(L);
저Bar = 0;
}
#---------------------------------------------------------#
# Fibonacci Retracements 계산
#---------------------------------------------------------#
k = data2(Lowest(L,고Bar+1));
for j = 0 to 6 {
fr[j] = 고 - ((고 - k) * r[j]);
}
}
#==============================================================================#
# 지표출력
#==============================================================================#
Plot1(fr[0], "0%",Iff(방향>=0,BLACK,LBLUE));
Plot2(fr[1], "24%",Iff(방향>=0,BLUE,LGREEN));
Plot3(fr[2], "38%",Iff(방향>=0,GREEN,LCYAN));
Plot4(fr[3], "50%",Iff(방향>=0,CYAN,PINK));
Plot5(fr[4], "62%",Iff(방향>=0,RED,LMAGENTA));
Plot6(fr[5], "76%",Iff(방향>=0,MAGENTA,LYELLOW));
Plot7(fr[6],"100%",Iff(방향>=0,GRAY,BWHITE));
즐거운 하루되세요
> 매버릭 님이 쓴 글입니다.
> 제목 : Data2에 대한 식으로 변경
> 안녕하세요?
아래의 지표식을 data2에 대한 식으로 변경해 봤는데 잘 안되는군요.
부탁 좀 드립니다.
=================================================================
#==========================================#
# 지 표 명 : 피보나치 되돌림비율
# 작 성 자 : 수식지왕
# 블 로 그 : http://yahoosir.blog.me
#==========================================#
input:방향(1),시작년월(200606);
Var:j(0),k(0),고(0),저(0),고Bar(0),저Bar(0);
Array:r[7](0),fr[7](0);
#==============================================================================#
# 초기처리 (Initialize Routine)
#==============================================================================#
r[0] = 0;
r[1] = 0.236;
r[2] = 0.382;
r[3] = 0.50;
r[4] = 0.618;
r[5] = 0.764;
r[6] = 1;
#==============================================================================#
# 메인처리 (Main Routine)
#==============================================================================#
고Bar = 고Bar + 1;
저Bar = 저Bar + 1;
#=========================================================#
# 상승방향
#=========================================================#
If 방향 >= 0 Then
{
#---------------------------------------------------------#
# 최고/최저점 계산
#---------------------------------------------------------#
if INT(DATE/100) >= 시작년월 and
고 < H then
{
고 = H;
고Bar = 0;
}
if INT(DATE/100) == 시작년월 and
(저 == 0 or 저 > L) then
{
저 = L;
저Bar = 0;
}
#---------------------------------------------------------#
# Fibonacci Retracements 계산
#---------------------------------------------------------#
k = Highest(H,저Bar+1);
for j = 0 to 6
{
fr[j] = 저 + ((k - 저) * r[j]);
}
}
#=========================================================#
# 하락방향
#=========================================================#
Else
{
#---------------------------------------------------------#
# 최고/최저점 계산
#---------------------------------------------------------#
if INT(DATE/100) == 시작년월 and
고 < H then
{
고 = H;
고Bar = 0;
}
if INT(DATE/100) >= 시작년월 and
(저 == 0 or 저 > L) then
{
저 = L;
저Bar = 0;
}
#---------------------------------------------------------#
# Fibonacci Retracements 계산
#---------------------------------------------------------#
k = Lowest(L,고Bar+1);
for j = 0 to 6 {
fr[j] = 고 - ((고 - k) * r[j]);
}
}
#==============================================================================#
# 지표출력
#==============================================================================#
Plot1(fr[0], "0%",Iff(방향>=0,BLACK,LBLUE));
Plot2(fr[1], "24%",Iff(방향>=0,BLUE,LGREEN));
Plot3(fr[2], "38%",Iff(방향>=0,GREEN,LCYAN));
Plot4(fr[3], "50%",Iff(방향>=0,CYAN,PINK));
Plot5(fr[4], "62%",Iff(방향>=0,RED,LMAGENTA));
Plot6(fr[5], "76%",Iff(방향>=0,MAGENTA,LYELLOW));
Plot7(fr[6],"100%",Iff(방향>=0,GRAY,BWHITE));