커뮤니티

문의 드립니다.~~~~

프로필 이미지
예스요
2022-01-13 16:54:10
771
글번호 155427
답변완료
계시판을 보며 나름 열심히 공부하고 있습니다. 아래식의 자세한 주석을 부탁드립니다. Input:length(12); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),TL_Val1(0),TL_Val2(0),color(0); var:T(0),B(0),Bx(0),S(0),Sx(0); Array:고점[10,2](0),저점[10,2](0); 처리구분 = ""; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If 저점[1,1] > L Then 처리구분 = "저점처리"; If 고점[1,1] < H Then 처리구분 = "고점처리"; } Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리"; Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리"; If 처리구분 == "고점처리" Then { T = 1; lastHiVal = H; If 고점[1,2] < 저점[1,2] Then { For j = 10 DownTo 2 { 고점[j,1] = 고점[j-1,1]; 고점[j,2] = 고점[j-1,2]; } } If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then { 고점[1,1] = H; 고점[1,2] = Index; sBar = Index - 저점[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then TL_Delete(TL2); } if 고점[1,1] > 고점[2,1] or 고점[2,1] == 0 Then{ color = RED; # buy("b"); } TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]); TL_SetColor(TL1,color); Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2)); Text_SetStyle(Text1, 2, 1); If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then { sBar = Index - 저점[2,2]; eBar = Index - 저점[1,2]; } } } If 처리구분 == "저점처리" Then { T = -1; lastLoVal = L; If 저점[1,2] < 고점[1,2] Then { For j = 10 DownTo 2 { 저점[j,1] = 저점[j-1,1]; 저점[j,2] = 저점[j-1,2]; } } If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then { 저점[1,1] = L; 저점[1,2] = Index; sBar = Index - 고점[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then TL_Delete(TL3); } if 저점[1,1] < 저점[2,1] or 저점[2,1] == 0 Then{ color = blue; # sell("s"); } TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]); TL_SetColor(TL1,color); Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2)); Text_SetStyle(Text1, 2, 0); If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then { sBar = Index - 고점[2,2]; eBar = Index - 고점[1,2]; } } } TL_SetSize(TL1,3); #상승구간의 마지막저점 저장 if Color == RED Then { var1 = 저점[2,1]; } #하락구간의 마지막 고점 저장 if Color == BLUE Then { var2 = 고점[2,1]; } if MarketPosition <= 0 Then { if color == BLUE and var1 > 0 and L > var1-PriceScale*50 Then Buy("b",AtLimit,var1-PriceScale*50,1); } if MarketPosition == 1 Then { value1 = Floor(MaxEntries/2)+1; Buy("bb",AtLimit,(var1[BarsSinceEntry]-PriceScale*50)-(PriceScale*50)*MaxEntries,value1); if T == -1 and 고점[1,1] > 0 Then ExitLong("bx1",AtLimit,고점[1,1]+PriceScale*1); if T == 1 and 고점[2,1] > 0 Then ExitLong("bx2",AtLimit,고점[2,1]+PriceScale*1); } if MarketPosition >= 0 Then { if Color == RED and Var2 > 0 and H < var2+PriceScale*50 Then Sell("s",AtLimit,Var2+PriceScale*50,1); } if MarketPosition == -1 Then { value1 = Floor(MaxEntries/2)+1; Sell("ss",AtLimit,(var2[BarsSinceEntry]+PriceScale*50)+(PriceScale*50)*MaxEntries,value1); if T == 1 and 저점[1,1] > 0 Then ExitShort("sx1",AtLimit,저점[1,1]-PriceScale*1); if T == -1 and 저점[2,1] > 0 Then ExitShort("sx2",AtLimit,저점[2,1]-PriceScale*1); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-01-14 11:26:59

안녕하세요 예스스탁입니다. 수식에서 사용하지 않거나 불필요한 변수나 조건문은 삭제하고 주석을 붙여드립니다. Input:length(12); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL3(0),Text1(0),처리구분(""),TL_Val1(0),TL_Val2(0),color(0); var:T(0),B(0),Bx(0),S(0),Sx(0); Array:고점[10,2](0),저점[10,2](0); #처리구분값은 매봉 초기화 처리구분 = ""; #신고가와 신저자가 동시발생하면 If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { #저가가 직전저점보다 작으면 처리구분은 저점처리 If 저점[1,1] > L Then 처리구분 = "저점처리"; #고가가 직전고점보다 크면 처리구분은 고점처리 If 고점[1,1] < H Then 처리구분 = "고점처리"; } #동시발생아니고 신고가 발생하면 처리구분은 고점처리 Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리"; #동시발생아니고 신저가 발생하면 처리구분은 저점처리 Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리"; #처리구분이 고점처리이면 If 처리구분 == "고점처리" Then { #T값은 1 T = 1; # lastHiVal에 고가저장 lastHiVal = H; #최근고점 봉번호가 최근저점 봉번호보다 작으면(고점발생후 저점발생) If 고점[1,2] < 저점[1,2] Then { #각 고점값과 인덱스값을 다음배열방으로 이동 For j = 10 DownTo 2 { 고점[j,1] = 고점[j-1,1]; 고점[j,2] = 고점[j-1,2]; } } #최근고점 봉번호가 최근저점 봉번호보다 작거나 고가가 최근고점보다 크면 If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then { #최근고점 값을 현재봉고가로 변경 고점[1,1] = H; #최근고점 봉번호를 현재봉 봉번호로 고점[1,2] = Index; #진전저점과 현재봉사이 봉갯수(추세선의 시작점 지정에 사용) sBar = Index - 저점[1,2]; #추세선 끝점 지정에 사용 초기값0(현재봉) eBar = 0; #TL1추세선의 시작점이 최근저점의 날짜와 시간이 같으면 If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { #TL1추세선 삭제 TL_Delete(TL1); #Text1 텍스트 삭제 Text_Delete(Text1); } #최근고점이 전고점보다 크거나 전고점이 없으면 if 고점[1,1] > 고점[2,1] or 고점[2,1] == 0 Then { #색상은 빨강 color = RED; } #최근고점과 최근저점을 연결하는 새로운 추세선을 그림 TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]); #추세선색은 빨강 TL_SetColor(TL1,color); #최근고점값과 최근고점과 최근저점의 차이를 틱수로 출력 Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2)); Text_SetStyle(Text1, 2, 1); #최근고점이 직전고점보다 작고 직전고점은 전전고점보다 크고 #최근저점은 직전저점보다 크면 If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then { #추세선의 시작점을 직전저점 끝점은 최근저점으로 변경 sBar = Index - 저점[2,2]; eBar = Index - 저점[1,2]; } } } #처리구분이 저점처리이면 If 처리구분 == "저점처리" Then { #T값은 1 T = -1; #lastLoVal에 저가저장 lastLoVal = L; #최근저점 봉번호가 최근고점 봉번호보다 작으면(저점발생후 고점발생) If 저점[1,2] < 고점[1,2] Then { #각 저점값과 인덱스값을 다음배열방으로 이동 For j = 10 DownTo 2 { 저점[j,1] = 저점[j-1,1]; 저점[j,2] = 저점[j-1,2]; } } #최근고점 봉번호가 최근저점 봉번호보다 작거나 고가가 최근고점보다 크면 If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then { #최근저점 값을 현재봉 저가로 변경 저점[1,1] = L; #최근고점 봉번호를 현재봉 봉번호로 변경 저점[1,2] = Index; #진전고점과 현재봉사이 봉갯수(추세선의 시작점 지정에 사용) sBar = Index - 고점[1,2]; #추세선 끝점 지정에 사용 초기값0(현재봉) eBar = 0; #TL1추세선의 시작점이 최근고점의 날짜와 시간이 같으면 If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { #TL1추세선 삭제 TL_Delete(TL1); #Text1 텍스트 삭제 Text_Delete(Text1); } #최근저점이 전저점보다 작거나 전저점이 없으면 if 저점[1,1] < 저점[2,1] or 저점[2,1] == 0 Then { #색상은 파랑 color = blue; } #최근고점과 최근저점을 연결하는 새로운 추세선을 그림 TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]); #추세선색은 파랑 TL_SetColor(TL1,color); #최근저0점값과 최근고점과 최근저점의 차이를 틱수로 출력 Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2)); Text_SetStyle(Text1, 2, 0); #최근저점이 직전저점보다 크고 직전저점은 전전저점보다 작고 #최근고점은 직전고점보다 작으면 If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then { #추세선의 시작점을 직전저점 끝점은 최근저점으로 변경 sBar = Index - 고점[2,2]; eBar = Index - 고점[1,2]; } } } #추세선 굵기는 3 TL_SetSize(TL1,3); #상승구간의 마지막저점 저장 if Color == RED Then { var1 = 저점[2,1]; } #하락구간의 마지막 고점 저장 if Color == BLUE Then { var2 = 고점[2,1]; } #무포지션이거나 매도포지션일때 if MarketPosition <= 0 Then { #현재 추세선은 파란색 구간이고 #최근 상승구간 마지막저점점값보다 50틱 하락하면 매수 if color == BLUE and var1 > 0 and L > var1-PriceScale*50 Then Buy("b",AtLimit,var1-PriceScale*50,1); } #매수포지션진입 후 if MarketPosition == 1 Then { #진입횟수 2회기준으로 1개씩 수량증가 value1 = Floor(MaxEntries/2)+1; #직전 진입보다 50틱씩 하락하면 추가매수 Buy("bb",AtLimit,(var1[BarsSinceEntry]-PriceScale*50)-(PriceScale*50)*MaxEntries,value1); #저점처리 상태에서 최근고점보다 큰 시세 발생하면 청산 if T == -1 and 고점[1,1] > 0 Then ExitLong("bx1",AtLimit,고점[1,1]+PriceScale*1); #고점처리 상태에서 직전고점보다 큰 시세 발생하면 청산 if T == 1 and 고점[2,1] > 0 Then ExitLong("bx2",AtLimit,고점[2,1]+PriceScale*1); } #무포지션이거나 매수포지션일때 if MarketPosition >= 0 Then { #현재 추세선은 파란색 구간이고 #최근 하락구간 마지막고점값보다 50틱 상승하면 매도 if Color == RED and Var2 > 0 and H < var2+PriceScale*50 Then Sell("s",AtLimit,Var2+PriceScale*50,1); } #매도포지션 진입 후 if MarketPosition == -1 Then { #진입횟수 2회기준으로 1개씩 수량증가 value1 = Floor(MaxEntries/2)+1; #직전 진입보다 50틱씩 상승하면 추가매도 Sell("ss",AtLimit,(var2[BarsSinceEntry]+PriceScale*50)+(PriceScale*50)*MaxEntries,value1); #고점처리 상태에서 최근저점보다 작은 시세 발생하면 청산 if T == 1 and 저점[1,1] > 0 Then ExitShort("sx1",AtLimit,저점[1,1]-PriceScale*1); #저점처리 상태에서 직전저점보다 작은 시세 발생하면 청산 if T == -1 and 저점[2,1] > 0 Then ExitShort("sx2",AtLimit,저점[2,1]-PriceScale*1); } 즐거운 하루되세요 > 예스요 님이 쓴 글입니다. > 제목 : 문의 드립니다.~~~~ > 계시판을 보며 나름 열심히 공부하고 있습니다. 아래식의 자세한 주석을 부탁드립니다. Input:length(12); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),TL_Val1(0),TL_Val2(0),color(0); var:T(0),B(0),Bx(0),S(0),Sx(0); Array:고점[10,2](0),저점[10,2](0); 처리구분 = ""; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If 저점[1,1] > L Then 처리구분 = "저점처리"; If 고점[1,1] < H Then 처리구분 = "고점처리"; } Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리"; Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리"; If 처리구분 == "고점처리" Then { T = 1; lastHiVal = H; If 고점[1,2] < 저점[1,2] Then { For j = 10 DownTo 2 { 고점[j,1] = 고점[j-1,1]; 고점[j,2] = 고점[j-1,2]; } } If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then { 고점[1,1] = H; 고점[1,2] = Index; sBar = Index - 저점[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then TL_Delete(TL2); } if 고점[1,1] > 고점[2,1] or 고점[2,1] == 0 Then{ color = RED; # buy("b"); } TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]); TL_SetColor(TL1,color); Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2)); Text_SetStyle(Text1, 2, 1); If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then { sBar = Index - 저점[2,2]; eBar = Index - 저점[1,2]; } } } If 처리구분 == "저점처리" Then { T = -1; lastLoVal = L; If 저점[1,2] < 고점[1,2] Then { For j = 10 DownTo 2 { 저점[j,1] = 저점[j-1,1]; 저점[j,2] = 저점[j-1,2]; } } If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then { 저점[1,1] = L; 저점[1,2] = Index; sBar = Index - 고점[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then TL_Delete(TL3); } if 저점[1,1] < 저점[2,1] or 저점[2,1] == 0 Then{ color = blue; # sell("s"); } TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]); TL_SetColor(TL1,color); Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2)); Text_SetStyle(Text1, 2, 0); If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then { sBar = Index - 고점[2,2]; eBar = Index - 고점[1,2]; } } } TL_SetSize(TL1,3); #상승구간의 마지막저점 저장 if Color == RED Then { var1 = 저점[2,1]; } #하락구간의 마지막 고점 저장 if Color == BLUE Then { var2 = 고점[2,1]; } if MarketPosition <= 0 Then { if color == BLUE and var1 > 0 and L > var1-PriceScale*50 Then Buy("b",AtLimit,var1-PriceScale*50,1); } if MarketPosition == 1 Then { value1 = Floor(MaxEntries/2)+1; Buy("bb",AtLimit,(var1[BarsSinceEntry]-PriceScale*50)-(PriceScale*50)*MaxEntries,value1); if T == -1 and 고점[1,1] > 0 Then ExitLong("bx1",AtLimit,고점[1,1]+PriceScale*1); if T == 1 and 고점[2,1] > 0 Then ExitLong("bx2",AtLimit,고점[2,1]+PriceScale*1); } if MarketPosition >= 0 Then { if Color == RED and Var2 > 0 and H < var2+PriceScale*50 Then Sell("s",AtLimit,Var2+PriceScale*50,1); } if MarketPosition == -1 Then { value1 = Floor(MaxEntries/2)+1; Sell("ss",AtLimit,(var2[BarsSinceEntry]+PriceScale*50)+(PriceScale*50)*MaxEntries,value1); if T == 1 and 저점[1,1] > 0 Then ExitShort("sx1",AtLimit,저점[1,1]-PriceScale*1); if T == -1 and 저점[2,1] > 0 Then ExitShort("sx2",AtLimit,저점[2,1]-PriceScale*1); }