커뮤니티

수정부탁합니다 감사합니다

프로필 이미지
리치존
2013-10-29 10:03:17
162
글번호 68957
답변완료
아래 2가지 시스템식을 통합해서 서로 먼저 조건이 되는 쪽으로 매수 매도를 하게 하고 싶은데 수정부탁드립니다 input : 매수진입별횟수(2),매도진입별횟수(2),당일최대매수횟수(5),당일최대매도횟수(5); var : direction(0),HH(0),LL(0),cnt(0),count(0),기준가(0); var : Bcond1(false),Bcond2(false),Bcond3(false),Bcond4(false),Bcond5(false); var : Scond1(false),Scond2(false),Scond3(false),Scond4(false),Scond5(false); var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0),Didx(0); var : Scnt1(0),Scnt2(0),Scnt3(0),Scnt4(0),Scnt5(0),Buycnt(0),Sellcnt(0); if stime == 180000 or (stime > 180000 and stime[1] < 180000) Then 기준가 = O; var1 = 기준가-4.0; var2 = 기준가-2.0; var3 = 기준가+2.0; var4 = 기준가+4.0; if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{ direction = 0; Didx = 0; } count = 0; Bcnt1 = 0;Bcnt2 = 0;Bcnt3 = 0;Bcnt4 = 0; Scnt1 = 0;Scnt2 = 0;Scnt3 = 0;Scnt4 = 0; Buycnt = 0; Sellcnt = 0; for cnt = 0 to 20{ if sdate == EntryDate(cnt) and EntryTime(cnt) >= 090000 and EntryTime(cnt) <= 151500 Then{ count = count+1; if IsEntryName("b1",cnt) == true Then Bcnt1 = Bcnt1+1; if IsEntryName("b2",cnt) == true Then Bcnt2 = Bcnt2+1; if IsEntryName("b3",cnt) == true Then Bcnt3 = Bcnt3+1; if IsEntryName("b4",cnt) == true Then Bcnt4 = Bcnt4+1; if IsEntryName("s1",cnt) == true Then Scnt1 = Scnt1+1; if IsEntryName("s2",cnt) == true Then Scnt2 = Scnt2+1; if IsEntryName("s3",cnt) == true Then Scnt3 = Scnt3+1; if IsEntryName("s4",cnt) == true Then Scnt4 = Scnt4+1; if MarketPosition(cnt) == 1 then Buycnt = Buycnt+1; if MarketPosition(cnt) == -1 then SEllcnt = Sellcnt+1; } } if stime >= 090000 and stime <= 151500 then{ Didx = Didx+1; if Didx > 1 Then{ if crossup(C,var1) Then { direction = 1; HH = H; } if crossup(C,var2) Then { direction = 2; HH = H; } if crossup(C,var3) Then { direction = 3; HH = H; } if crossup(C,var4) Then { direction = 4; HH = H; } if CrossDown(C,var1) Then { direction = -1; LL = L; } if CrossDown(C,var2) Then { direction = -2; LL = L; } if CrossDown(C,var3) Then{ direction = -3; LL = L; } if CrossDown(C,var4) Then { direction = -4; LL = L; } } if H > HH Then HH = H; if L < LL Then LL = L; Bcond1 = (count == 0 and countif(direction == 1 and direction[1] != 1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 1 and direction[1] != 1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 1 and direction[1] != 1,BarsSinceExit(1)) >= 1); Bcond2 = (count == 0 and countif(direction == 2 and direction[1] != 2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 2 and direction[1] != 2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 2 and direction[1] != 2,BarsSinceExit(1)) >= 1); Bcond3 = (count == 0 and countif(direction == 3 and direction[1] != 3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 3 and direction[1] != 3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 3 and direction[1] != 3,BarsSinceExit(1)) >= 1); Bcond4 = (count == 0 and countif(direction == 4 and direction[1] != 4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 4 and direction[1] != 4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 4 and direction[1] != 4,BarsSinceExit(1)) >= 1); Scond1 = (count == 0 and countif(direction == -1 and direction[1] != -1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -1 and direction[1] != -1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -1 and direction[1] != -1,BarsSinceExit(1)) >= 1); Scond2 = (count == 0 and countif(direction == -2 and direction[1] != -2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -2 and direction[1] != -2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -2 and direction[1] != -2,BarsSinceExit(1)) >= 1); Scond3 = (count == 0 and countif(direction == -3 and direction[1] != -3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -3 and direction[1] != -3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -3 and direction[1] != -3,BarsSinceExit(1)) >= 1); Scond4 = (count == 0 and countif(direction == -4 and direction[1] != -4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -4 and direction[1] != -4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -4 and direction[1] != -4,BarsSinceExit(1)) >= 1); if stime > 090000 and stime < 150000 then{ if BuyCnt < 당일최대매수횟수 then{ if direction == 1 and HH >= var1+0.5 and Bcond1 == true and Bcnt1 < 매수진입별횟수 Then buy("b1",AtLimit,HH-0.4); if direction == 2 and HH >= var2+0.5 and Bcond2 == true and Bcnt2 < 매수진입별횟수 Then buy("b2",AtLimit,HH-0.4); if direction == 3 and HH >= var3+0.5 and Bcond3 == true and Bcnt3 < 매수진입별횟수 Then buy("b3",AtLimit,HH-0.4); if direction == 4 and HH >= var4+0.5 and Bcond4 == true and Bcnt4 < 매수진입별횟수 Then buy("b4",AtLimit,HH-0.4); } if Sellcnt < 당일최대매도횟수 then{ if direction == -1 and LL <= var1-0.5 and Scond1 == true and Scnt1 < 매도진입별횟수 Then Sell("s1",AtLimit,LL+0.4); if direction == -2 and LL <= var2-0.5 and Scond2 == true and Scnt2 < 매도진입별횟수 Then Sell("s2",AtLimit,LL+0.4); if direction == -3 and LL <= var3-0.5 and Scond3 == true and Scnt3 < 매도진입별횟수 Then Sell("s3",AtLimit,LL+0.4); if direction == -4 and LL <= var4-0.5 and Scond4 == true and Scnt4 < 매도진입별횟수 Then Sell("s4",AtLimit,LL+0.4); } } } input : 매수진입별횟수(2),매도진입별횟수(2),당일최대매수횟수(5),당일최대매도횟수(5); var : direction(0),HH(0),LL(0),cnt(0),count(0),기준가(0); var : Bcond1(false),Bcond2(false),Bcond3(false),Bcond4(false),Bcond5(false); var : Scond1(false),Scond2(false),Scond3(false),Scond4(false),Scond5(false); var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0),Didx(0); var : Scnt1(0),Scnt2(0),Scnt3(0),Scnt4(0),Scnt5(0),Buycnt(0),Sellcnt(0); if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then 기준가 = 0; var1 = 기준가-4.0; var2 = 기준가-2.0; var3 = 기준가+2.0; var4 = 기준가+4.0; if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{ direction = 0; Didx = 0; } count = 0; Bcnt1 = 0;Bcnt2 = 0;Bcnt3 = 0;Bcnt4 = 0; Scnt1 = 0;Scnt2 = 0;Scnt3 = 0;Scnt4 = 0; Buycnt = 0; Sellcnt = 0; for cnt = 0 to 20{ if sdate == EntryDate(cnt) and EntryTime(cnt) >= 090000 and EntryTime(cnt) <= 151500 Then{ count = count+1; if IsEntryName("b1",cnt) == true Then Bcnt1 = Bcnt1+1; if IsEntryName("b2",cnt) == true Then Bcnt2 = Bcnt2+1; if IsEntryName("b3",cnt) == true Then Bcnt3 = Bcnt3+1; if IsEntryName("b4",cnt) == true Then Bcnt4 = Bcnt4+1; if IsEntryName("s1",cnt) == true Then Scnt1 = Scnt1+1; if IsEntryName("s2",cnt) == true Then Scnt2 = Scnt2+1; if IsEntryName("s3",cnt) == true Then Scnt3 = Scnt3+1; if IsEntryName("s4",cnt) == true Then Scnt4 = Scnt4+1; if MarketPosition(cnt) == 1 then Buycnt = Buycnt+1; if MarketPosition(cnt) == -1 then SEllcnt = Sellcnt+1; } } if stime >= 090000 and stime <= 151500 then{ Didx = Didx+1; if Didx > 1 Then{ if crossup(C,var1) Then { direction = 1; HH = H; } if crossup(C,var2) Then { direction = 2; HH = H; } if crossup(C,var3) Then { direction = 3; HH = H; } if crossup(C,var4) Then { direction = 4; HH = H; } if CrossDown(C,var1) Then { direction = -1; LL = L; } if CrossDown(C,var2) Then { direction = -2; LL = L; } if CrossDown(C,var3) Then{ direction = -3; LL = L; } if CrossDown(C,var4) Then { direction = -4; LL = L; } } if H > HH Then HH = H; if L < LL Then LL = L; Bcond1 = (count == 0 and countif(direction == 1 and direction[1] != 1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 1 and direction[1] != 1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 1 and direction[1] != 1,BarsSinceExit(1)) >= 1); Bcond2 = (count == 0 and countif(direction == 2 and direction[1] != 2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 2 and direction[1] != 2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 2 and direction[1] != 2,BarsSinceExit(1)) >= 1); Bcond3 = (count == 0 and countif(direction == 3 and direction[1] != 3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 3 and direction[1] != 3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 3 and direction[1] != 3,BarsSinceExit(1)) >= 1); Bcond4 = (count == 0 and countif(direction == 4 and direction[1] != 4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 4 and direction[1] != 4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 4 and direction[1] != 4,BarsSinceExit(1)) >= 1); Scond1 = (count == 0 and countif(direction == -1 and direction[1] != -1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -1 and direction[1] != -1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -1 and direction[1] != -1,BarsSinceExit(1)) >= 1); Scond2 = (count == 0 and countif(direction == -2 and direction[1] != -2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -2 and direction[1] != -2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -2 and direction[1] != -2,BarsSinceExit(1)) >= 1); Scond3 = (count == 0 and countif(direction == -3 and direction[1] != -3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -3 and direction[1] != -3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -3 and direction[1] != -3,BarsSinceExit(1)) >= 1); Scond4 = (count == 0 and countif(direction == -4 and direction[1] != -4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -4 and direction[1] != -4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -4 and direction[1] != -4,BarsSinceExit(1)) >= 1); if stime > 090000 and stime < 150000 then{ if BuyCnt < 당일최대매수횟수 then{ if direction == 1 and HH >= var1+0.5 and Bcond1 == true and Bcnt1 < 매수진입별횟수 Then buy("b1",AtLimit,HH-0.4); if direction == 2 and HH >= var2+0.5 and Bcond2 == true and Bcnt2 < 매수진입별횟수 Then buy("b2",AtLimit,HH-0.4); if direction == 3 and HH >= var3+0.5 and Bcond3 == true and Bcnt3 < 매수진입별횟수 Then buy("b3",AtLimit,HH-0.4); if direction == 4 and HH >= var4+0.5 and Bcond4 == true and Bcnt4 < 매수진입별횟수 Then buy("b4",AtLimit,HH-0.4); } if Sellcnt < 당일최대매도횟수 then{ if direction == -1 and LL <= var1-0.5 and Scond1 == true and Scnt1 < 매도진입별횟수 Then Sell("s1",AtLimit,LL+0.4); if direction == -2 and LL <= var2-0.5 and Scond2 == true and Scnt2 < 매도진입별횟수 Then Sell("s2",AtLimit,LL+0.4); if direction == -3 and LL <= var3-0.5 and Scond3 == true and Scnt3 < 매도진입별횟수 Then Sell("s3",AtLimit,LL+0.4); if direction == -4 and LL <= var4-0.5 and Scond4 == true and Scnt4 < 매도진입별횟수 Then Sell("s4",AtLimit,LL+0.4); } } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-10-29 16:45:55

안녕하세요 예스스탁입니다. input : 매수진입별횟수(2),매도진입별횟수(2),당일최대매수횟수(5),당일최대매도횟수(5); var : direction(0),HH(0),LL(0),cnt(0),count(0),Didx(0); var : 기준가1(0),기준가2(0); var : Bcond1(false),Bcond2(false),Bcond3(false),Bcond4(false),Bcond5(false); var : Scond1(false),Scond2(false),Scond3(false),Scond4(false),Scond5(false); var : Bcond11(false),Bcond22(false),Bcond33(false),Bcond44(false),Bcond55(false); var : Scond11(false),Scond22(false),Scond33(false),Scond44(false),Scond55(false); var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0); var : Scnt1(0),Scnt2(0),Scnt3(0),Scnt4(0),Scnt5(0); var : Bcnt11(0),Bcnt22(0),Bcnt33(0),Bcnt44(0),Bcnt55(0); var : Scnt11(0),Scnt22(0),Scnt33(0),Scnt44(0),Scnt55(0); var : Buycnt(0),Sellcnt(0); var : V1(0),V2(0),V3(0),V4(0); var : Val1(0),Val2(0),Val3(0),Val4(0); if stime == 180000 or (stime > 180000 and stime[1] < 180000) Then 기준가1 = O; V1 = 기준가1-4.0; V2 = 기준가1-2.0; V3 = 기준가1+2.0; V4 = 기준가1+4.0; if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then 기준가2 = O; val1 = 기준가2-4.0; val2 = 기준가2-2.0; val3 = 기준가2+2.0; val4 = 기준가2+4.0; if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{ direction = 0; Didx = 0; } count = 0; Bcnt1 = 0;Bcnt2 = 0;Bcnt3 = 0;Bcnt4 = 0; Scnt1 = 0;Scnt2 = 0;Scnt3 = 0;Scnt4 = 0; Bcnt11 = 0;Bcnt22 = 0;Bcnt33 = 0;Bcnt44 = 0; Scnt11 = 0;Scnt22 = 0;Scnt33 = 0;Scnt44 = 0; Buycnt = 0; Sellcnt = 0; for cnt = 0 to 20{ if sdate == EntryDate(cnt) and EntryTime(cnt) >= 090000 and EntryTime(cnt) <= 151500 Then{ count = count+1; if IsEntryName("b1",cnt) == true Then Bcnt1 = Bcnt1+1; if IsEntryName("b2",cnt) == true Then Bcnt2 = Bcnt2+1; if IsEntryName("b3",cnt) == true Then Bcnt3 = Bcnt3+1; if IsEntryName("b4",cnt) == true Then Bcnt4 = Bcnt4+1; if IsEntryName("s1",cnt) == true Then Scnt1 = Scnt1+1; if IsEntryName("s2",cnt) == true Then Scnt2 = Scnt2+1; if IsEntryName("s3",cnt) == true Then Scnt3 = Scnt3+1; if IsEntryName("s4",cnt) == true Then Scnt4 = Scnt4+1; if IsEntryName("b11",cnt) == true Then Bcnt11 = Bcnt11+1; if IsEntryName("b22",cnt) == true Then Bcnt22 = Bcnt22+1; if IsEntryName("b33",cnt) == true Then Bcnt33 = Bcnt33+1; if IsEntryName("b44",cnt) == true Then Bcnt44 = Bcnt44+1; if IsEntryName("s11",cnt) == true Then Scnt11 = Scnt11+1; if IsEntryName("s22",cnt) == true Then Scnt22 = Scnt22+1; if IsEntryName("s33",cnt) == true Then Scnt33 = Scnt33+1; if IsEntryName("s44",cnt) == true Then Scnt44 = Scnt44+1; if MarketPosition(cnt) == 1 then Buycnt = Buycnt+1; if MarketPosition(cnt) == -1 then SEllcnt = Sellcnt+1; } } if stime >= 090000 and stime <= 151500 then{ Didx = Didx+1; if Didx > 1 Then{ if crossup(C,V1) Then { direction = 1; HH = H; } if crossup(C,V2) Then { direction = 2; HH = H; } if crossup(C,V3) Then { direction = 3; HH = H; } if crossup(C,V4) Then { direction = 4; HH = H; } if CrossDown(C,V1) Then { direction = -1; LL = L; } if CrossDown(C,V2) Then { direction = -2; LL = L; } if CrossDown(C,V3) Then{ direction = -3; LL = L; } if CrossDown(C,V4) Then { direction = -4; LL = L; } if crossup(C,Val1) Then { direction = 11; HH = H; } if crossup(C,Val2) Then { direction = 22; HH = H; } if crossup(C,Val3) Then { direction = 33; HH = H; } if crossup(C,Val4) Then { direction = 44; HH = H; } if CrossDown(C,Val1) Then { direction = -11; LL = L; } if CrossDown(C,Val2) Then { direction = -22; LL = L; } if CrossDown(C,Val3) Then{ direction = -33; LL = L; } if CrossDown(C,Val4) Then { direction = -44; LL = L; } } if H > HH Then HH = H; if L < LL Then LL = L; Bcond1 = (count == 0 and countif(direction == 1 and direction[1] != 1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 1 and direction[1] != 1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 1 and direction[1] != 1,BarsSinceExit(1)) >= 1); Bcond2 = (count == 0 and countif(direction == 2 and direction[1] != 2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 2 and direction[1] != 2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 2 and direction[1] != 2,BarsSinceExit(1)) >= 1); Bcond3 = (count == 0 and countif(direction == 3 and direction[1] != 3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 3 and direction[1] != 3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 3 and direction[1] != 3,BarsSinceExit(1)) >= 1); Bcond4 = (count == 0 and countif(direction == 4 and direction[1] != 4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 4 and direction[1] != 4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 4 and direction[1] != 4,BarsSinceExit(1)) >= 1); Scond1 = (count == 0 and countif(direction == -1 and direction[1] != -1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -1 and direction[1] != -1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -1 and direction[1] != -1,BarsSinceExit(1)) >= 1); Scond2 = (count == 0 and countif(direction == -2 and direction[1] != -2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -2 and direction[1] != -2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -2 and direction[1] != -2,BarsSinceExit(1)) >= 1); Scond3 = (count == 0 and countif(direction == -3 and direction[1] != -3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -3 and direction[1] != -3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -3 and direction[1] != -3,BarsSinceExit(1)) >= 1); Scond4 = (count == 0 and countif(direction == -4 and direction[1] != -4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -4 and direction[1] != -4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -4 and direction[1] != -4,BarsSinceExit(1)) >= 1); Bcond11 = (count == 0 and countif(direction == 11 and direction[1] != 11,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 11 and direction[1] != 11,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 11 and direction[1] != 11,BarsSinceExit(1)) >= 1); Bcond22 = (count == 0 and countif(direction == 22 and direction[1] != 22,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 22 and direction[1] != 22,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 22 and direction[1] != 22,BarsSinceExit(1)) >= 1); Bcond33 = (count == 0 and countif(direction == 33 and direction[1] != 33,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 33 and direction[1] != 33,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 33 and direction[1] != 33,BarsSinceExit(1)) >= 1); Bcond44 = (count == 0 and countif(direction == 44 and direction[1] != 4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 44 and direction[1] != 44,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 44 and direction[1] != 44,BarsSinceExit(1)) >= 1); Scond11 = (count == 0 and countif(direction == -11 and direction[1] != -11,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -11 and direction[1] != -11,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -11 and direction[1] != -11,BarsSinceExit(1)) >= 1); Scond22 = (count == 0 and countif(direction == -22 and direction[1] != -22,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -22 and direction[1] != -22,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -22 and direction[1] != -22,BarsSinceExit(1)) >= 1); Scond33 = (count == 0 and countif(direction == -33 and direction[1] != -33,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -33 and direction[1] != -33,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -33 and direction[1] != -33,BarsSinceExit(1)) >= 1); Scond44 = (count == 0 and countif(direction == -44 and direction[1] != -44,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -44 and direction[1] != -44,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -44 and direction[1] != -44,BarsSinceExit(1)) >= 1); if stime > 090000 and stime < 150000 then{ if BuyCnt < 당일최대매수횟수 then{ if direction == 1 and HH >= V1+0.5 and Bcond1 == true and Bcnt1 < 매수진입별횟수 Then buy("b1",AtLimit,HH-0.4); if direction == 2 and HH >= V2+0.5 and Bcond2 == true and Bcnt2 < 매수진입별횟수 Then buy("b2",AtLimit,HH-0.4); if direction == 3 and HH >= V3+0.5 and Bcond3 == true and Bcnt3 < 매수진입별횟수 Then buy("b3",AtLimit,HH-0.4); if direction == 4 and HH >= V4+0.5 and Bcond4 == true and Bcnt4 < 매수진입별횟수 Then buy("b4",AtLimit,HH-0.4); } if Sellcnt < 당일최대매도횟수 then{ if direction == -1 and LL <= V1-0.5 and Scond1 == true and Scnt1 < 매도진입별횟수 Then Sell("s1",AtLimit,LL+0.4); if direction == -2 and LL <= V2-0.5 and Scond2 == true and Scnt2 < 매도진입별횟수 Then Sell("s2",AtLimit,LL+0.4); if direction == -3 and LL <= V3-0.5 and Scond3 == true and Scnt3 < 매도진입별횟수 Then Sell("s3",AtLimit,LL+0.4); if direction == -4 and LL <= V4-0.5 and Scond4 == true and Scnt4 < 매도진입별횟수 Then Sell("s4",AtLimit,LL+0.4); } if BuyCnt < 당일최대매수횟수 then{ if direction == 11 and HH >= Val1+0.5 and Bcond11 == true and Bcnt11 < 매수진입별횟수 Then buy("b11",AtLimit,HH-0.4); if direction == 22 and HH >= Val2+0.5 and Bcond22 == true and Bcnt22 < 매수진입별횟수 Then buy("b22",AtLimit,HH-0.4); if direction == 33 and HH >= Val3+0.5 and Bcond33 == true and Bcnt33 < 매수진입별횟수 Then buy("b33",AtLimit,HH-0.4); if direction == 44 and HH >= Val4+0.5 and Bcond44 == true and Bcnt44 < 매수진입별횟수 Then buy("b44",AtLimit,HH-0.4); } if Sellcnt < 당일최대매도횟수 then{ if direction == -11 and LL <= Val1-0.5 and Scond11 == true and Scnt11 < 매도진입별횟수 Then Sell("s11",AtLimit,LL+0.4); if direction == -22 and LL <= Val2-0.5 and Scond22 == true and Scnt22 < 매도진입별횟수 Then Sell("s22",AtLimit,LL+0.4); if direction == -33 and LL <= Val3-0.5 and Scond33 == true and Scnt33 < 매도진입별횟수 Then Sell("s33",AtLimit,LL+0.4); if direction == -44 and LL <= Val4-0.5 and Scond44 == true and Scnt44 < 매도진입별횟수 Then Sell("s44",AtLimit,LL+0.4); } } } 즐거운 하루되세요 > 리치존 님이 쓴 글입니다. > 제목 : 수정부탁합니다 감사합니다 > 아래 2가지 시스템식을 통합해서 서로 먼저 조건이 되는 쪽으로 매수 매도를 하게 하고 싶은데 수정부탁드립니다 input : 매수진입별횟수(2),매도진입별횟수(2),당일최대매수횟수(5),당일최대매도횟수(5); var : direction(0),HH(0),LL(0),cnt(0),count(0),기준가(0); var : Bcond1(false),Bcond2(false),Bcond3(false),Bcond4(false),Bcond5(false); var : Scond1(false),Scond2(false),Scond3(false),Scond4(false),Scond5(false); var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0),Didx(0); var : Scnt1(0),Scnt2(0),Scnt3(0),Scnt4(0),Scnt5(0),Buycnt(0),Sellcnt(0); if stime == 180000 or (stime > 180000 and stime[1] < 180000) Then 기준가 = O; var1 = 기준가-4.0; var2 = 기준가-2.0; var3 = 기준가+2.0; var4 = 기준가+4.0; if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{ direction = 0; Didx = 0; } count = 0; Bcnt1 = 0;Bcnt2 = 0;Bcnt3 = 0;Bcnt4 = 0; Scnt1 = 0;Scnt2 = 0;Scnt3 = 0;Scnt4 = 0; Buycnt = 0; Sellcnt = 0; for cnt = 0 to 20{ if sdate == EntryDate(cnt) and EntryTime(cnt) >= 090000 and EntryTime(cnt) <= 151500 Then{ count = count+1; if IsEntryName("b1",cnt) == true Then Bcnt1 = Bcnt1+1; if IsEntryName("b2",cnt) == true Then Bcnt2 = Bcnt2+1; if IsEntryName("b3",cnt) == true Then Bcnt3 = Bcnt3+1; if IsEntryName("b4",cnt) == true Then Bcnt4 = Bcnt4+1; if IsEntryName("s1",cnt) == true Then Scnt1 = Scnt1+1; if IsEntryName("s2",cnt) == true Then Scnt2 = Scnt2+1; if IsEntryName("s3",cnt) == true Then Scnt3 = Scnt3+1; if IsEntryName("s4",cnt) == true Then Scnt4 = Scnt4+1; if MarketPosition(cnt) == 1 then Buycnt = Buycnt+1; if MarketPosition(cnt) == -1 then SEllcnt = Sellcnt+1; } } if stime >= 090000 and stime <= 151500 then{ Didx = Didx+1; if Didx > 1 Then{ if crossup(C,var1) Then { direction = 1; HH = H; } if crossup(C,var2) Then { direction = 2; HH = H; } if crossup(C,var3) Then { direction = 3; HH = H; } if crossup(C,var4) Then { direction = 4; HH = H; } if CrossDown(C,var1) Then { direction = -1; LL = L; } if CrossDown(C,var2) Then { direction = -2; LL = L; } if CrossDown(C,var3) Then{ direction = -3; LL = L; } if CrossDown(C,var4) Then { direction = -4; LL = L; } } if H > HH Then HH = H; if L < LL Then LL = L; Bcond1 = (count == 0 and countif(direction == 1 and direction[1] != 1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 1 and direction[1] != 1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 1 and direction[1] != 1,BarsSinceExit(1)) >= 1); Bcond2 = (count == 0 and countif(direction == 2 and direction[1] != 2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 2 and direction[1] != 2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 2 and direction[1] != 2,BarsSinceExit(1)) >= 1); Bcond3 = (count == 0 and countif(direction == 3 and direction[1] != 3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 3 and direction[1] != 3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 3 and direction[1] != 3,BarsSinceExit(1)) >= 1); Bcond4 = (count == 0 and countif(direction == 4 and direction[1] != 4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 4 and direction[1] != 4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 4 and direction[1] != 4,BarsSinceExit(1)) >= 1); Scond1 = (count == 0 and countif(direction == -1 and direction[1] != -1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -1 and direction[1] != -1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -1 and direction[1] != -1,BarsSinceExit(1)) >= 1); Scond2 = (count == 0 and countif(direction == -2 and direction[1] != -2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -2 and direction[1] != -2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -2 and direction[1] != -2,BarsSinceExit(1)) >= 1); Scond3 = (count == 0 and countif(direction == -3 and direction[1] != -3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -3 and direction[1] != -3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -3 and direction[1] != -3,BarsSinceExit(1)) >= 1); Scond4 = (count == 0 and countif(direction == -4 and direction[1] != -4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -4 and direction[1] != -4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -4 and direction[1] != -4,BarsSinceExit(1)) >= 1); if stime > 090000 and stime < 150000 then{ if BuyCnt < 당일최대매수횟수 then{ if direction == 1 and HH >= var1+0.5 and Bcond1 == true and Bcnt1 < 매수진입별횟수 Then buy("b1",AtLimit,HH-0.4); if direction == 2 and HH >= var2+0.5 and Bcond2 == true and Bcnt2 < 매수진입별횟수 Then buy("b2",AtLimit,HH-0.4); if direction == 3 and HH >= var3+0.5 and Bcond3 == true and Bcnt3 < 매수진입별횟수 Then buy("b3",AtLimit,HH-0.4); if direction == 4 and HH >= var4+0.5 and Bcond4 == true and Bcnt4 < 매수진입별횟수 Then buy("b4",AtLimit,HH-0.4); } if Sellcnt < 당일최대매도횟수 then{ if direction == -1 and LL <= var1-0.5 and Scond1 == true and Scnt1 < 매도진입별횟수 Then Sell("s1",AtLimit,LL+0.4); if direction == -2 and LL <= var2-0.5 and Scond2 == true and Scnt2 < 매도진입별횟수 Then Sell("s2",AtLimit,LL+0.4); if direction == -3 and LL <= var3-0.5 and Scond3 == true and Scnt3 < 매도진입별횟수 Then Sell("s3",AtLimit,LL+0.4); if direction == -4 and LL <= var4-0.5 and Scond4 == true and Scnt4 < 매도진입별횟수 Then Sell("s4",AtLimit,LL+0.4); } } } input : 매수진입별횟수(2),매도진입별횟수(2),당일최대매수횟수(5),당일최대매도횟수(5); var : direction(0),HH(0),LL(0),cnt(0),count(0),기준가(0); var : Bcond1(false),Bcond2(false),Bcond3(false),Bcond4(false),Bcond5(false); var : Scond1(false),Scond2(false),Scond3(false),Scond4(false),Scond5(false); var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0),Didx(0); var : Scnt1(0),Scnt2(0),Scnt3(0),Scnt4(0),Scnt5(0),Buycnt(0),Sellcnt(0); if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then 기준가 = 0; var1 = 기준가-4.0; var2 = 기준가-2.0; var3 = 기준가+2.0; var4 = 기준가+4.0; if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{ direction = 0; Didx = 0; } count = 0; Bcnt1 = 0;Bcnt2 = 0;Bcnt3 = 0;Bcnt4 = 0; Scnt1 = 0;Scnt2 = 0;Scnt3 = 0;Scnt4 = 0; Buycnt = 0; Sellcnt = 0; for cnt = 0 to 20{ if sdate == EntryDate(cnt) and EntryTime(cnt) >= 090000 and EntryTime(cnt) <= 151500 Then{ count = count+1; if IsEntryName("b1",cnt) == true Then Bcnt1 = Bcnt1+1; if IsEntryName("b2",cnt) == true Then Bcnt2 = Bcnt2+1; if IsEntryName("b3",cnt) == true Then Bcnt3 = Bcnt3+1; if IsEntryName("b4",cnt) == true Then Bcnt4 = Bcnt4+1; if IsEntryName("s1",cnt) == true Then Scnt1 = Scnt1+1; if IsEntryName("s2",cnt) == true Then Scnt2 = Scnt2+1; if IsEntryName("s3",cnt) == true Then Scnt3 = Scnt3+1; if IsEntryName("s4",cnt) == true Then Scnt4 = Scnt4+1; if MarketPosition(cnt) == 1 then Buycnt = Buycnt+1; if MarketPosition(cnt) == -1 then SEllcnt = Sellcnt+1; } } if stime >= 090000 and stime <= 151500 then{ Didx = Didx+1; if Didx > 1 Then{ if crossup(C,var1) Then { direction = 1; HH = H; } if crossup(C,var2) Then { direction = 2; HH = H; } if crossup(C,var3) Then { direction = 3; HH = H; } if crossup(C,var4) Then { direction = 4; HH = H; } if CrossDown(C,var1) Then { direction = -1; LL = L; } if CrossDown(C,var2) Then { direction = -2; LL = L; } if CrossDown(C,var3) Then{ direction = -3; LL = L; } if CrossDown(C,var4) Then { direction = -4; LL = L; } } if H > HH Then HH = H; if L < LL Then LL = L; Bcond1 = (count == 0 and countif(direction == 1 and direction[1] != 1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 1 and direction[1] != 1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 1 and direction[1] != 1,BarsSinceExit(1)) >= 1); Bcond2 = (count == 0 and countif(direction == 2 and direction[1] != 2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 2 and direction[1] != 2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 2 and direction[1] != 2,BarsSinceExit(1)) >= 1); Bcond3 = (count == 0 and countif(direction == 3 and direction[1] != 3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 3 and direction[1] != 3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 3 and direction[1] != 3,BarsSinceExit(1)) >= 1); Bcond4 = (count == 0 and countif(direction == 4 and direction[1] != 4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == 4 and direction[1] != 4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == 4 and direction[1] != 4,BarsSinceExit(1)) >= 1); Scond1 = (count == 0 and countif(direction == -1 and direction[1] != -1,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -1 and direction[1] != -1,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -1 and direction[1] != -1,BarsSinceExit(1)) >= 1); Scond2 = (count == 0 and countif(direction == -2 and direction[1] != -2,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -2 and direction[1] != -2,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -2 and direction[1] != -2,BarsSinceExit(1)) >= 1); Scond3 = (count == 0 and countif(direction == -3 and direction[1] != -3,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -3 and direction[1] != -3,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -3 and direction[1] != -3,BarsSinceExit(1)) >= 1); Scond4 = (count == 0 and countif(direction == -4 and direction[1] != -4,Didx) >= 1) or (count >= 1 and MarketPosition != 0 and countif(direction == -4 and direction[1] != -4,BarsSinceEntry) >= 1) or (count >= 1 and MarketPosition == 0 and countif(direction == -4 and direction[1] != -4,BarsSinceExit(1)) >= 1); if stime > 090000 and stime < 150000 then{ if BuyCnt < 당일최대매수횟수 then{ if direction == 1 and HH >= var1+0.5 and Bcond1 == true and Bcnt1 < 매수진입별횟수 Then buy("b1",AtLimit,HH-0.4); if direction == 2 and HH >= var2+0.5 and Bcond2 == true and Bcnt2 < 매수진입별횟수 Then buy("b2",AtLimit,HH-0.4); if direction == 3 and HH >= var3+0.5 and Bcond3 == true and Bcnt3 < 매수진입별횟수 Then buy("b3",AtLimit,HH-0.4); if direction == 4 and HH >= var4+0.5 and Bcond4 == true and Bcnt4 < 매수진입별횟수 Then buy("b4",AtLimit,HH-0.4); } if Sellcnt < 당일최대매도횟수 then{ if direction == -1 and LL <= var1-0.5 and Scond1 == true and Scnt1 < 매도진입별횟수 Then Sell("s1",AtLimit,LL+0.4); if direction == -2 and LL <= var2-0.5 and Scond2 == true and Scnt2 < 매도진입별횟수 Then Sell("s2",AtLimit,LL+0.4); if direction == -3 and LL <= var3-0.5 and Scond3 == true and Scnt3 < 매도진입별횟수 Then Sell("s3",AtLimit,LL+0.4); if direction == -4 and LL <= var4-0.5 and Scond4 == true and Scnt4 < 매도진입별횟수 Then Sell("s4",AtLimit,LL+0.4); } } }