커뮤니티
수식문의 드립니다.
2006-12-15 04:55:11
1244
글번호 11508
아래수식에 하루 매수1과 매수2를 합하여 매수와 매수청산 각 3회로 제한하는 식 부탁
드립니다.
초보자라서 식의 배열이나 문법에 틀린부분을 지적하여 주시면 고맙겠습니다.
input : Account(1000000),Stoppercent(10),Stoppoint(0.2),N(0.2);
Array : value1[5](0), value2[3](0), value3[5](0), value4[2](0);
var : EXLindex(0);
value1[0] = ma(C, 5);
value1[1] = ma(C, 5);
value1[2] = ma(C, 5);
value1[3] = ma(C, 5);
value1[4] = ma(C, 5);
value2[0] = ma(c,5) > ma(c,5);
value2[1] = ma(c,5) > ma(c,5);
value2[2] = ma(c,5) > ma(c,5);
value3[0] = ma(c,5) > ma(c,5);
value3[1] = ma(c,5) > ma(c,5);
value3[2] = ma(c,5) > ma(c,5);
value3[3] = ma(c,5) > ma(c,5);
value4[0] = ma(data1("C"),5);
value4[1] = ma(data1("C"),5);
# Buy
if stime >= 090200 and stime <= 150000 then{
if crossup(value1[1],value1[2])
and index() > EXLindex + 5 then
buy("매수",onclose,def,int(Account/(C*100000)));
}
if stime >= 090200 and stime <= 150000 then{
if C > C[1]
and C >= value1[3]
and data1("C") < value1[0]
and index() > EXLindex + 5 then
buy("매수1",onclose,def,int(Account/(C*100000)));
}
# Exitlong
if marketposition() == 1 then{
if stime >= 090200 and stime <= 150400 and barssinceentry() < 1 then
if C <= entryprice()-N
and C < value1[1] then
Exitlong("매수청산");
//SetStopLoss(stoppercent, PercentStop);
SetStopLoss(Stoppoint, PointStop);
EXLindex = index();
}
답변 1
예스스탁 예스스탁 답변
2006-12-15 14:45:15
안녕하세요
예스스탁입니다.
식을 수정했습니다.
input : Account(1000000),Stoppercent(10),Stoppoint(0.2),N(0.2);
Array : value1[5](0), value2[3](0), value3[5](0), value4[2](0);
var : EXLindex(0),cnt1(0),cnt2(0);
value1[0] = ma(C, 5);
value1[1] = ma(C, 5);
value1[2] = ma(C, 5);
value1[3] = ma(C, 5);
value1[4] = ma(C, 5);
value2[0] = ma(c,5) > ma(c,5);
value2[1] = ma(c,5) > ma(c,5);
value2[2] = ma(c,5) > ma(c,5);
value3[0] = ma(c,5) > ma(c,5);
value3[1] = ma(c,5) > ma(c,5);
value3[2] = ma(c,5) > ma(c,5);
value3[3] = ma(c,5) > ma(c,5);
value4[0] = ma(data1("C"),5);
value4[1] = ma(data1("C"),5);
# Buy
if stime >= 090200 and stime <= 150000 and marketposition() == 0 then{
if crossup(value1[1],value1[2]) and index() > EXLindex + 5 and cnt1 < 3 then
buy("매수",onclose,def,int(Account/(C*100000)));
cnt1 = cnt1+1;
}
if stime >= 090200 and stime <= 150000 and marketposition() == 0 then{
if C > C[1] and C >= value1[3]
and data1("C") < value1[0]
and index() > EXLindex + 5 and cnt1 < 3 then
buy("매수1",onclose,def,int(Account/(C*100000)));
cnt2 = cnt2+1;
}
# Exitlong
if marketposition() == 1 then{
if stime >= 090200 and stime <= 150400 and barssinceentry() < 1 then
if C <= entryprice()-N
and C < value1[1] then
Exitlong("매수청산");
EXLindex = index();
}
//SetStopLoss(stoppercent, PercentStop);
SetStopLoss(Stoppoint, PointStop);
배열을 사용한 정확한 내용을 모르겠습니다.
만약 이전값 참조를 하신 경우이면
var1 = ma(c,5);
로 이동평균을 var1이란 변수에 할당한다음
수식에서
var1[1]<<< 한봉전
vav1[2]<<< 두봉전
등으로 쓰시면 됩니다.
crossup(var1[1],var1[2])
SetStopLoss(Stoppoint, PointStop)를
청산 식안에 사용하게 되면
청산 조건이 만족할때 SetStopLoss가 작동됩니다.
즐거운 하루되세요
> ksh003 님이 쓴 글입니다.
> 제목 : 수식문의 드립니다.
> 아래수식에 하루 매수1과 매수2를 합하여 매수와 매수청산 각 3회로 제한하는 식 부탁
드립니다.
초보자라서 식의 배열이나 문법에 틀린부분을 지적하여 주시면 고맙겠습니다.
input : Account(1000000),Stoppercent(10),Stoppoint(0.2),N(0.2);
Array : value1[5](0), value2[3](0), value3[5](0), value4[2](0);
var : EXLindex(0);
value1[0] = ma(C, 5);
value1[1] = ma(C, 5);
value1[2] = ma(C, 5);
value1[3] = ma(C, 5);
value1[4] = ma(C, 5);
value2[0] = ma(c,5) > ma(c,5);
value2[1] = ma(c,5) > ma(c,5);
value2[2] = ma(c,5) > ma(c,5);
value3[0] = ma(c,5) > ma(c,5);
value3[1] = ma(c,5) > ma(c,5);
value3[2] = ma(c,5) > ma(c,5);
value3[3] = ma(c,5) > ma(c,5);
value4[0] = ma(data1("C"),5);
value4[1] = ma(data1("C"),5);
# Buy
if stime >= 090200 and stime <= 150000 then{
if crossup(value1[1],value1[2])
and index() > EXLindex + 5 then
buy("매수",onclose,def,int(Account/(C*100000)));
}
if stime >= 090200 and stime <= 150000 then{
if C > C[1]
and C >= value1[3]
and data1("C") < value1[0]
and index() > EXLindex + 5 then
buy("매수1",onclose,def,int(Account/(C*100000)));
}
# Exitlong
if marketposition() == 1 then{
if stime >= 090200 and stime <= 150400 and barssinceentry() < 1 then
if C <= entryprice()-N
and C < value1[1] then
Exitlong("매수청산");
//SetStopLoss(stoppercent, PercentStop);
SetStopLoss(Stoppoint, PointStop);
EXLindex = index();
}
다음글