커뮤니티

39129 추가질문입니다

프로필 이미지
조민철
2014-11-25 03:11:11
146
글번호 80725
답변완료
답변내용처럼 시스템에 적용해보니 첫신호가 그대로 나옵니다 ..그리고 다음신호가 정상적이질 않습니다.. 수정부탁드립니다 ***답변내용*** input : 시작시간(080000),끝시간(043000); var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0),Ventry(0),Vposition(0),Vprice(0); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Start = True; entrycnt = entrycnt+1; Idx = 0; Ventry = 0; Vposition = 0; Vprice = 0; } Idx = idx+1; if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then Entrycnt = entrycnt+1; if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then Start = false; Bcond = c>Hma1 and c>var78 and var58==1 and cma1>var78 ; Scond = c<Lma1 and c<var78 and var58==-1 and cma1<var78 ; Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("eB50",1) == true or IsExitName("StopLoss",1) == true); Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("eS50",1) == true or IsExitName("StopLoss",1) == true); if Ventry == 0 and Idx >= 1 and Start == true and Bcond == true Then{ Ventry = 1; Vposition = 1; VPrice = C; } if Ventry == 0 and Idx >= 1 and Start == true and Scond == true Then{ Ventry = 1; Vposition = -1; Vprice = C; } if Ventry == true Then{ if Vposition == 1 and L <= Vprice-PriceScale*30 Then Ventry = 2; if Vposition == -1 and H >= Vprice+PriceScale*30 Then Ventry = 2; } if Idx >= 1 and Start == true and Bcond == true Then{ if Entrycnt == 0 and Ventry == 1 and Vposition == -1 Then buy("B11"); if Entrycnt == 0 and Ventry == 2 and Vposition != 1 Then buy("B12"); if (Entrycnt >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False ))) Then{ buy("B2"); } } if Idx >= 1 and Start == true and Scond == true then{ if Entrycnt == 0 and Ventry == 1 and Vposition == 1 Then sell("S11"); if Entrycnt == 0 and Ventry == 2 and Vposition != -1 Then sell("S12"); if (Entrycnt >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and Condition2 == False ))) Then{ sell("S2"); } } ##손절_3_30틱 자동손절## SetStopLoss(PriceScale*30,PointStop); ############################### ##### 매일 04:30 강제청산 ##### ############################### if stime == 043000 or (stime > 043000 and stime[1] < 043000) Then{ exitlong("당일매수청산"); ExitShort("당일매도청산"); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-11-25 16:55:56

안녕하세요 예스스탁입니다. 변수값 초기화가 잘못되어 잇었습니다. 아래식으로 테스트해 보시기 바랍니다. input : 시작시간(080000),끝시간(043000); var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0),Ventry(0),Vposition(0),Vprice(0); var : Hma1(0),Cma1(0),Lma1(0); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Start = True; entrycnt = 0; Idx = 0; Ventry = 0; Vposition = 0; Vprice = 0; MessageLog("%.2f",entrycnt); } Idx = idx+1; if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then{ Entrycnt = entrycnt+1; MessageLog("%.2f",entrycnt); } if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then Start = false; Hma1 = ma(H,20); Lma1 = ma(L,20); Bcond = c>Hma1 ; //c>Hma1 and c>var78 and var58==1 and cma1>var78 ; Scond = c<Lma1; //c<Lma1 and c<var78 and var58==-1 and cma1<var78 ; Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("eB50",1) == true or IsExitName("StopLoss",1) == true); Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("eS50",1) == true or IsExitName("StopLoss",1) == true); if Ventry == 0 and Idx >= 1 and Start == true and Bcond == true Then{ Ventry = 1; Vposition = 1; VPrice = C; } if Ventry == 0 and Idx >= 1 and Start == true and Scond == true Then{ Ventry = 1; Vposition = -1; Vprice = C; } if Ventry != 0 Then{ if Vposition == 1 and L <= Vprice-PriceScale*30 Then Ventry = 2; if Vposition == -1 and H >= Vprice+PriceScale*30 Then Ventry = 2; } if Idx >= 1 and Start == true and Bcond == true Then{ if Entrycnt == 0 and Ventry == 1 and Vposition == -1 Then buy("B11"); if Entrycnt == 0 and Ventry == 2 and Vposition != 1 Then buy("B12"); if (Entrycnt >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False ))) Then{ buy("B2"); } } if Idx >= 1 and Start == true and Scond == true then{ if Entrycnt == 0 and Ventry == 1 and Vposition == 1 Then sell("S11"); if Entrycnt == 0 and Ventry == 2 and Vposition != -1 Then sell("S12"); if (Entrycnt >= 1 and (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False ))) Then{ sell("S2"); } } ##손절_3_30틱 자동손절## SetStopLoss(PriceScale*30,PointStop); ############################### ##### 매일 04:30 강제청산 ##### ############################### if stime == 043000 or (stime > 043000 and stime[1] < 043000) Then{ exitlong("당일매수청산"); ExitShort("당일매도청산"); } 즐거운 하루되세요 > 조민철 님이 쓴 글입니다. > 제목 : 39129 추가질문입니다 > 답변내용처럼 시스템에 적용해보니 첫신호가 그대로 나옵니다 ..그리고 다음신호가 정상적이질 않습니다.. 수정부탁드립니다 ***답변내용*** input : 시작시간(080000),끝시간(043000); var : Start(false),entrycnt(0),Bcond(false),Scond(false),idx(0),Ventry(0),Vposition(0),Vprice(0); if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{ Start = True; entrycnt = entrycnt+1; Idx = 0; Ventry = 0; Vposition = 0; Vprice = 0; } Idx = idx+1; if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then Entrycnt = entrycnt+1; if stime == 끝시간 or (stime > 끝시간 and stime[1] < 끝시간) Then Start = false; Bcond = c>Hma1 and c>var78 and var58==1 and cma1>var78 ; Scond = c<Lma1 and c<var78 and var58==-1 and cma1<var78 ; Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and (IsExitName("eB50",1) == true or IsExitName("StopLoss",1) == true); Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and (IsExitName("eS50",1) == true or IsExitName("StopLoss",1) == true); if Ventry == 0 and Idx >= 1 and Start == true and Bcond == true Then{ Ventry = 1; Vposition = 1; VPrice = C; } if Ventry == 0 and Idx >= 1 and Start == true and Scond == true Then{ Ventry = 1; Vposition = -1; Vprice = C; } if Ventry == true Then{ if Vposition == 1 and L <= Vprice-PriceScale*30 Then Ventry = 2; if Vposition == -1 and H >= Vprice+PriceScale*30 Then Ventry = 2; } if Idx >= 1 and Start == true and Bcond == true Then{ if Entrycnt == 0 and Ventry == 1 and Vposition == -1 Then buy("B11"); if Entrycnt == 0 and Ventry == 2 and Vposition != 1 Then buy("B12"); if (Entrycnt >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False ))) Then{ buy("B2"); } } if Idx >= 1 and Start == true and Scond == true then{ if Entrycnt == 0 and Ventry == 1 and Vposition == 1 Then sell("S11"); if Entrycnt == 0 and Ventry == 2 and Vposition != -1 Then sell("S12"); if (Entrycnt >= 1 and (MarketPosition == -1 or (MarketPosition == 0 and Condition2 == False ))) Then{ sell("S2"); } } ##손절_3_30틱 자동손절## SetStopLoss(PriceScale*30,PointStop); ############################### ##### 매일 04:30 강제청산 ##### ############################### if stime == 043000 or (stime > 043000 and stime[1] < 043000) Then{ exitlong("당일매수청산"); ExitShort("당일매도청산"); }