커뮤니티

문의 드립니다.

프로필 이미지
jesten77
2021-11-12 23:19:37
623
글번호 153583
답변완료

첨부 이미지

다시 문의드립니다. 수정해주신 수식을 데모해봤는데요. 이전캔들 5개의 최고 최저가에 대한 진입이 틀립니다. 표시된 도치 양봉이 N개 최저가를 돌파한 캔들이지만 양봉이니 진입하지 않지만 다음 음봉캔들도 N개 최저가를 돌파했으니 그 캔들 종가에 매도가 들어가야 맞지 않나요. 그리고 손절이든 익절이든 N회 거래만 진행하고 거래 종료하는 부분 추가해주십시요. 이미지 사진과 주신 수식 남겨 드립니다. 감사합니다. input : n1(5); input : StartTime(233000),EndTime(013000); input : 익절틱수(80),손절틱수(0); var : Tcond(false), T(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; } if Tcond == true Then { if C > Highest(H,n1)[1] and C > O Then Buy("b"); if C < 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-15 10:16:34

안녕하세요 예스스탁입니다. if C > Highest(H,n1)[1] and C > O Then Buy("b"); if C < Lowest(L,N1)[1] and C < O Then Sell("s"); 조건 내용이 봉완성시 종가기준으로 이전 N1개봉 최고가나 최저가를 갱신해야 합니다. 고가/저가로 갱신 확인하고 종가에 진입하면 아래와 같이 변경하시면 됩니다. 당일 거래횟수제한도 추가해 드립니다. 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); } } 즐거운 하루되세요 > jesten77 님이 쓴 글입니다. > 제목 : 문의 드립니다. > 다시 문의드립니다. 수정해주신 수식을 데모해봤는데요. 이전캔들 5개의 최고 최저가에 대한 진입이 틀립니다. 표시된 도치 양봉이 N개 최저가를 돌파한 캔들이지만 양봉이니 진입하지 않지만 다음 음봉캔들도 N개 최저가를 돌파했으니 그 캔들 종가에 매도가 들어가야 맞지 않나요. 그리고 손절이든 익절이든 N회 거래만 진행하고 거래 종료하는 부분 추가해주십시요. 이미지 사진과 주신 수식 남겨 드립니다. 감사합니다. input : n1(5); input : StartTime(233000),EndTime(013000); input : 익절틱수(80),손절틱수(0); var : Tcond(false), T(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; } if Tcond == true Then { if C > Highest(H,n1)[1] and C > O Then Buy("b"); if C < 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); } }