커뮤니티

문의 드립니다.

프로필 이미지
호정0688
2021-11-01 11:18:34
664
글번호 153295
답변완료

첨부 이미지

지난번에 수식 검증을 한번 받은 것인데, 오늘 잘못되어 나오는 부분이 있어 다시 한번 확인 부탁드립니다. # 15분 시작에 매수 신호가 나왔어도, 매수는 양봉에만 진입하는 것이므로 18분봉에 진입하지 않아야 하는데 진입되었습니다. 혹시 거래시간을 101200으로 해서 그런건지요? 조건이 만족할 시 매수는 양봉에만, 매도는 음봉에만 진입하는 것이 적용된 것인지요? 수식에 주석 달아 주시면 좋겠습니다. # 추가로 종가에 매수 매도 신호가 나오고 다음 봉에서 진입할 때에 진입가격을 재 돌파할 시 매수 매도 들어가게 하는 수식에 대해 별도로 주시면 좋겠습니다. --- 아래에 해당 수식과 거래된 파일 자료 남겨드립니다. 감사합니다~~ 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-11-02 14:56:07

안녕하세요 예스스탁입니다. 1 현재 수식이 10시12분이후에 조건만족하면 진입하게 되어 있고 양봉이거나 양봉도지(빨간색도지)일때 매수진입 음봉이거나 음봉도지(파란색도지)일때 매도진입으로 되어 있습니다. 첨부하신 그림에서 10시15분봉(stime은 101200) 매수진입은 양봉도지이고 crossup(H,var1)조건이 만족해서 신호가 발생했습니다. plot1(stime); 시간설정은 차트에서 사용하시는 주기에서 stime을 확인하고 지정해 주셔야 합니다. 위 지표 적용하시면 각 봉의 stime을 확인하실수 있습니다. 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); #지정한 EndTime이후 첫봉이 되면 Tcond는 False if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; #지정한 StartTime이후 첫봉이 되면 #Tcond는 true #연속수익 체크변수는 값을 0으로 초기화 #연속손실 체크변수는 값을 0으로 초기화 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 { #수익청산이 발생하면 profit은 1씩 증가 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; #profit은 0 #손실산이 발생하면 loss는 1씩 증가 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 #손실청산이 아니면 0 loss = 0; } #볼밴상단 var1 = BollBandUp(Length,D1); #볼밴하단 var2 = BollBandDown(Length,D1); #지정한 StartTime~endtime사이이고 if Tcond == true Then { #고가가 볼밴상단을 돌파하고 양봉이거나 양봉도지이고 연속익절 3회미만이고 연속손절은 2회미만이면 매수진입 If CrossUP(H,var1) and (c > o or (C==O and C >= C[1])) and profit < 익절연속횟수 and loss < 손절연속횟수 then { Buy("b",OnClose,DEF,1); #매수진입과 동시셋팅되어 다음봉에 발생하는 익절과 손절 #StartTime~청산구분시간 사이이면 #익절1이상 수익이거나 손절1이상 손실이면 청산 if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1.",AtLimit,C+PriceScale*익절1,"",1,1); ExitLong("bl1.",AtStop,C-PriceScale*손절1,"",1,1); } #청산구분시간~Endtime 사이이면 #익절2이상 수익이거나 손절2이상 손실이면 청산 if sTime >= 청산구분시간 and sTime < Endtime Then { ExitLong("bp2.",AtLimit,C+PriceScale*익절2,"",1,1); ExitLong("bl2.",AtStop,C-PriceScale*손절2,"",1,1); } } #저가가 볼밴하단을 이탈하고 음봉이거나 음봉도지이고 연속익절 3회미만이고 연속손절은 2회미만이면 매도진입 If CrossDown(L,Var2) and (C < O or (C==O and C < C[1])) and profit < 익절연속횟수 and loss < 손절연속횟수 then { Sell("s",OnClose,DEF,1); #매도진입과 동시셋팅되어 다음봉에 발생하는 익절과 손절 #StartTime~청산구분시간 사이이면 #익절1이상 수익이거나 손절1이상 손실이면 청산 if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1.",AtLimit,C-PriceScale*익절1,"",1,1); ExitShort("sl1.",AtStop,C+PriceScale*손절1,"",1,1); } #청산구분시간~Endtime 사이이면 #익절2이상 수익이거나 손절2이상 손실이면 청산 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 { #StartTime~청산구분시간 사이이면 #익절1이상 수익이거나 손절1이상 손실이면 청산 if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1",AtLimit,EntryPrice+PriceScale*익절1,"",1,1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1,"",1,1); } #청산구분시간~Endtime 사이이면 #익절2이상 수익이거나 손절2이상 손실이면 청산 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 { #StartTime~청산구분시간 사이이면 #익절1이상 수익이거나 손절1이상 손실이면 청산 if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1,"",1,1); ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1,"",1,1); } #청산구분시간~Endtime 사이이면 #익절2이상 수익이거나 손절2이상 손실이면 청산 if sTime >= 103000 and sTime < Endtime Then { ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2,"",1,1); ExitShort("sl2",AtStop,EntryPrice+PriceScale*손절2,"",1,1); } } #Endtime이 되면 당일청산 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); } } 2 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); #지정한 EndTime이후 첫봉이 되면 Tcond는 False if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; #지정한 StartTime이후 첫봉이 되면 #Tcond는 true #연속수익 체크변수는 값을 0으로 초기화 #연속손실 체크변수는 값을 0으로 초기화 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; T = 0; } #청산발생(거래횟수 증가) if TotalTrades > TotalTrades[1] Then { #수익청산이 발생하면 profit은 1씩 증가 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; #profit은 0 #손실산이 발생하면 loss는 1씩 증가 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 #손실청산이 아니면 0 loss = 0; } #볼밴상단 var1 = BollBandUp(Length,D1); #볼밴하단 var2 = BollBandDown(Length,D1); #지정한 StartTime~endtime사이이고 if Tcond == true Then { #고가가 볼밴상단을 돌파하고 양봉이거나 양봉도지이면 T는 1이고 value1에 종가저장 If T <= 0 and CrossUP(H,var1) and (c > o or (C==O and C >= C[1])) then { T = 1; value1 = C; } #저가가 볼밴하단을 이탈하고 음봉이거나 음봉도지이면 T는 -1이고 value2에 종가저장 If T >= 0 and CrossDown(L,Var2) and (C < O or (C==O and C < C[1])) then { T = -1; Value2 = C; } #T는 1이고 종가가 value1을 상향돌파하고 연속익절 3회미만이고 연속손절은 2회미만이면 매수진입 if T == 1 and CrossUp(C,value1) and profit < 익절연속횟수 and loss < 손절연속횟수 then { Buy("b",OnClose,DEF,1); #매수진입과 동시셋팅되어 다음봉에 발생하는 익절과 손절 #StartTime~청산구분시간 사이이면 #익절1이상 수익이거나 손절1이상 손실이면 청산 if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1.",AtLimit,C+PriceScale*익절1,"",1,1); ExitLong("bl1.",AtStop,C-PriceScale*손절1,"",1,1); } #청산구분시간~Endtime 사이이면 #익절2이상 수익이거나 손절2이상 손실이면 청산 if sTime >= 청산구분시간 and sTime < Endtime Then { ExitLong("bp2.",AtLimit,C+PriceScale*익절2,"",1,1); ExitLong("bl2.",AtStop,C-PriceScale*손절2,"",1,1); } } #T는 -1이고 종가가 value2를 하향이탈하고 연속익절 3회미만이고 연속손절은 2회미만이면 매도진입 If T == -1 and CrossDown(C,Value2) and profit < 익절연속횟수 and loss < 손절연속횟수 then { Sell("s",OnClose,DEF,1); #매도진입과 동시셋팅되어 다음봉에 발생하는 익절과 손절 #StartTime~청산구분시간 사이이면 #익절1이상 수익이거나 손절1이상 손실이면 청산 if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1.",AtLimit,C-PriceScale*익절1,"",1,1); ExitShort("sl1.",AtStop,C+PriceScale*손절1,"",1,1); } #청산구분시간~Endtime 사이이면 #익절2이상 수익이거나 손절2이상 손실이면 청산 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 { #StartTime~청산구분시간 사이이면 #익절1이상 수익이거나 손절1이상 손실이면 청산 if sTime >= StartTime and sTime < 청산구분시간 Then { ExitLong("bp1",AtLimit,EntryPrice+PriceScale*익절1,"",1,1); ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1,"",1,1); } #청산구분시간~Endtime 사이이면 #익절2이상 수익이거나 손절2이상 손실이면 청산 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 { #StartTime~청산구분시간 사이이면 #익절1이상 수익이거나 손절1이상 손실이면 청산 if sTime >= StartTime and sTime < 103000 Then { ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1,"",1,1); ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1,"",1,1); } #청산구분시간~Endtime 사이이면 #익절2이상 수익이거나 손절2이상 손실이면 청산 if sTime >= 103000 and sTime < Endtime Then { ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2,"",1,1); ExitShort("sl2",AtStop,EntryPrice+PriceScale*손절2,"",1,1); } } #Endtime이 되면 당일청산 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 님이 쓴 글입니다. > 제목 : 문의 드립니다. > 지난번에 수식 검증을 한번 받은 것인데, 오늘 잘못되어 나오는 부분이 있어 다시 한번 확인 부탁드립니다. # 15분 시작에 매수 신호가 나왔어도, 매수는 양봉에만 진입하는 것이므로 18분봉에 진입하지 않아야 하는데 진입되었습니다. 혹시 거래시간을 101200으로 해서 그런건지요? 조건이 만족할 시 매수는 양봉에만, 매도는 음봉에만 진입하는 것이 적용된 것인지요? 수식에 주석 달아 주시면 좋겠습니다. # 추가로 종가에 매수 매도 신호가 나오고 다음 봉에서 진입할 때에 진입가격을 재 돌파할 시 매수 매도 들어가게 하는 수식에 대해 별도로 주시면 좋겠습니다. --- 아래에 해당 수식과 거래된 파일 자료 남겨드립니다. 감사합니다~~ 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); } }