커뮤니티

수식 부탁드립니다

프로필 이미지
푸른
2021-11-04 08:04:30
773
글번호 153373
답변완료

첨부 이미지

일봉 캔들 20개의 매수 38.20 % 청산 123.60 % 의 수식어와 일봉 캔들 20개의 매도 123.60 % 청산 38.20 % 의 수식어를 부탁드립니다. 매매시간은 07시부터 익일 06시이고 익절은 100틱 손절은 30틱 입니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-11-04 14:17:30

안녕하세요 예스스탁입니다. 수식에 시간조건이 있으면 분봉이하 차트에 적용하셔야 합니다. 분봉이하에서 일봉값 계산해 진입하게 작성해 드립니다. endtime에 당일청산을 하므로 장종료시간이 아닌 조금 앞의 시간을 지정하셔야 합니다. input : StartTime(070000),EndTime(055500); input : N(20),익절틱수(100),손절틱수(100); var : Tcond(false),HH(0),LL(0),MM(0),cnt(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; HH = 0; LL = 0; For cnt = 0 to N-1 { if DayHigh(cnt) > HH Then HH = DayHigh(cnt); if DayLow(cnt) < LL Then LL = DayLow(cnt); } MM = HH-LL; if Tcond == true Then { if MarketPosition <= 0 and H < LL+MM*0.382 Then { Buy("b",AtStop,LL+MM*0.382); } if MarketPosition >= 0 and L > HH-MM*0.382 Then { Sell("s",AtStop,HH-MM*0.382); } if MarketPosition == 1 Then { ExitLong("bx",AtLimit,LL[BarsSinceEntry]+MM[BarsSinceEntry]*1.236); } if MarketPosition == -1 Then { ExitShort("sx",AtLimit,HH[BarsSinceEntry]-MM[BarsSinceEntry]*1.236); } } 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); } } 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다 > 일봉 캔들 20개의 매수 38.20 % 청산 123.60 % 의 수식어와 일봉 캔들 20개의 매도 123.60 % 청산 38.20 % 의 수식어를 부탁드립니다. 매매시간은 07시부터 익일 06시이고 익절은 100틱 손절은 30틱 입니다