커뮤니티
수정을 부탁드림니다.
2017-07-10 13:29:53
127
글번호 111167
매수;장기파동(length)이 상방(최저점이 꺽인이후)단기파동(length1)이 단기파동의전저점을 갱신하거나 같을때 이후 상방으로 파동이 꺽인지점
청산;장기파동이 하방으로 꺽인지점
매도:장기파동이 하방(최고점이 꺽인이후)단기파동이 단기파동의전고점을갱신하거나 같을때 이후 하방으로 파동이 꺽엿을때
청산;장기파동이 하방에서 상방으로 꺽엿슬때
수식;
Input:length(20);
Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0);
var : UpTL_chk(false),DnTL_chk(false);
Array:valArr[20](0),barArr[20](0),turnPntArr[20]("");
Input:length1(10);
var:lastHiVal1(0),lastLoVal1(0),turnPntBit1(""),TL11(0);
Array:valArr1[20](0),barArr1[20](0),turnPntArr1[20]("");
For j = 0 To 19 {
barArr[j] = barArr[j] + 1;
}
Condition1 = Highest(H,length) == H and lastHiVal <> H;
Condition2 = Lowest(L,length) == L and lastLoVal <> L;
If Condition1 Then lastHiVal = H;
If Condition2 Then lastLoVal = L;
turnPntBit = "";
If Condition1 and Condition2 Then {
If turnPntArr[1] == "Hi" Then turnPntBit = "Lo";
Else If turnPntArr[1] == "Lo" Then turnPntBit = "Hi";
}
Else If Condition1 Then turnPntBit = "Hi";
Else If Condition2 Then turnPntBit = "Lo";
If turnPntBit == "Hi" or turnPntBit == "Lo" Then {
If turnPntBit <> turnPntArr[1] Then {
for j = 18 downto 1 {
valArr[j+1] = valArr[j];
barArr[j+1] = barArr[j];
turnPntArr[j+1] = turnPntArr[j];
}
}
If turnPntBit <> turnPntArr[1] or
(turnPntBit == turnPntArr[1] and
((turnPntBit == "Hi" and valArr[1] < H) or
(turnPntBit == "Lo" and valArr[1] > L))) Then {
valArr[1] = IFF(turnPntBit == "Hi",H,L);
barArr[1] = 0;
turnPntArr[1] = turnPntBit;
If turnPntArr[1][1] <> turnPntArr[1][0] Then
TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
Else
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
}
}
TL_SetSize(TL1,4);
TL_SetColor(TL1,GREEN);
# 진입 체크
TL_SetSize(TL1,4);
TL_SetColor(TL1,GREEN);
For j = 0 To 19 {
barArr1[j] = barArr1[j] + 1;
}
Condition11 = Highest(H,length1) == H and lastHiVal1 <> H;
Condition12 = Lowest(L,length1) == L and lastLoVal1 <> L;
If Condition11 Then lastHiVal1 = H;
If Condition12 Then lastLoVal1 = L;
turnPntBit1 = "";
If Condition11 and Condition12 Then {
If turnPntArr1[1] == "Hi" Then turnPntBit1 = "Lo";
Else If turnPntArr1[1] == "Lo" Then turnPntBit1 = "Hi";
}
Else If Condition11 Then turnPntBit1 = "Hi";
Else If Condition12 Then turnPntBit1 = "Lo";
If turnPntBit1 == "Hi" or turnPntBit1 == "Lo" Then {
If turnPntBit1 <> turnPntArr1[1] Then {
for j = 18 downto 1 {
valArr1[j+1] = valArr1[j];
barArr1[j+1] = barArr1[j];
turnPntArr1[j+1] = turnPntArr1[j];
}
}
If turnPntBit1 <> turnPntArr1[1] or
(turnPntBit1 == turnPntArr1[1] and
((turnPntBit1 == "Hi" and valArr1[1] < H) or
(turnPntBit1 == "Lo" and valArr1[1] > L))) Then {
valArr1[1] = IFF(turnPntBit1 == "Hi",H,L);
barArr1[1] = 0;
turnPntArr1[1] = turnPntBit1;
If turnPntArr1[1][1] <> turnPntArr1[1][0] Then
TL11 = TL_New(sDate[barArr1[2]],sTime[barArr1[2]],valArr1[2],sDate[barArr1[1]],sTime[barArr1[1]],valArr1[1]);
Else
TL_SetEnd(TL11,sDate[barArr1[1]],sTime[barArr1[1]],valArr1[1]);
}
}
TL_SetSize(TL11,4);
TL_SetColor(TL11,GREEN);
If turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Lo" Then
var1 = valArr[2];
if turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Hi" Then
var2 = valArr[2];
If turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Lo" Then
var11 = valArr1[2];
if turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Hi" Then
var22 = valArr1[2];
# 매수진입
IF var1 == var11 and var1[1] != var11[1] then
buy("buy") ;
# 매도진입
IF var2 == var22 and var2[1] != var22[1] then
sell("sell") ;
# 매수청산
IF Marketposition == 1 and turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Lo" Then {
ExitLong("BX11");
}
# 매도청산
IF Marketposition == -1 and turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Hi" Then {
ExitShort("SX11");
}
##### 당일청산 #####
if stime == 050000 or (stime > 055000 and stime[1] < 050000) then { # 포지션 청산
exitlong("BDF1");
exitshort("SDF1");
}
답변 1
예스스탁 예스스탁 답변
2017-07-11 13:34:37
안녕하세요
예스스탁입니다.
Input:length(20);
Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0);
var : UpTL_chk(false),DnTL_chk(false);
Array:valArr[20](0),barArr[20](0),turnPntArr[20]("");
Input:length1(10);
var:lastHiVal1(0),lastLoVal1(0),turnPntBit1(""),TL11(0),T(0),T1(0);
var : H1(0),H2(0),L1(0),L2(0),H11(0),L11(0),H22(0),L22(0);
Array:valArr1[20](0),barArr1[20](0),turnPntArr1[20]("");
For j = 0 To 19 {
barArr[j] = barArr[j] + 1;
}
Condition1 = Highest(H,length) == H and lastHiVal <> H;
Condition2 = Lowest(L,length) == L and lastLoVal <> L;
If Condition1 Then lastHiVal = H;
If Condition2 Then lastLoVal = L;
turnPntBit = "";
If Condition1 and Condition2 Then {
If turnPntArr[1] == "Hi" Then turnPntBit = "Lo";
Else If turnPntArr[1] == "Lo" Then turnPntBit = "Hi";
}
Else If Condition1 Then turnPntBit = "Hi";
Else If Condition2 Then turnPntBit = "Lo";
If turnPntBit == "Hi" or turnPntBit == "Lo" Then {
If turnPntBit <> turnPntArr[1] Then {
for j = 18 downto 1 {
valArr[j+1] = valArr[j];
barArr[j+1] = barArr[j];
turnPntArr[j+1] = turnPntArr[j];
}
}
If turnPntBit <> turnPntArr[1] or
(turnPntBit == turnPntArr[1] and
((turnPntBit == "Hi" and valArr[1] < H) or
(turnPntBit == "Lo" and valArr[1] > L))) Then {
valArr[1] = IFF(turnPntBit == "Hi",H,L);
barArr[1] = 0;
turnPntArr[1] = turnPntBit;
If turnPntArr[1][1] <> turnPntArr[1][0] Then
TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
Else
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
}
}
TL_SetSize(TL1,4);
TL_SetColor(TL1,GREEN);
# 진입 체크
TL_SetSize(TL1,4);
TL_SetColor(TL1,GREEN);
For j = 0 To 19 {
barArr1[j] = barArr1[j] + 1;
}
Condition11 = Highest(H,length1) == H and lastHiVal1 <> H;
Condition12 = Lowest(L,length1) == L and lastLoVal1 <> L;
If Condition11 Then lastHiVal1 = H;
If Condition12 Then lastLoVal1 = L;
turnPntBit1 = "";
If Condition11 and Condition12 Then {
If turnPntArr1[1] == "Hi" Then turnPntBit1 = "Lo";
Else If turnPntArr1[1] == "Lo" Then turnPntBit1 = "Hi";
}
Else If Condition11 Then turnPntBit1 = "Hi";
Else If Condition12 Then turnPntBit1 = "Lo";
If turnPntBit1 == "Hi" or turnPntBit1 == "Lo" Then {
If turnPntBit1 <> turnPntArr1[1] Then {
for j = 18 downto 1 {
valArr1[j+1] = valArr1[j];
barArr1[j+1] = barArr1[j];
turnPntArr1[j+1] = turnPntArr1[j];
}
}
If turnPntBit1 <> turnPntArr1[1] or
(turnPntBit1 == turnPntArr1[1] and
((turnPntBit1 == "Hi" and valArr1[1] < H) or
(turnPntBit1 == "Lo" and valArr1[1] > L))) Then {
valArr1[1] = IFF(turnPntBit1 == "Hi",H,L);
barArr1[1] = 0;
turnPntArr1[1] = turnPntBit1;
If turnPntArr1[1][1] <> turnPntArr1[1][0] Then
TL11 = TL_New(sDate[barArr1[2]],sTime[barArr1[2]],valArr1[2],sDate[barArr1[1]],sTime[barArr1[1]],valArr1[1]);
Else
TL_SetEnd(TL11,sDate[barArr1[1]],sTime[barArr1[1]],valArr1[1]);
}
}
TL_SetSize(TL11,4);
TL_SetColor(TL11,GREEN);
If turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Lo" Then{
H1 = valArr[2];
H11 = H1[1];
T = 1;
}
if turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Hi" Then{
L1 = valArr[2];
L11 = L1[1];
T = -1;
}
If turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Lo" Then{
H2 = valArr1[2];
H22 = H2[1];
T1 = 1;
}
if turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Hi" Then{
L2 = valArr1[2];
L22 = L2[1];
T1 = -1;
}
if T == -1 and T1 == -1 and T1 != -1 and L2 >= L22 then
buy();
if T == 1 and T1 == 1 and T1 != 1 and H2 <= H22 then
sell();
IF Marketposition == 1 and T == 1 Then {
ExitLong("BX11");
}
# 매도청산
IF Marketposition == -1 and T == -1 Then {
ExitShort("SX11");
}
##### 당일청산 #####
if stime == 050000 or (stime > 055000 and stime[1] < 050000) then { # 포지션 청산
exitlong("BDF1");
exitshort("SDF1");
}
즐거운 하루되세요
> 수루지 님이 쓴 글입니다.
> 제목 : 수정을 부탁드림니다.
> 매수;장기파동(length)이 상방(최저점이 꺽인이후)단기파동(length1)이 단기파동의전저점을 갱신하거나 같을때 이후 상방으로 파동이 꺽인지점
청산;장기파동이 하방으로 꺽인지점
매도:장기파동이 하방(최고점이 꺽인이후)단기파동이 단기파동의전고점을갱신하거나 같을때 이후 하방으로 파동이 꺽엿을때
청산;장기파동이 하방에서 상방으로 꺽엿슬때
수식;
Input:length(20);
Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0);
var : UpTL_chk(false),DnTL_chk(false);
Array:valArr[20](0),barArr[20](0),turnPntArr[20]("");
Input:length1(10);
var:lastHiVal1(0),lastLoVal1(0),turnPntBit1(""),TL11(0);
Array:valArr1[20](0),barArr1[20](0),turnPntArr1[20]("");
For j = 0 To 19 {
barArr[j] = barArr[j] + 1;
}
Condition1 = Highest(H,length) == H and lastHiVal <> H;
Condition2 = Lowest(L,length) == L and lastLoVal <> L;
If Condition1 Then lastHiVal = H;
If Condition2 Then lastLoVal = L;
turnPntBit = "";
If Condition1 and Condition2 Then {
If turnPntArr[1] == "Hi" Then turnPntBit = "Lo";
Else If turnPntArr[1] == "Lo" Then turnPntBit = "Hi";
}
Else If Condition1 Then turnPntBit = "Hi";
Else If Condition2 Then turnPntBit = "Lo";
If turnPntBit == "Hi" or turnPntBit == "Lo" Then {
If turnPntBit <> turnPntArr[1] Then {
for j = 18 downto 1 {
valArr[j+1] = valArr[j];
barArr[j+1] = barArr[j];
turnPntArr[j+1] = turnPntArr[j];
}
}
If turnPntBit <> turnPntArr[1] or
(turnPntBit == turnPntArr[1] and
((turnPntBit == "Hi" and valArr[1] < H) or
(turnPntBit == "Lo" and valArr[1] > L))) Then {
valArr[1] = IFF(turnPntBit == "Hi",H,L);
barArr[1] = 0;
turnPntArr[1] = turnPntBit;
If turnPntArr[1][1] <> turnPntArr[1][0] Then
TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
Else
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
}
}
TL_SetSize(TL1,4);
TL_SetColor(TL1,GREEN);
# 진입 체크
TL_SetSize(TL1,4);
TL_SetColor(TL1,GREEN);
For j = 0 To 19 {
barArr1[j] = barArr1[j] + 1;
}
Condition11 = Highest(H,length1) == H and lastHiVal1 <> H;
Condition12 = Lowest(L,length1) == L and lastLoVal1 <> L;
If Condition11 Then lastHiVal1 = H;
If Condition12 Then lastLoVal1 = L;
turnPntBit1 = "";
If Condition11 and Condition12 Then {
If turnPntArr1[1] == "Hi" Then turnPntBit1 = "Lo";
Else If turnPntArr1[1] == "Lo" Then turnPntBit1 = "Hi";
}
Else If Condition11 Then turnPntBit1 = "Hi";
Else If Condition12 Then turnPntBit1 = "Lo";
If turnPntBit1 == "Hi" or turnPntBit1 == "Lo" Then {
If turnPntBit1 <> turnPntArr1[1] Then {
for j = 18 downto 1 {
valArr1[j+1] = valArr1[j];
barArr1[j+1] = barArr1[j];
turnPntArr1[j+1] = turnPntArr1[j];
}
}
If turnPntBit1 <> turnPntArr1[1] or
(turnPntBit1 == turnPntArr1[1] and
((turnPntBit1 == "Hi" and valArr1[1] < H) or
(turnPntBit1 == "Lo" and valArr1[1] > L))) Then {
valArr1[1] = IFF(turnPntBit1 == "Hi",H,L);
barArr1[1] = 0;
turnPntArr1[1] = turnPntBit1;
If turnPntArr1[1][1] <> turnPntArr1[1][0] Then
TL11 = TL_New(sDate[barArr1[2]],sTime[barArr1[2]],valArr1[2],sDate[barArr1[1]],sTime[barArr1[1]],valArr1[1]);
Else
TL_SetEnd(TL11,sDate[barArr1[1]],sTime[barArr1[1]],valArr1[1]);
}
}
TL_SetSize(TL11,4);
TL_SetColor(TL11,GREEN);
If turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Lo" Then
var1 = valArr[2];
if turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Hi" Then
var2 = valArr[2];
If turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Lo" Then
var11 = valArr1[2];
if turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Hi" Then
var22 = valArr1[2];
# 매수진입
IF var1 == var11 and var1[1] != var11[1] then
buy("buy") ;
# 매도진입
IF var2 == var22 and var2[1] != var22[1] then
sell("sell") ;
# 매수청산
IF Marketposition == 1 and turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Lo" Then {
ExitLong("BX11");
}
# 매도청산
IF Marketposition == -1 and turnPntArr1[1][1] <> turnPntArr1[1][0] and turnPntArr1[1][0] == "Hi" Then {
ExitShort("SX11");
}
##### 당일청산 #####
if stime == 050000 or (stime > 055000 and stime[1] < 050000) then { # 포지션 청산
exitlong("BDF1");
exitshort("SDF1");
}