커뮤니티

시스템매매시간수정

프로필 이미지
조민철
2014-09-28 22:00:31
196
글번호 78880
답변완료
항상 감사드립니다 아래 시스템매매시간에서 시간조정을 추가하고 싶습니다 1,시스템종료시간을 04:30으로 셋팅되어 잇는데 이조건에 다음조건을 추가하고자합니다 1-1. 03:00기준 현재 매수(+1)이고 c>var1 이면 ==> c<var1 일때 매수청산/ 시스템종료 (c>var1 매수조건이 계속유지되면 04:30에 자동청산) 03:00기준 현재 매도(-1)이고 c<var1 이면 ==> c>var1 일때 매수청산/ 시스템종료 (c<var1 매도조건이 계속유지되면 04:30에 자동청산) 1-2.아래 시간설정은 21:00이후 두번째 발생신호봉부터 신호가 발생합니다 이조건을 첫번째발생신호봉부터 발생되도록 수정부탁드립니다 ################################################## ##### 당일 21:00 장시작 / 익일 04:30 장종료 ##### ################################################## input : 시작시간(210000),끝시간(043000); var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Start = True; entrycnt = entrycnt+1; Idx = 0; } Idx = idx+1; if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then Start = false; Bcond = var20==1 and var13==1 and c>var48[25] and macdv>macds and upAroon > DnAroon; Scond = var20==-1 and var13==-1 and c<var48[25] and macdv<macds and upAroon < DnAroon ; Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("eB1",1) == true or IsExitName("StopLoss",1) == true); Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("eS1",1) == true or IsExitName("StopLoss",1) == true); Condition11 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("bx",1) == true or IsExitName("StopLoss",1) == true); Condition22 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("sx",1) == true or IsExitName("StopLoss",1) == true); if Idx >= 2 and Start == true and Bcond == true and Bcond[1] == False and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False and Condition11 == False)) Then buy("B1"); if Idx >= 2 and Start == true and Scond == true and Scond[1] == False and (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False and Condition22 == False)) Then sell("S1"); 1-3.아래식을 다음과 같이 수정하고싶습니다 매수진입후 10틱이내 이익이면서 c<Lma1 이면 매수청산(bx) 매도진입후 10틱이내 이익이면서 c>Hma1 이면 매도청산(sx) if MarketPosition == 1 Then{ if (highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*10) Then ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*15 ); } if MarketPosition == -1 Then{ if ( Lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*10) Then ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale* 15); } 감사합니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-09-29 11:47:00

안녕하세요 예스스탁입니다. 1-1, 1-3 청산과 관련된 부분은 아래에 추가했습니다 1-2번 부분은 수식에 idx가 21시 이후의 봉갯수이며 각 진입이 전봉에는 만족하지 않다고 현재봉에 만족한것으로 지정이 되어 있습니다. 해당부분을 현재봉에 조건이 만족하면 진입하게 수정했습니다. 즉 12시 이후에 첫봉에 조건이 만족해도 신호가 발생합니다. 두번째 봉부터 신호가 발생하기를 원하시면 idx >= 2로 변경하시면 됩니다. input : 시작시간(210000),끝시간(043000); var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Start = True; entrycnt = entrycnt+1; Idx = 0; } Idx = idx+1; if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then Start = false; Bcond = var20==1 and var13==1 and c>var48[25] and macdv>macds and upAroon > DnAroon; Scond = var20==-1 and var13==-1 and c<var48[25] and macdv<macds and upAroon < DnAroon ; Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("eB1",1) == true or IsExitName("StopLoss",1) == true); Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("eS1",1) == true or IsExitName("StopLoss",1) == true); Condition11 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("bx",1) == true or IsExitName("StopLoss",1) == true); Condition22 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("sx",1) == true or IsExitName("StopLoss",1) == true); if Idx >= 1 and Start == true and Bcond == true and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False and Condition11 == False)) Then buy("B1"); if Idx >= 1 and Start == true and Scond == true and (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False and Condition22 == False)) Then sell("S1"); if MarketPosition == 1 Then{ if (highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*10) and C < Lma1 Then ExitLong("bx"); } if MarketPosition == -1 Then{ if ( Lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*10) and C > Hma1 Then ExitShort("sx"); } if stime >= 030000 and MarketPosition == 1 and C < var1 Then ExitLong(); if stime >= 030000 and MarketPosition == -1 and C > var1 Then ExitShort(); if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then{ ExitLong(); ExitShort(); } 즐거운 하루되세요 > 조민철 님이 쓴 글입니다. > 제목 : 시스템매매시간수정 > 항상 감사드립니다 아래 시스템매매시간에서 시간조정을 추가하고 싶습니다 1,시스템종료시간을 04:30으로 셋팅되어 잇는데 이조건에 다음조건을 추가하고자합니다 1-1. 03:00기준 현재 매수(+1)이고 c>var1 이면 ==> c<var1 일때 매수청산/ 시스템종료 (c>var1 매수조건이 계속유지되면 04:30에 자동청산) 03:00기준 현재 매도(-1)이고 c<var1 이면 ==> c>var1 일때 매수청산/ 시스템종료 (c<var1 매도조건이 계속유지되면 04:30에 자동청산) 1-2.아래 시간설정은 21:00이후 두번째 발생신호봉부터 신호가 발생합니다 이조건을 첫번째발생신호봉부터 발생되도록 수정부탁드립니다 ################################################## ##### 당일 21:00 장시작 / 익일 04:30 장종료 ##### ################################################## input : 시작시간(210000),끝시간(043000); var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Start = True; entrycnt = entrycnt+1; Idx = 0; } Idx = idx+1; if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then Start = false; Bcond = var20==1 and var13==1 and c>var48[25] and macdv>macds and upAroon > DnAroon; Scond = var20==-1 and var13==-1 and c<var48[25] and macdv<macds and upAroon < DnAroon ; Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("eB1",1) == true or IsExitName("StopLoss",1) == true); Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("eS1",1) == true or IsExitName("StopLoss",1) == true); Condition11 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("bx",1) == true or IsExitName("StopLoss",1) == true); Condition22 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("sx",1) == true or IsExitName("StopLoss",1) == true); if Idx >= 2 and Start == true and Bcond == true and Bcond[1] == False and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False and Condition11 == False)) Then buy("B1"); if Idx >= 2 and Start == true and Scond == true and Scond[1] == False and (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False and Condition22 == False)) Then sell("S1"); 1-3.아래식을 다음과 같이 수정하고싶습니다 매수진입후 10틱이내 이익이면서 c<Lma1 이면 매수청산(bx) 매도진입후 10틱이내 이익이면서 c>Hma1 이면 매도청산(sx) if MarketPosition == 1 Then{ if (highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*10) Then ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*15 ); } if MarketPosition == -1 Then{ if ( Lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*10) Then ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale* 15); } 감사합니다