커뮤니티

수식 작성 부탁드립니다

프로필 이미지
푸른
2021-04-20 07:22:11
566
글번호 148197
답변완료
input : StartTime(150000),EndTime(055000),xtime(055500); var : Tcond(false); if sDate != sDate[1] then SetStopEndofday(xtime); 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; SetStopEndofday(0); } Input : Period(20); Var : value(0); value = VR(Period); var1 = ma(C,5); var2 = ma(C,240); If CrossUP(value, 100) Then { Buy("b"); } If CrossDown(value, 300) Then { Sell("s"); } if marketposition == 1 then { if isentryname("b") == true and crossdown(var1,var2) then sell("bs"); if crossdown(var2,var3) Then Exitlong("sbx",onclose,def,"sb"); } if marketposition == -1 then { if isentryname("s") == true and crossup(var1,var2) then buy("sb"); if crossup(var2,var3) Then ExitShort("bsx",onclose,def,"bs"); } --------------------------------------------------------- 수식어 2개를 추가 하고자 합니다. 1. 당일 목표수익 120틱 매매정지 2. 23시 30분후 매매신호시 수익설정 30틱 자동주문
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-04-20 10:31:40

안녕하세요 예스스탁입니다. input : StartTime(150000),EndTime(055000),xtime(055500); Input : Period(20); Input : 당일수익틱수(120); Var : N1(0),dayPl(0),당일수익(0),Xcond(false); Var : value(0),Tcond(false); if sDate != sDate[1] then SetStopEndofday(xtime); 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; SetStopEndofday(0); Xcond = false; N1 = NetProfit; } 당일수익 = PriceScale*당일수익틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 Then Xcond = true; if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true ) then Xcond = true; } value = VR(Period); var1 = ma(C,5); var2 = ma(C,240); If CrossUP(value, 100) and Xcond == False Then { Buy("b"); } If CrossDown(value, 300) and Xcond == False Then { Sell("s"); } if marketposition == 1 then { if isentryname("b") == true and crossdown(var1,var2) then sell("bs"); if crossdown(var2,var3) Then Exitlong("sbx",onclose,def,"sb"); ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); if EntryTime >= 233000 or EntryTime < Endtime Then ExitLong("bpx",AtLimit,EntryPrice+PriceScale*30); } if marketposition == -1 then { if isentryname("s") == true and crossup(var1,var2) then buy("sb"); if crossup(var2,var3) Then ExitShort("bsx",onclose,def,"bs"); ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); if EntryTime >= 233000 or EntryTime < Endtime Then ExitShort("spx",AtLimit,EntryPrice-PriceScale*30); } 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 수식 작성 부탁드립니다 > input : StartTime(150000),EndTime(055000),xtime(055500); var : Tcond(false); if sDate != sDate[1] then SetStopEndofday(xtime); 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; SetStopEndofday(0); } Input : Period(20); Var : value(0); value = VR(Period); var1 = ma(C,5); var2 = ma(C,240); If CrossUP(value, 100) Then { Buy("b"); } If CrossDown(value, 300) Then { Sell("s"); } if marketposition == 1 then { if isentryname("b") == true and crossdown(var1,var2) then sell("bs"); if crossdown(var2,var3) Then Exitlong("sbx",onclose,def,"sb"); } if marketposition == -1 then { if isentryname("s") == true and crossup(var1,var2) then buy("sb"); if crossup(var2,var3) Then ExitShort("bsx",onclose,def,"bs"); } --------------------------------------------------------- 수식어 2개를 추가 하고자 합니다. 1. 당일 목표수익 120틱 매매정지 2. 23시 30분후 매매신호시 수익설정 30틱 자동주문