커뮤니티

문의드립니다

프로필 이미지
호정0688
2021-10-27 18:50:23
695
글번호 153204
답변완료
혹시 이게 가능한지요? 신호가 나오는 캔들의 종가에 매수나 매도 진입인데요. 종가에 바로 진입하지 않고 조정받았다가 종가를 돌파할때 매수나 매도 진입 가능하게 수식을 짤 수 있나요? 즉, 신호가 나왔어도 조정받고 다시 종가를 돌파할 때 매수, 다시 종가를 깰 때 매도, 이렇게 진입이 조정 가능한지 질문 드립니다. 가능하다면 아래 수식에 첨가해 주시면 감사하겠습니다. input : StartTime(101200),EndTime(114000); input : Length(20), D1(2); input : 익절1(30),손절1(30),청산구분시간(103000),익절2(50),손절2(30),익절연속횟수(3),손절연속횟수(2); var : Tcond(false),profit(0),loss(0); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; profit = 0; loss = 0; } if TotalTrades > TotalTrades[1] Then { if IsExitName("bp1.",1) or IsExitName("bp2.",21) or IsExitName("bp1",1) or IsExitName("bp2",21) or IsExitName("sp1.",1) or IsExitName("sp2.",1) or IsExitName("sp1",1) or IsExitName("sp2",1) Then profit = profit+1; Else profit = 0; if IsExitName("bl1.",1) or IsExitName("bl2.",1) or IsExitName("bl1",1) or IsExitName("bl2",1) or IsExitName("sl1.",1) or IsExitName("sl2.",1) or IsExitName("sl1",1) or IsExitName("sl2",1) Then loss = loss+1; Else loss = 0; } var1 = BollBandUp(Length,D1); var2 = BollBandDown(Length,D1); if Tcond == true Then { If CrossUP(H,var1) and (c > o or (C==O and C >= C[1])) and profit < 익절연속횟수 and loss < 손절연속횟수 then { Buy("b",OnClose,DEF,1); if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1.",AtLimit,C+PriceScale*익절1,"",1,1); ExitLong("bl1.",AtStop,C-PriceScale*손절1,"",1,1); } if sTime >= 청산구분시간 and sTime < Endtime Then { ExitLong("bp2.",AtLimit,C+PriceScale*익절2,"",1,1); ExitLong("bl2.",AtStop,C-PriceScale*손절2,"",1,1); } } If CrossDown(L,Var2) and (C < O or (C==O and C < C[1])) and profit < 익절연속횟수 and loss < 손절연속횟수 then { Sell("s",OnClose,DEF,1); if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1.",AtLimit,C-PriceScale*익절1,"",1,1); ExitShort("sl1.",AtStop,C+PriceScale*손절1,"",1,1); } if sTime >= 103000 and sTime < Endtime Then { ExitShort("sp2.",AtLimit,C-PriceScale*익절2,"",1,1); ExitShort("sl2.",AtStop,C+PriceScale*손절2,"",1,1); } } } if MarketPosition == 1 Then { if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1",AtLimit,EntryPrice+PriceScale*익절1,"",1,1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1,"",1,1); } if sTime >= 청산구분시간 and sTime < Endtime Then { ExitLong("bp2",AtLimit,EntryPrice+PriceScale*익절2,"",1,1); ExitLong("bl2",AtStop,EntryPrice-PriceScale*손절2,"",1,1); } } if MarketPosition == -1 Then { if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1,"",1,1); ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1,"",1,1); } if sTime >= 103000 and sTime < Endtime Then { ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2,"",1,1); ExitShort("sl2",AtStop,EntryPrice+PriceScale*손절2,"",1,1); } } IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { IF Endtime <= starttime Then { SetStopEndofday(0); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-10-28 16:26:57

안녕하세요 예스스탁입니다. 돌파만족시 값과 방향을 저장하고 해당값 이용해 이후 신호가 발생하게 하시면 됩니다. 수식내 주석 참고하시기 바랍니다. input : StartTime(101200),EndTime(114000); input : Length(20), D1(2); input : 익절1(30),손절1(30),청산구분시간(103000),익절2(50),손절2(30),익절연속횟수(3),손절연속횟수(2); var : Tcond(false),profit(0),loss(0),T(0),S(0); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { T = 0; Tcond = true; profit = 0; loss = 0; } if TotalTrades > TotalTrades[1] Then { if IsExitName("bp1.",1) or IsExitName("bp2.",21) or IsExitName("bp1",1) or IsExitName("bp2",21) or IsExitName("sp1.",1) or IsExitName("sp2.",1) or IsExitName("sp1",1) or IsExitName("sp2",1) Then profit = profit+1; Else profit = 0; if IsExitName("bl1.",1) or IsExitName("bl2.",1) or IsExitName("bl1",1) or IsExitName("bl2",1) or IsExitName("sl1.",1) or IsExitName("sl2.",1) or IsExitName("sl1",1) or IsExitName("sl2",1) Then loss = loss+1; Else loss = 0; } var1 = BollBandUp(Length,D1); var2 = BollBandDown(Length,D1); if Tcond == true Then { #매수조건만족하면 T에 1, 해당봉종가는 S에 저장 If CrossUP(H,var1) and (c > o or (C==O and C >= C[1])) then { T = 1; S = C; } #매도조건만족하면 T에 -1, 해당봉종가는 S에 저장 If CrossDown(L,Var2) and (C < O or (C==O and C < C[1])) then { T = -1; S = C; } #T가 1인 상태이고 S를 상향돌파하면 If T == 1 and CrossUP(c,S) then { #T는 2로 변경하고 T = 2; #매수 if profit < 익절연속횟수 and loss < 손절연속횟수 then { Buy("b",OnClose,DEF,1); if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1.",AtLimit,C+PriceScale*익절1,"",1,1); ExitLong("bl1.",AtStop,C-PriceScale*손절1,"",1,1); } if sTime >= 청산구분시간 and sTime < Endtime Then { ExitLong("bp2.",AtLimit,C+PriceScale*익절2,"",1,1); ExitLong("bl2.",AtStop,C-PriceScale*손절2,"",1,1); } } } #T가 -1인 상태에서 S를 하향이탈하면 If T == -1 and crossdown(C,S) then { #T는 -2로 변경 T = -2; #매도 if profit < 익절연속횟수 and loss < 손절연속횟수 then { Sell("s",OnClose,DEF,1); if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1.",AtLimit,C-PriceScale*익절1,"",1,1); ExitShort("sl1.",AtStop,C+PriceScale*손절1,"",1,1); } if sTime >= 103000 and sTime < Endtime Then { ExitShort("sp2.",AtLimit,C-PriceScale*익절2,"",1,1); ExitShort("sl2.",AtStop,C+PriceScale*손절2,"",1,1); } } } } if MarketPosition == 1 Then { if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1",AtLimit,EntryPrice+PriceScale*익절1,"",1,1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1,"",1,1); } if sTime >= 청산구분시간 and sTime < Endtime Then { ExitLong("bp2",AtLimit,EntryPrice+PriceScale*익절2,"",1,1); ExitLong("bl2",AtStop,EntryPrice-PriceScale*손절2,"",1,1); } } if MarketPosition == -1 Then { if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1,"",1,1); ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1,"",1,1); } if sTime >= 103000 and sTime < Endtime Then { ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2,"",1,1); ExitShort("sl2",AtStop,EntryPrice+PriceScale*손절2,"",1,1); } } IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { IF Endtime <= starttime Then { SetStopEndofday(0); } } 즐거운 하루되세요 > 호정0688 님이 쓴 글입니다. > 제목 : 문의드립니다 > 혹시 이게 가능한지요? 신호가 나오는 캔들의 종가에 매수나 매도 진입인데요. 종가에 바로 진입하지 않고 조정받았다가 종가를 돌파할때 매수나 매도 진입 가능하게 수식을 짤 수 있나요? 즉, 신호가 나왔어도 조정받고 다시 종가를 돌파할 때 매수, 다시 종가를 깰 때 매도, 이렇게 진입이 조정 가능한지 질문 드립니다. 가능하다면 아래 수식에 첨가해 주시면 감사하겠습니다. input : StartTime(101200),EndTime(114000); input : Length(20), D1(2); input : 익절1(30),손절1(30),청산구분시간(103000),익절2(50),손절2(30),익절연속횟수(3),손절연속횟수(2); var : Tcond(false),profit(0),loss(0); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; profit = 0; loss = 0; } if TotalTrades > TotalTrades[1] Then { if IsExitName("bp1.",1) or IsExitName("bp2.",21) or IsExitName("bp1",1) or IsExitName("bp2",21) or IsExitName("sp1.",1) or IsExitName("sp2.",1) or IsExitName("sp1",1) or IsExitName("sp2",1) Then profit = profit+1; Else profit = 0; if IsExitName("bl1.",1) or IsExitName("bl2.",1) or IsExitName("bl1",1) or IsExitName("bl2",1) or IsExitName("sl1.",1) or IsExitName("sl2.",1) or IsExitName("sl1",1) or IsExitName("sl2",1) Then loss = loss+1; Else loss = 0; } var1 = BollBandUp(Length,D1); var2 = BollBandDown(Length,D1); if Tcond == true Then { If CrossUP(H,var1) and (c > o or (C==O and C >= C[1])) and profit < 익절연속횟수 and loss < 손절연속횟수 then { Buy("b",OnClose,DEF,1); if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1.",AtLimit,C+PriceScale*익절1,"",1,1); ExitLong("bl1.",AtStop,C-PriceScale*손절1,"",1,1); } if sTime >= 청산구분시간 and sTime < Endtime Then { ExitLong("bp2.",AtLimit,C+PriceScale*익절2,"",1,1); ExitLong("bl2.",AtStop,C-PriceScale*손절2,"",1,1); } } If CrossDown(L,Var2) and (C < O or (C==O and C < C[1])) and profit < 익절연속횟수 and loss < 손절연속횟수 then { Sell("s",OnClose,DEF,1); if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1.",AtLimit,C-PriceScale*익절1,"",1,1); ExitShort("sl1.",AtStop,C+PriceScale*손절1,"",1,1); } if sTime >= 103000 and sTime < Endtime Then { ExitShort("sp2.",AtLimit,C-PriceScale*익절2,"",1,1); ExitShort("sl2.",AtStop,C+PriceScale*손절2,"",1,1); } } } if MarketPosition == 1 Then { if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1",AtLimit,EntryPrice+PriceScale*익절1,"",1,1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1,"",1,1); } if sTime >= 청산구분시간 and sTime < Endtime Then { ExitLong("bp2",AtLimit,EntryPrice+PriceScale*익절2,"",1,1); ExitLong("bl2",AtStop,EntryPrice-PriceScale*손절2,"",1,1); } } if MarketPosition == -1 Then { if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1,"",1,1); ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1,"",1,1); } if sTime >= 103000 and sTime < Endtime Then { ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2,"",1,1); ExitShort("sl2",AtStop,EntryPrice+PriceScale*손절2,"",1,1); } } IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { IF Endtime <= starttime Then { SetStopEndofday(0); } }