커뮤니티

수식추가 부탁드립니다.

프로필 이미지
대구어린울프
2019-10-17 13:34:56
190
글번호 132833
답변완료
안녕하세요? 아래의 시스템을 야간에 매매하려고 합니다. 시작시간과 끝나는 시간을 외부변수에 추가하고싶습니다. 시작시간은 당일 저녁에 시작할것이고, 끝나는 시간은 다음날 새벽에 끝내고 싶습니다. (즉, 야간매매 정상적인 장시작~장종료) (이부분이 가장 신경쓰입니다. 이것말고 다른시스템에 시작시간과 끝나는 시간이 있는데요, CME에 적용시켜서 성능보고서를 확인해보면, 초저녁에는 작동을 아예하지않고 자정부터 거래가 시작되더라구요. 차트는 복합말구 그냥 CME 설정, 강제종료시간 체크(체크해제) 다해보았습니다. 실제로 다른시스템도 실전거래까지 해보았는데 자정부터 시작하더라구요. 도움부탁드리겠습니다. 감사합니다.) input : 익절틱수(50),손절틱수(50),n(10); if C > O and C[1] < O[1] and O > C[1] and C < O[1] Then { if MarketPosition == 0 or (MarketPosition == -1 and BarsSinceEntry <= n) then buy("b1"); } if C > O and C[1] < O[1] and O < C[1] and C > O[1] Then { if MarketPosition == 0 or (MarketPosition == -1 and BarsSinceEntry <= n) then buy("b2"); } if C < O and C[1] > O[1] and O < C[1] and C > O[1] Then { if MarketPosition == 0 or (MarketPosition == 1 and BarsSinceEntry <= n) then sell("s1"); } if C < O and C[1] > O[1] and O > C[1] and C < O[1] Then { if MarketPosition == 0 or (MarketPosition == 1 and BarsSinceEntry <= n) then sell("s2"); } if MarketPosition == 1 and BarsSinceEntry >= n then { ExitLong("bp",AtLimit,EntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,EntryPrice-PriceScale*손절틱수); } if MarketPosition == -1 and BarsSinceEntry >= n then { ExitShort("sp",AtLimit,EntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,EntryPrice+PriceScale*손절틱수); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-10-17 14:31:16

안녕하세요 예스스탁입니다. SetStopEndofday는 지정한 시간이후에 진입을 제한합니다. SetStopEndofday(050000); 위와 같이 새벽 5시에 당일청산을 지정하면 새벽 5시부터 이후에 0시까지는 진입을 하지 못하게 됩니다. 그러므로 국내주식이나 국내선물옵션 주간장만 거래할경우에는 단순히 시간만 지정하면 되지만 해외선물이나 국내선물 야간장을 거래할 경우에는 다른 처리를 하셔야 합니다. 즉 거래하는 시간대에 맞게 수식을 선택적으로 변형하셔야 합니다. 세벽시간에 청산하는 경우에는 0시가 되면 당일청산을 세팅하고 특정시간이 되면 다시 당일청산을 해제해 주어서 진입이 발생할수 있게 코딩하셔야 합니다. input : starttime(180000),endtime(050000); var : Tcond(false); input : 익절틱수(50),손절틱수(50),n(10); #날짜가 변경디면 당일청산셋팅 if sdate != sdate[1] Then SetStopEndofday(endtime); 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); } if Tcond == true then { if C > O and C[1] < O[1] and O > C[1] and C < O[1] Then { if MarketPosition == 0 or (MarketPosition == -1 and BarsSinceEntry <= n) then buy("b1"); } if C > O and C[1] < O[1] and O < C[1] and C > O[1] Then { if MarketPosition == 0 or (MarketPosition == -1 and BarsSinceEntry <= n) then buy("b2"); } if C < O and C[1] > O[1] and O < C[1] and C > O[1] Then { if MarketPosition == 0 or (MarketPosition == 1 and BarsSinceEntry <= n) then sell("s1"); } if C < O and C[1] > O[1] and O > C[1] and C < O[1] Then { if MarketPosition == 0 or (MarketPosition == 1 and BarsSinceEntry <= n) then sell("s2"); } if MarketPosition == 1 and BarsSinceEntry >= n then { ExitLong("bp",AtLimit,EntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,EntryPrice-PriceScale*손절틱수); } if MarketPosition == -1 and BarsSinceEntry >= n then { ExitShort("sp",AtLimit,EntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,EntryPrice+PriceScale*손절틱수); } } 즐거운 하루되세요 > 대구어린울프 님이 쓴 글입니다. > 제목 : 수식추가 부탁드립니다. > 안녕하세요? 아래의 시스템을 야간에 매매하려고 합니다. 시작시간과 끝나는 시간을 외부변수에 추가하고싶습니다. 시작시간은 당일 저녁에 시작할것이고, 끝나는 시간은 다음날 새벽에 끝내고 싶습니다. (즉, 야간매매 정상적인 장시작~장종료) (이부분이 가장 신경쓰입니다. 이것말고 다른시스템에 시작시간과 끝나는 시간이 있는데요, CME에 적용시켜서 성능보고서를 확인해보면, 초저녁에는 작동을 아예하지않고 자정부터 거래가 시작되더라구요. 차트는 복합말구 그냥 CME 설정, 강제종료시간 체크(체크해제) 다해보았습니다. 실제로 다른시스템도 실전거래까지 해보았는데 자정부터 시작하더라구요. 도움부탁드리겠습니다. 감사합니다.) input : 익절틱수(50),손절틱수(50),n(10); if C > O and C[1] < O[1] and O > C[1] and C < O[1] Then { if MarketPosition == 0 or (MarketPosition == -1 and BarsSinceEntry <= n) then buy("b1"); } if C > O and C[1] < O[1] and O < C[1] and C > O[1] Then { if MarketPosition == 0 or (MarketPosition == -1 and BarsSinceEntry <= n) then buy("b2"); } if C < O and C[1] > O[1] and O < C[1] and C > O[1] Then { if MarketPosition == 0 or (MarketPosition == 1 and BarsSinceEntry <= n) then sell("s1"); } if C < O and C[1] > O[1] and O > C[1] and C < O[1] Then { if MarketPosition == 0 or (MarketPosition == 1 and BarsSinceEntry <= n) then sell("s2"); } if MarketPosition == 1 and BarsSinceEntry >= n then { ExitLong("bp",AtLimit,EntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,EntryPrice-PriceScale*손절틱수); } if MarketPosition == -1 and BarsSinceEntry >= n then { ExitShort("sp",AtLimit,EntryPrice-PriceScale*익절틱수); ExitShort("sl",AtStop,EntryPrice+PriceScale*손절틱수); }