커뮤니티

문의드립니다.

프로필 이미지
회원
2013-06-11 15:34:36
231
글번호 64215
답변완료
안녕하세요. 아래 수식에서 잘 안풀리는 부분이 있네요. y=2일때는 직전포지션이 매수일때 수익청산후, 고점대비 rebound% 만큼 하락했을때에 한해서 매수를 진입하라는 부분이 있습니다.(그렇지 않으면 매도만...) 물론 반대로 매도로 수익청산한 경우엔 저점대비 rebound% 올라왔을때만 동방향(매도) 진입이 가능해야 하는데... 수익청산후 동방향 신호가 같은 봉에서 그대로 나오는데, 어디가 잘못된건지 수정 좀 부탁드립니다. 감사합니다. ---------------------------------------------------------------------------- input : st(91500),st2(120000),x(1),y(2),Profit(0.5),loss(1),rebound(0.5); var : Xcond(false),Ycond(0); var : UPA2(0),DnA2(0),UPA3(0),DnA3(0),UPA4(0),DnA4(0); var : UPB2(0),DnB2(0),UPB3(0),DnB3(0),UPB4(0),DnB4(0); var : A2(0),A3(0),A4(0),B2(0),B3(0),B4(0); UpA2 = iff(A2 > A2[1],1,0); UpA3 = iff(A3 > A3[1],1,0); UpA4 = iff(A4 > A4[1],1,0); UpB2 = iff(B2 > B2[1],1,0); UpB3 = iff(B3 > B3[1],1,0); UpB4 = iff(B4 > B4[1],1,0); DnA2 = iff(A2 < A2[1],1,0); DnA3 = iff(A3 < A3[1],1,0); DnA4 = iff(A4 < A4[1],1,0); DnB2 = iff(B2 < B2[1],1,0); DnB3 = iff(B3 < B3[1],1,0); DnB4 = iff(B4 < B4[1],1,0); var1 = NetProfit; if date != date[1] Then var2 = var1[1]; var3 = NetProfit-var2+PositionProfit; XCond = X == 0 and MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BLoss",1) or IsExitName("SLoss",1)); Ycond = 0; if MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BP1",1) or IsExitName("BP2",1) or IsExitName("SP1",1) or IsExitName("SP2",1)) Then{ if Y == 0 Then Ycond = 99; if Y == 1 Then{ if Y != 0 and MarketPosition(1) == 1 Then Ycond = 1; if Y != 0 and MarketPosition(1) == -1 Then Ycond = -1; } if Y == 2 Then{ if MarketPosition(1) == 1 and C > dayhigh*(1-rebound/100) Then Ycond = 99; if MarketPosition(1) == -1 and C <= daylow*(1+rebound/100) Then Ycond = 99; } } if Xcond == false and stime >= st and stime < st2 then{ if (Ycond == 0 or Ycond == -1) and (UpA2+UpA3+UpA4) >= 3 and (UpB2+UpB3+UpB4) >= 3 Then buy("시초매수"); if (Ycond == 0 or Ycond == 1) and (DnA2+DnA3+DnA4) >= 3 and (DnB2+DnB3+DnB4) >= 3 Then sell("시초매도"); if ((DnA2+DnA3+DnA4) >= 2 and (DnB2+DnB3+DnB4) >= 2) Then ExitLong("bx1"); if ((UpA2+UpA3+UpA4) >= 2 and (UpB2+UpB3+UpB4) >= 2) Then ExitShort("sx1"); } if Xcond == false and stime >= st2 and stime < 144500 and var3 > -Loss*2 then{ if (Ycond == 0 or Ycond == -1) and ((UpA2+UpA3+UpA4) >= 3 and (UpB2+UpB3+UpB4) >= 1) or ((UpA2+UpA3+UpA4) >= 1 and (UpB2+UpB3+UpB4) >= 3) Then buy("장중매수"); if (Ycond == 0 or Ycond == 1) and ((DnA2+DnA3+DnA4) >= 3 and (DnB2+DnB3+DnB4) >= 1) or ((DnA2+DnA3+DnA4) >=1 and (DnB2+DnB3+DnB4) >= 3) Then sell("장중매도"); if ((DnA2+DnA3+DnA4) >= 2 and (DnB2+DnB3+DnB4) >= 1) or ((DnA2+DnA3+DnA4) >= 1 and (DnB2+DnB3+DnB4) >= 2) Then ExitLong("bx2"); if ((UpA2+UpA3+UpA4) >= 2 and (UpB2+UpB3+UpB4) >= 1) or ((UpA2+UpA3+UpA4) >= 1 and (UpB2+UpB3+UpB4) >= 2) Then ExitShort("sx2"); } if MarketPosition == 1 Then{ ExitLong("BLoss",AtStop,highest(H,BarsSinceEntry)*(1-loss/100)); if EntryTime < st2 Then ExitLong("BP1",atlimit,EntryPrice*(1+Profit/100)); Else ExitLong("BP2",atlimit,EntryPrice*1.003); } if MarketPosition == -1 Then{ ExitShort("SLoss",AtStop,lowest(L,BarsSinceEntry)*(1+loss/100)); if EntryTime < st2 Then ExitShort("SP1",atlimit,EntryPrice*(1-Profit/100)); Else ExitShort("SP2",atlimit,EntryPrice*0.997); } SetStopEndofday(150000);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-06-11 18:27:26

안녕하세요 예스스탁입니다. 식을 수정했습니다. 아래식으로 테스트 해보시기 바랍니다. input : st(91500),st2(120000),x(1),y(2),Profit(0.5),loss(1),rebound(0.5); var : Xcond(false),Ycond(0); var : UPA2(0),DnA2(0),UPA3(0),DnA3(0),UPA4(0),DnA4(0); var : UPB2(0),DnB2(0),UPB3(0),DnB3(0),UPB4(0),DnB4(0); var : A2(0),A3(0),A4(0),B2(0),B3(0),B4(0); UpA2 = iff(A2 > A2[1],1,0); UpA3 = iff(A3 > A3[1],1,0); UpA4 = iff(A4 > A4[1],1,0); UpB2 = iff(B2 > B2[1],1,0); UpB3 = iff(B3 > B3[1],1,0); UpB4 = iff(B4 > B4[1],1,0); DnA2 = iff(A2 < A2[1],1,0); DnA3 = iff(A3 < A3[1],1,0); DnA4 = iff(A4 < A4[1],1,0); DnB2 = iff(B2 < B2[1],1,0); DnB3 = iff(B3 < B3[1],1,0); DnB4 = iff(B4 < B4[1],1,0); var1 = NetProfit; if date != date[1] Then var2 = var1[1]; var3 = NetProfit-var2+PositionProfit; XCond = X == 0 and MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BLoss",1) or IsExitName("SLoss",1)); Ycond = 0; if MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BP1",1) or IsExitName("BP2",1) or IsExitName("SP1",1) or IsExitName("SP2",1)) Then{ if Y == 0 Then Ycond = 99; if Y == 1 Then{ if Y != 0 and MarketPosition(1) == 1 Then Ycond = 1; if Y != 0 and MarketPosition(1) == -1 Then Ycond = -1; } if Y == 2 Then{ if MarketPosition(1) == 1 Then Ycond = 2; if MarketPosition(1) == -1 Then Ycond = -2; } } if Xcond == false and stime >= st and stime < st2 then{ if (Ycond == 0 or Ycond == -1 or (Ycond == 2 and C < dayhigh*(1-rebound/100))) and (UpA2+UpA3+UpA4) >= 3 and (UpB2+UpB3+UpB4) >= 3 Then buy("시초매수"); if (Ycond == 0 or Ycond == 1 or (Ycond == -2 and C > daylow*(1+rebound/100))) and (DnA2+DnA3+DnA4) >= 3 and (DnB2+DnB3+DnB4) >= 3 Then sell("시초매도"); if ((DnA2+DnA3+DnA4) >= 2 and (DnB2+DnB3+DnB4) >= 2) Then ExitLong("bx1"); if ((UpA2+UpA3+UpA4) >= 2 and (UpB2+UpB3+UpB4) >= 2) Then ExitShort("sx1"); } if Xcond == false and stime >= st2 and stime < 144500 and var3 > -Loss*2 then{ if (Ycond == 0 or Ycond == -1 or (Ycond == 2 and C < dayhigh*(1-rebound/100))) and ((UpA2+UpA3+UpA4) >= 3 and (UpB2+UpB3+UpB4) >= 1) or ((UpA2+UpA3+UpA4) >= 1 and (UpB2+UpB3+UpB4) >= 3) Then buy("장중매수"); if (Ycond == 0 or Ycond == 1 or (Ycond == -2 and C > daylow*(1+rebound/100))) and ((DnA2+DnA3+DnA4) >= 3 and (DnB2+DnB3+DnB4) >= 1) or ((DnA2+DnA3+DnA4) >=1 and (DnB2+DnB3+DnB4) >= 3) Then sell("장중매도"); if ((DnA2+DnA3+DnA4) >= 2 and (DnB2+DnB3+DnB4) >= 1) or ((DnA2+DnA3+DnA4) >= 1 and (DnB2+DnB3+DnB4) >= 2) Then ExitLong("bx2"); if ((UpA2+UpA3+UpA4) >= 2 and (UpB2+UpB3+UpB4) >= 1) or ((UpA2+UpA3+UpA4) >= 1 and (UpB2+UpB3+UpB4) >= 2) Then ExitShort("sx2"); } if MarketPosition == 1 Then{ ExitLong("BLoss",AtStop,highest(H,BarsSinceEntry)*(1-loss/100)); if EntryTime < st2 Then ExitLong("BP1",atlimit,EntryPrice*(1+Profit/100)); Else ExitLong("BP2",atlimit,EntryPrice*1.003); } if MarketPosition == -1 Then{ ExitShort("SLoss",AtStop,lowest(L,BarsSinceEntry)*(1+loss/100)); if EntryTime < st2 Then ExitShort("SP1",atlimit,EntryPrice*(1-Profit/100)); Else ExitShort("SP2",atlimit,EntryPrice*0.997); } SetStopEndofday(150000); 즐거운 하루되세요 > HI_jhy6835 님이 쓴 글입니다. > 제목 : 문의드립니다. > 안녕하세요. 아래 수식에서 잘 안풀리는 부분이 있네요. y=2일때는 직전포지션이 매수일때 수익청산후, 고점대비 rebound% 만큼 하락했을때에 한해서 매수를 진입하라는 부분이 있습니다.(그렇지 않으면 매도만...) 물론 반대로 매도로 수익청산한 경우엔 저점대비 rebound% 올라왔을때만 동방향(매도) 진입이 가능해야 하는데... 수익청산후 동방향 신호가 같은 봉에서 그대로 나오는데, 어디가 잘못된건지 수정 좀 부탁드립니다. 감사합니다. ---------------------------------------------------------------------------- input : st(91500),st2(120000),x(1),y(2),Profit(0.5),loss(1),rebound(0.5); var : Xcond(false),Ycond(0); var : UPA2(0),DnA2(0),UPA3(0),DnA3(0),UPA4(0),DnA4(0); var : UPB2(0),DnB2(0),UPB3(0),DnB3(0),UPB4(0),DnB4(0); var : A2(0),A3(0),A4(0),B2(0),B3(0),B4(0); UpA2 = iff(A2 > A2[1],1,0); UpA3 = iff(A3 > A3[1],1,0); UpA4 = iff(A4 > A4[1],1,0); UpB2 = iff(B2 > B2[1],1,0); UpB3 = iff(B3 > B3[1],1,0); UpB4 = iff(B4 > B4[1],1,0); DnA2 = iff(A2 < A2[1],1,0); DnA3 = iff(A3 < A3[1],1,0); DnA4 = iff(A4 < A4[1],1,0); DnB2 = iff(B2 < B2[1],1,0); DnB3 = iff(B3 < B3[1],1,0); DnB4 = iff(B4 < B4[1],1,0); var1 = NetProfit; if date != date[1] Then var2 = var1[1]; var3 = NetProfit-var2+PositionProfit; XCond = X == 0 and MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BLoss",1) or IsExitName("SLoss",1)); Ycond = 0; if MarketPosition == 0 and ExitDate(1) == sdate and (IsExitName("BP1",1) or IsExitName("BP2",1) or IsExitName("SP1",1) or IsExitName("SP2",1)) Then{ if Y == 0 Then Ycond = 99; if Y == 1 Then{ if Y != 0 and MarketPosition(1) == 1 Then Ycond = 1; if Y != 0 and MarketPosition(1) == -1 Then Ycond = -1; } if Y == 2 Then{ if MarketPosition(1) == 1 and C > dayhigh*(1-rebound/100) Then Ycond = 99; if MarketPosition(1) == -1 and C <= daylow*(1+rebound/100) Then Ycond = 99; } } if Xcond == false and stime >= st and stime < st2 then{ if (Ycond == 0 or Ycond == -1) and (UpA2+UpA3+UpA4) >= 3 and (UpB2+UpB3+UpB4) >= 3 Then buy("시초매수"); if (Ycond == 0 or Ycond == 1) and (DnA2+DnA3+DnA4) >= 3 and (DnB2+DnB3+DnB4) >= 3 Then sell("시초매도"); if ((DnA2+DnA3+DnA4) >= 2 and (DnB2+DnB3+DnB4) >= 2) Then ExitLong("bx1"); if ((UpA2+UpA3+UpA4) >= 2 and (UpB2+UpB3+UpB4) >= 2) Then ExitShort("sx1"); } if Xcond == false and stime >= st2 and stime < 144500 and var3 > -Loss*2 then{ if (Ycond == 0 or Ycond == -1) and ((UpA2+UpA3+UpA4) >= 3 and (UpB2+UpB3+UpB4) >= 1) or ((UpA2+UpA3+UpA4) >= 1 and (UpB2+UpB3+UpB4) >= 3) Then buy("장중매수"); if (Ycond == 0 or Ycond == 1) and ((DnA2+DnA3+DnA4) >= 3 and (DnB2+DnB3+DnB4) >= 1) or ((DnA2+DnA3+DnA4) >=1 and (DnB2+DnB3+DnB4) >= 3) Then sell("장중매도"); if ((DnA2+DnA3+DnA4) >= 2 and (DnB2+DnB3+DnB4) >= 1) or ((DnA2+DnA3+DnA4) >= 1 and (DnB2+DnB3+DnB4) >= 2) Then ExitLong("bx2"); if ((UpA2+UpA3+UpA4) >= 2 and (UpB2+UpB3+UpB4) >= 1) or ((UpA2+UpA3+UpA4) >= 1 and (UpB2+UpB3+UpB4) >= 2) Then ExitShort("sx2"); } if MarketPosition == 1 Then{ ExitLong("BLoss",AtStop,highest(H,BarsSinceEntry)*(1-loss/100)); if EntryTime < st2 Then ExitLong("BP1",atlimit,EntryPrice*(1+Profit/100)); Else ExitLong("BP2",atlimit,EntryPrice*1.003); } if MarketPosition == -1 Then{ ExitShort("SLoss",AtStop,lowest(L,BarsSinceEntry)*(1+loss/100)); if EntryTime < st2 Then ExitShort("SP1",atlimit,EntryPrice*(1-Profit/100)); Else ExitShort("SP2",atlimit,EntryPrice*0.997); } SetStopEndofday(150000);