커뮤니티

다시 문의 드립니다.

프로필 이미지
jesten77
2021-11-15 22:49:36
756
글번호 153623
답변완료

첨부 이미지

친절한 도움에 감사드립니다. 수식을 다시 데모해보았는데요... 진입과 청산에 차이가 있는 부분이 있어 남깁니다. 진입은 1번 캔들 종가에 매도가 들어가는 것이 맞는데.. 다음 캔들 종가에 들어갔습니다. 그리고 청산은 이해가 가지 않게 정리되었네요.. 두번째 이미지 사진에서도 거래횟수로 1회로 해서 데모해보았는데요. 1번과 2번 두 번 진입이 되었습니다. 그리고 2번 진입한 것은 중간에 손절되지 않고 거래 종료시간에 청산(3번)했는데 이것도 맞지 않습니다. 이미지 남겨드립니다. 확인 부탁드립니다. input : n1(5); input : StartTime(233000),EndTime(013000); input : 익절틱수(80),손절틱수(0),거래횟수(3); var : Tcond(false), T(0), entry(0); Array : H1[50](0),L1[50](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; entry = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and entry < 거래횟수 Then { if H > Highest(H,n1)[1] and C > O Then Buy("b"); if L < Lowest(L,N1)[1] and C < O Then Sell("s"); if MarketPosition == 1 Then ExitLong("bx",AtStop,L[BarsSinceEntry]-PriceScale*1); if MarketPosition == -1 Then ExitShort("sx",AtStop,H[BarsSinceEntry]+PriceScale*1); } SetStopProfittarget(PriceScale*익절틱수,PointStop); SetStopLoss(PriceScale*손절틱수,PointStop); 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-16 14:56:19

안녕하세요 예스스탁입니다. 1 bx,sx청산이 진입횟수에 같이 묶여 있어 수정했습니다. 당일청산 초기화가 진입식보다 아래에 있어 지정시간 첫봉에 진입을 막고 있어 위로 올려드립니다 2 진입횟수는 테스트결과 1회로 지정시 2회이상 발생하지는 않습니다. 식이 차트에 적용된 상태에서 수식내에서 외부변수를 변경해도 차트의 신호가 변경되지 않습니다. 외부변수는 수식안에서 변경하셨으면 식을 다시 적용해 주셔야 합니다. 시스템 트레이딩 설정창의 변수탭에서 변경하면 식을 다시 적용하지 않아도 즉시 반영됩니다. 3 수정한 식입니다. input : n1(5); input : StartTime(233000),EndTime(013000); input : 익절틱수(80),손절틱수(0),거래횟수(3); var : Tcond(false), T(0), entry(0); Array : H1[50](0),L1[50](0); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (NextBarSdate != sdate and NextBarStime >= EndTime) or (NextBarSdate == sdate and NextBarStime >= EndTime and stime < EndTime) Then Tcond = False; if (NextBarSdate != sdate and NextBarStime >= StartTime) or (NextBarSdate == sdate and NextBarStime >= StartTime and stime < StartTime) Then { T = 0; Tcond = true; entry = 0; IF Endtime <= starttime Then { SetStopEndofday(0); } } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true Then { if H > Highest(H,n1)[1] and C > O and entry < 거래횟수 Then Buy("b"); if L < Lowest(L,N1)[1] and C < O and entry < 거래횟수 Then Sell("s"); if MarketPosition == 1 Then ExitLong("bx",AtStop,L[BarsSinceEntry]-PriceScale*1); if MarketPosition == -1 Then ExitShort("sx",AtStop,H[BarsSinceEntry]+PriceScale*1); } SetStopProfittarget(PriceScale*익절틱수,PointStop); SetStopLoss(PriceScale*손절틱수,PointStop); 즐거운 하루되세요 > jesten77 님이 쓴 글입니다. > 제목 : 다시 문의 드립니다. > 친절한 도움에 감사드립니다. 수식을 다시 데모해보았는데요... 진입과 청산에 차이가 있는 부분이 있어 남깁니다. 진입은 1번 캔들 종가에 매도가 들어가는 것이 맞는데.. 다음 캔들 종가에 들어갔습니다. 그리고 청산은 이해가 가지 않게 정리되었네요.. 두번째 이미지 사진에서도 거래횟수로 1회로 해서 데모해보았는데요. 1번과 2번 두 번 진입이 되었습니다. 그리고 2번 진입한 것은 중간에 손절되지 않고 거래 종료시간에 청산(3번)했는데 이것도 맞지 않습니다. 이미지 남겨드립니다. 확인 부탁드립니다. input : n1(5); input : StartTime(233000),EndTime(013000); input : 익절틱수(80),손절틱수(0),거래횟수(3); var : Tcond(false), T(0), entry(0); Array : H1[50](0),L1[50](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; entry = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and entry < 거래횟수 Then { if H > Highest(H,n1)[1] and C > O Then Buy("b"); if L < Lowest(L,N1)[1] and C < O Then Sell("s"); if MarketPosition == 1 Then ExitLong("bx",AtStop,L[BarsSinceEntry]-PriceScale*1); if MarketPosition == -1 Then ExitShort("sx",AtStop,H[BarsSinceEntry]+PriceScale*1); } SetStopProfittarget(PriceScale*익절틱수,PointStop); SetStopLoss(PriceScale*손절틱수,PointStop); 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); } }