커뮤니티
수식문의
2013-11-07 12:59:03
181
글번호 69284
1.아래의 수식을가지고(아니면다른수식가능) #틱봉이 만들어지는 시간 계산을 할수있나요 1분안에 봉갯수를 몇개 만든가를 계산수식부탁합니다 틱은100틱사용합니다
input : P1(1),P2(5),P3(20),N(5),X(2000);
var : S1(0),S2(0),stimeTosecond(0),E1(0),E2(0),timeTosecond(0),SecondMakecandle(0);
var : sum(0),vol(0),cnt(0);
#틱봉이 만들어지는 시간 계산
S1 = TimeToMinutes(stime)*60;
S2 = FracPortion(stime/100)*100;//시작시간 초
stimeTosecond = S1+S2;
E1 = TimeToMinutes(time)*60;
E2 = FracPortion(time/100)*100;//긑시간 초
timeTosecond = E1+E2;
SecondMakecandle = timeTosecond-stimeTosecond;
sum = 0;
vol = 0;
for cnt = 0 to 200{
sum = sum + SecondMakecandle[cnt];
if sum <= 300 Then{
vol = vol+V[cnt];
}
//초합계가 300이 넘거나 이전봉의 날짜가 당일이 아니면 for문 중지
if sum > 300 or sdate[cnt] != sdate Then
cnt = 201;
}
2.아래수식에서반등반락시 38.2 위에서는매수 61.8 아래에서는 매도 시스템 수식 바뀌주세요
input:left(5),right(5),구분(1);
var:j(0),prehv(0),prelv(0),prehb(0),prelb(0),tmpv(0),tmpb(0),
ovr(0),반등(1),반락(-1);
array:hv[10](0),lv[10](0),hb[10](0),lb[10](0),
r[8](0),fr[8](0);
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;
r[7] = 1.618;
#==============================================================================#
# 변곡점 계산
#==============================================================================#
//파동선 작성 설명은 자주 했으므로 생략
if highest(h[1],left) <= h then {
prehv = h;
prehb = 0;
}
else
prehb = prehb + 1;
if lowest(l[1],left) >= l then {
prelv = l;
prelb = 0;
}
else
prelb = prelb + 1;
for j = 1 to 9 begin
hb[j] = hb[j] + 1;
lb[j] = lb[j] + 1;
end;
if prehb == right and highest(h,right) <= h[right] then {
for j = 9 downto 2 {
hv[j] = hv[j-1];
hb[j] = hb[j-1];
}
hv[1] = prehv;
hb[1] = prehb;
if lb[1] > hb[2] then {
for j = 9 downto 2 {
lv[j] = lv[j-1];
lb[j] = lb[j-1];
}
tmpv = 0;
for j = hb[1] + 1 to hb[2] - 1 {
if tmpv > l[j] or tmpv ==0 then {
tmpv = l[j];
tmpb = j;
}
}
lv[1] = tmpv;
lb[1] = tmpb;
}
}
if prelb == right and lowest(l,right) >= l[right] then {
for j = 9 downto 2 {
lv[j] = lv[j-1];
lb[j] = lb[j-1];
}
lv[1] = prelv;
lb[1] = prelb;
if hb[1] > lb[2] then {
for j = 9 downto 2 {
hv[j] = hv[j-1];
hb[j] = hb[j-1];
}
tmpv = 0;
for j = lb[1] + 1 to lb[2] - 1 {
if tmpv < h[j] or tmpv ==0 then {
tmpv = h[j];
tmpb = j;
}
}
hv[1] = tmpv;
hb[1] = tmpb;
}
}
#==============================================================================#
# Fibonacci Retracements 계산
#==============================================================================#
//반등과 반락을 모두 표시하게 되면 복잡해지므로 한 방향만 표시하는 것이 옳음
if 구분 == 반등 then {
if crossup(lb[1],hb[1]) then
{
for j = 0 to 7 begin
fr[j] = hv[1] - (hv[1] - lv[1]) * r[j];
end;
ovr = 0;
}
if fr[6]>l then ovr = 1;
}
if 구분 == 반락 then {
if crossup(hb[1],lb[1]) then
{
for j = 0 to 7 begin
fr[j] = lv[1] + (hv[1] - lv[1]) * r[j];
end;
ovr = 0;
}
if fr[6]>l then ovr = 1;
}
#==============================================================================#
# 지표출력
#==============================================================================#
if hb[1]==right then plot1(hv[1],"파동선",GREEN);
if lb[1]==right then plot1(lv[1],"파동선",GREEN);
plot2(fr[0],"0%",BLUE);
plot3(fr[1],"23.6%",RED);
plot4(fr[2],"38.2%",MAGENTA);
plot5(fr[3],"50%",GRAY);
plot6(fr[4],"61.8%",LBLUE);
plot7(fr[5],"76.4%",LGREEN);
plot8(fr[6],"100%",PINK);
if ovr then plot9(fr[7],"161.8%",LMAGENTA); //점 그래프로 표시
답변 1
예스스탁 예스스탁 답변
2013-11-07 16:34:12
안녕하세요
예스스탁입니다.
1,
input : N(60);#60초
var : S1(0),S2(0),stimeTosecond(0),E1(0),E2(0),timeTosecond(0),SecondMakecandle(0);
var : sum(0),idx(0),cnt(0);
#틱봉이 만들어지는 시간 계산
S1 = TimeToMinutes(stime)*60;
S2 = FracPortion(stime/100)*100;//시작시간 초
stimeTosecond = S1+S2;
E1 = TimeToMinutes(time)*60;
E2 = FracPortion(time/100)*100;//긑시간 초
timeTosecond = E1+E2;
SecondMakecandle = timeTosecond-stimeTosecond;
sum = 0;
idx = 0;
for cnt = 0 to 200{
sum = sum + SecondMakecandle[cnt];
if sum <= N Then{
idx = idx+1;
}
if sum > N or sdate[cnt] != sdate Then
cnt = 201;
}
plot1(idx,"N초간 봉수");
2.
input:left(5),right(5),구분(1);
var:j(0),prehv(0),prelv(0),prehb(0),prelb(0),tmpv(0),tmpb(0),
ovr(0),반등(1),반락(-1);
array:hv[10](0),lv[10](0),hb[10](0),lb[10](0),
r[8](0),fr[8](0);
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;
r[7] = 1.618;
#==============================================================================#
# 변곡점 계산
#==============================================================================#
//파동선 작성 설명은 자주 했으므로 생략
if highest(h[1],left) <= h then {
prehv = h;
prehb = 0;
}
else
prehb = prehb + 1;
if lowest(l[1],left) >= l then {
prelv = l;
prelb = 0;
}
else
prelb = prelb + 1;
for j = 1 to 9 begin
hb[j] = hb[j] + 1;
lb[j] = lb[j] + 1;
end;
if prehb == right and highest(h,right) <= h[right] then {
for j = 9 downto 2 {
hv[j] = hv[j-1];
hb[j] = hb[j-1];
}
hv[1] = prehv;
hb[1] = prehb;
if lb[1] > hb[2] then {
for j = 9 downto 2 {
lv[j] = lv[j-1];
lb[j] = lb[j-1];
}
tmpv = 0;
for j = hb[1] + 1 to hb[2] - 1 {
if tmpv > l[j] or tmpv ==0 then {
tmpv = l[j];
tmpb = j;
}
}
lv[1] = tmpv;
lb[1] = tmpb;
}
}
if prelb == right and lowest(l,right) >= l[right] then {
for j = 9 downto 2 {
lv[j] = lv[j-1];
lb[j] = lb[j-1];
}
lv[1] = prelv;
lb[1] = prelb;
if hb[1] > lb[2] then {
for j = 9 downto 2 {
hv[j] = hv[j-1];
hb[j] = hb[j-1];
}
tmpv = 0;
for j = lb[1] + 1 to lb[2] - 1 {
if tmpv < h[j] or tmpv ==0 then {
tmpv = h[j];
tmpb = j;
}
}
hv[1] = tmpv;
hb[1] = tmpb;
}
}
#==============================================================================#
# Fibonacci Retracements 계산
#==============================================================================#
//반등과 반락을 모두 표시하게 되면 복잡해지므로 한 방향만 표시하는 것이 옳음
if 구분 == 반등 then {
if crossup(lb[1],hb[1]) then
{
for j = 0 to 7 begin
fr[j] = hv[1] - (hv[1] - lv[1]) * r[j];
end;
ovr = 0;
}
if fr[6]>l then ovr = 1;
}
if 구분 == 반락 then {
if crossup(hb[1],lb[1]) then
{
for j = 0 to 7 begin
fr[j] = lv[1] + (hv[1] - lv[1]) * r[j];
end;
ovr = 0;
}
if fr[6]>l then ovr = 1;
}
#==============================================================================#
# 지표출력
#==============================================================================#
if hb[1]==right then
var1 = 1;
if lb[1]==right then
var1 = -1;
if var1 == 1 and CrossDown(c,fr[4]) Then
sell();
if var1 == -1 and CrossDown(c,fr[2]) Then
buy();
즐거운 하루되세요
> 백진강 님이 쓴 글입니다.
> 제목 : 수식문의
> 1.아래의 수식을가지고(아니면다른수식가능) #틱봉이 만들어지는 시간 계산을 할수있나요 1분안에 봉갯수를 몇개 만든가를 계산수식부탁합니다 틱은100틱사용합니다
input : P1(1),P2(5),P3(20),N(5),X(2000);
var : S1(0),S2(0),stimeTosecond(0),E1(0),E2(0),timeTosecond(0),SecondMakecandle(0);
var : sum(0),vol(0),cnt(0);
#틱봉이 만들어지는 시간 계산
S1 = TimeToMinutes(stime)*60;
S2 = FracPortion(stime/100)*100;//시작시간 초
stimeTosecond = S1+S2;
E1 = TimeToMinutes(time)*60;
E2 = FracPortion(time/100)*100;//긑시간 초
timeTosecond = E1+E2;
SecondMakecandle = timeTosecond-stimeTosecond;
sum = 0;
vol = 0;
for cnt = 0 to 200{
sum = sum + SecondMakecandle[cnt];
if sum <= 300 Then{
vol = vol+V[cnt];
}
//초합계가 300이 넘거나 이전봉의 날짜가 당일이 아니면 for문 중지
if sum > 300 or sdate[cnt] != sdate Then
cnt = 201;
}
2.아래수식에서반등반락시 38.2 위에서는매수 61.8 아래에서는 매도 시스템 수식 바뀌주세요
input:left(5),right(5),구분(1);
var:j(0),prehv(0),prelv(0),prehb(0),prelb(0),tmpv(0),tmpb(0),
ovr(0),반등(1),반락(-1);
array:hv[10](0),lv[10](0),hb[10](0),lb[10](0),
r[8](0),fr[8](0);
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;
r[7] = 1.618;
#==============================================================================#
# 변곡점 계산
#==============================================================================#
//파동선 작성 설명은 자주 했으므로 생략
if highest(h[1],left) <= h then {
prehv = h;
prehb = 0;
}
else
prehb = prehb + 1;
if lowest(l[1],left) >= l then {
prelv = l;
prelb = 0;
}
else
prelb = prelb + 1;
for j = 1 to 9 begin
hb[j] = hb[j] + 1;
lb[j] = lb[j] + 1;
end;
if prehb == right and highest(h,right) <= h[right] then {
for j = 9 downto 2 {
hv[j] = hv[j-1];
hb[j] = hb[j-1];
}
hv[1] = prehv;
hb[1] = prehb;
if lb[1] > hb[2] then {
for j = 9 downto 2 {
lv[j] = lv[j-1];
lb[j] = lb[j-1];
}
tmpv = 0;
for j = hb[1] + 1 to hb[2] - 1 {
if tmpv > l[j] or tmpv ==0 then {
tmpv = l[j];
tmpb = j;
}
}
lv[1] = tmpv;
lb[1] = tmpb;
}
}
if prelb == right and lowest(l,right) >= l[right] then {
for j = 9 downto 2 {
lv[j] = lv[j-1];
lb[j] = lb[j-1];
}
lv[1] = prelv;
lb[1] = prelb;
if hb[1] > lb[2] then {
for j = 9 downto 2 {
hv[j] = hv[j-1];
hb[j] = hb[j-1];
}
tmpv = 0;
for j = lb[1] + 1 to lb[2] - 1 {
if tmpv < h[j] or tmpv ==0 then {
tmpv = h[j];
tmpb = j;
}
}
hv[1] = tmpv;
hb[1] = tmpb;
}
}
#==============================================================================#
# Fibonacci Retracements 계산
#==============================================================================#
//반등과 반락을 모두 표시하게 되면 복잡해지므로 한 방향만 표시하는 것이 옳음
if 구분 == 반등 then {
if crossup(lb[1],hb[1]) then
{
for j = 0 to 7 begin
fr[j] = hv[1] - (hv[1] - lv[1]) * r[j];
end;
ovr = 0;
}
if fr[6]>l then ovr = 1;
}
if 구분 == 반락 then {
if crossup(hb[1],lb[1]) then
{
for j = 0 to 7 begin
fr[j] = lv[1] + (hv[1] - lv[1]) * r[j];
end;
ovr = 0;
}
if fr[6]>l then ovr = 1;
}
#==============================================================================#
# 지표출력
#==============================================================================#
if hb[1]==right then plot1(hv[1],"파동선",GREEN);
if lb[1]==right then plot1(lv[1],"파동선",GREEN);
plot2(fr[0],"0%",BLUE);
plot3(fr[1],"23.6%",RED);
plot4(fr[2],"38.2%",MAGENTA);
plot5(fr[3],"50%",GRAY);
plot6(fr[4],"61.8%",LBLUE);
plot7(fr[5],"76.4%",LGREEN);
plot8(fr[6],"100%",PINK);
if ovr then plot9(fr[7],"161.8%",LMAGENTA); //점 그래프로 표시
다음글
이전글