커뮤니티

질문드립니다.

프로필 이미지
stockric
2018-07-12 01:20:03
145
글번호 120498
답변완료
Input:chRate(1); Var:j(0),upTr(100),dnTr(-100),upRate(0),dnRate(0),trnd(0),TL(0), date11(0),date12(0),time11(0),time12(0),TL1(0), date21(0),date22(0),time21(0),time22(0),TL2(0), date31(0),date32(0),time31(0),time32(0),TL3(0); Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0); //hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점 //hiVal[0]은 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다. //loVal[0]은 반대 개념 var : TL13(0),TL14(0),color(0),Tx1(0),Tx2(0),tx3(0),tx4(0),tx11(0),tx22(0),cnt(0); upRate = 1 + (chRate/100); dnRate = 1 - (chRate/100); for j = 1 to 9 { loBar[j] = loBar[j] + 1; hiBar[j] = hiBar[j] + 1; } if hiVal[0] <= H or hiVal[0] == 0 then { hiVal[0] = H; hiBar[0] = 0; } else { hiBar[0] = hiBar[0] + 1; //현재 고점의 위치 } if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점 loVal[0] = L; loBar[0] = 0; } else { loBar[0] = loBar[0] + 1; } if trnd != dnTr && hiVal[0] > H && hiVal[0] * dnRate > L then trnd = dnTr; else if trnd != upTr && loVal[0] < L && loVal[0] * upRate < H then trnd = upTr; if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면 for j = 8 downto 1 { hiVal[j+1] = hiVal[j]; hiBar[j+1] = hiBar[j]; } hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입 hiBar[1] = hiBar[0]; hiVal[0] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = L; loBar[0] = 0; //전고점이 새로 생긴 것이니까 전저점에서 전고점까지 추세선을 긋는다. date11 = date[loBar[1]]; //추세선 시작일. 전저점의 날짜 time11 = stime[loBar[1]]; //추세선 시작시간 Value11 = loVal[1]; //추세선 시작가격 date12 = date[hiBar[1]]; //추세선 종료일. 전고점의 날짜 time12 = stime[hiBar[1]]; //추세선 종료시간 Value12 = hiVal[1]; //추세선 종료가격 TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); // 추세선 상승 //TL_New는 신규 추세선을 그려주는 함수 } if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데 hiVal[1] < hiVal[0] and //전고점보다 더 높은 고점이 출현했다면 hiVal[0] * dnRate > L then { hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다. hiBar[1] = hiBar[0]; hiVal[0] = H; hiBar[0] = 0; loVal[0] = L; loBar[0] = 0; //전고점이 추가된 게 아니고 바뀐 것이므로 종료일,종료시간,종료가격만 바꿔준다. date12 = date[hiBar[1]]; //추세선 종료일 time12 = stime[hiBar[1]]; Value12 = hiVal[1]; TL_SetEnd(TL1, date12,time12,Value12); //TL_SetEnd는 기존추세선의 종료지점을 변경해주는 추세선 함수이다. //TL_Delete 함수를 써서 직전의 추세선을 지우고 다시 TL_New로 추세선을 추가해도 된다. } if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우 for j = 8 downto 1 { //이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여 loVal[j+1] = loVal[j]; loBar[j+1] = loBar[j]; } loVal[1] = loVal[0]; loBar[1] = loBar[0]; loVal[0] = L; loBar[0] = 0; hiVal[0] = H; hiBar[0] = 0; date11 = date[hiBar[1]]; // time11 = stime[hiBar[1]]; Value11 = hiVal[1]; date12 = date[loBar[1]]; time12 = stime[loBar[1]]; Value12 = loVal[1]; TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); //하락 추세선 생성 } if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데 loVal[1] > loVal[0] and //전저점보다 낮은 저가가 출현했다면 loVal[0] * upRate < H then { loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다. loBar[1] = loBar[0]; loVal[0] = L; loBar[0] = 0; hiVal[0] = H; hiBar[0] = 0; date12 = date[loBar[1]]; time12 = stime[loBar[1]]; Value12 = loVal[1]; TL_SetEnd(TL1, date12,time12,Value12); } if trnd == upTr and loVal[2] > loVal[1] then{ TL_SetColor(TL1,BLUE); color = blue; } else if trnd == dnTr and hiVal[2] < hiVal[1] then{ TL_SetColor(TL1,RED); color = RED; } else{ TL_SetColor(TL1,BLACK); color = BLACK; } TL_SetSize(TL1,2); TL_SetColor(TL2,RED); TL_SetColor(TL3,BLUE); if var1 <= 0 and Trnd == uptr and Trnd != Trnd[1] Then{ var1 = 1; value1 = loval[1]; TL_SetColor(TL,RED); TL_SetSize(TL,2); TX2= Text_New(sdate[lobar[1]],stime[lobar[1]],L,"Up Trend↗"); Text_SetColor(TX2,RED);#텍스트 색상 // TL13 = TL_New(date11,time11,Value11,date12,time12,Value11); 직선 추세선 그어지는 함수. 꼴뵈기싫음 // TL14 = TL_New(date12,time12,Value11,date12,time12,Value12); TL_SetColor(TL13,color); TL_SetColor(TL14,color); } if var1 >= 0 and Trnd == dntr and Trnd != Trnd[1] then{ var1 = -1; value1 = hival[1]; TL_SetColor(TL,BLUE); TL_SetSize(TL,2); TX4= Text_New(sdate[hibar[1]],stime[hibar[1]],H,"Down Trend↘"); Text_SetColor(TX4,BLUE);#텍스트 색상 //TL13 = TL_New(date11,time11,Value11,date12,time12,Value11); 직선 추세선 그어지는 함수. 꼴뵈기싫음 // TL14 = TL_New(date12,time12,Value11,date12,time12,Value12); TL_SetColor(TL13,color); TL_SetColor(TL14,color); } 함수인데요. down trend와 up trend로 시작되는 구간에 페인트바를 넣어 캔들에 표시하고싶은데 아무리해도 안되네요.
강조
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-07-12 14:31:52

안녕하세요 예스스탁입니다. 문의하신 내용은 가능하지 않습니다. 텍스트와 추세선은 날짜와 시간을 지정해 현재봉보다 과거봉에 출력되게 할수 있지만 페이트바는 현재시점보다 과거봉에 표시를 할수 없습니다 아래 수식에서 강조가 출력되는 봉이 텍스트 출력 명령어가 실행되는 지점입니다 Input:chRate(1); Var:j(0),upTr(100),dnTr(-100),upRate(0),dnRate(0),trnd(0),TL(0), date11(0),date12(0),time11(0),time12(0),TL1(0), date21(0),date22(0),time21(0),time22(0),TL2(0), date31(0),date32(0),time31(0),time32(0),TL3(0); Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0); //hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점 //hiVal[0]은 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다. //loVal[0]은 반대 개념 var : TL13(0),TL14(0),color(0),Tx1(0),Tx2(0),tx3(0),tx4(0),tx11(0),tx22(0),cnt(0); upRate = 1 + (chRate/100); dnRate = 1 - (chRate/100); for j = 1 to 9 { loBar[j] = loBar[j] + 1; hiBar[j] = hiBar[j] + 1; } if hiVal[0] <= H or hiVal[0] == 0 then { hiVal[0] = H; hiBar[0] = 0; } else { hiBar[0] = hiBar[0] + 1; //현재 고점의 위치 } if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점 loVal[0] = L; loBar[0] = 0; } else { loBar[0] = loBar[0] + 1; } if trnd != dnTr && hiVal[0] > H && hiVal[0] * dnRate > L then trnd = dnTr; else if trnd != upTr && loVal[0] < L && loVal[0] * upRate < H then trnd = upTr; if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면 for j = 8 downto 1 { hiVal[j+1] = hiVal[j]; hiBar[j+1] = hiBar[j]; } hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입 hiBar[1] = hiBar[0]; hiVal[0] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = L; loBar[0] = 0; //전고점이 새로 생긴 것이니까 전저점에서 전고점까지 추세선을 긋는다. date11 = date[loBar[1]]; //추세선 시작일. 전저점의 날짜 time11 = stime[loBar[1]]; //추세선 시작시간 Value11 = loVal[1]; //추세선 시작가격 date12 = date[hiBar[1]]; //추세선 종료일. 전고점의 날짜 time12 = stime[hiBar[1]]; //추세선 종료시간 Value12 = hiVal[1]; //추세선 종료가격 TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); // 추세선 상승 //TL_New는 신규 추세선을 그려주는 함수 } if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데 hiVal[1] < hiVal[0] and //전고점보다 더 높은 고점이 출현했다면 hiVal[0] * dnRate > L then { hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다. hiBar[1] = hiBar[0]; hiVal[0] = H; hiBar[0] = 0; loVal[0] = L; loBar[0] = 0; //전고점이 추가된 게 아니고 바뀐 것이므로 종료일,종료시간,종료가격만 바꿔준다. date12 = date[hiBar[1]]; //추세선 종료일 time12 = stime[hiBar[1]]; Value12 = hiVal[1]; TL_SetEnd(TL1, date12,time12,Value12); //TL_SetEnd는 기존추세선의 종료지점을 변경해주는 추세선 함수이다. //TL_Delete 함수를 써서 직전의 추세선을 지우고 다시 TL_New로 추세선을 추가해도 된다. } if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우 for j = 8 downto 1 { //이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여 loVal[j+1] = loVal[j]; loBar[j+1] = loBar[j]; } loVal[1] = loVal[0]; loBar[1] = loBar[0]; loVal[0] = L; loBar[0] = 0; hiVal[0] = H; hiBar[0] = 0; date11 = date[hiBar[1]]; // time11 = stime[hiBar[1]]; Value11 = hiVal[1]; date12 = date[loBar[1]]; time12 = stime[loBar[1]]; Value12 = loVal[1]; TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); //하락 추세선 생성 } if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데 loVal[1] > loVal[0] and //전저점보다 낮은 저가가 출현했다면 loVal[0] * upRate < H then { loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다. loBar[1] = loBar[0]; loVal[0] = L; loBar[0] = 0; hiVal[0] = H; hiBar[0] = 0; date12 = date[loBar[1]]; time12 = stime[loBar[1]]; Value12 = loVal[1]; TL_SetEnd(TL1, date12,time12,Value12); } if trnd == upTr and loVal[2] > loVal[1] then{ TL_SetColor(TL1,BLUE); color = blue; } else if trnd == dnTr and hiVal[2] < hiVal[1] then{ TL_SetColor(TL1,RED); color = RED; } else{ TL_SetColor(TL1,BLACK); color = BLACK; } TL_SetSize(TL1,2); TL_SetColor(TL2,RED); TL_SetColor(TL3,BLUE); if var1 <= 0 and Trnd == uptr and Trnd != Trnd[1] Then{ var1 = 1; value1 = loval[1]; TL_SetColor(TL,RED); TL_SetSize(TL,2); TX2= Text_New(sdate[lobar[1]],stime[lobar[1]],L,"Up Trend↗"); Text_SetColor(TX2,RED);#텍스트 색상 PlotPaintBar(H,L,"강조",MAGENTA); // TL13 = TL_New(date11,time11,Value11,date12,time12,Value11); 직선 추세선 그어지는 함수. 꼴뵈기싫음 // TL14 = TL_New(date12,time12,Value11,date12,time12,Value12); TL_SetColor(TL13,color); TL_SetColor(TL14,color); } if var1 >= 0 and Trnd == dntr and Trnd != Trnd[1] then{ var1 = -1; value1 = hival[1]; TL_SetColor(TL,BLUE); TL_SetSize(TL,2); TX4= Text_New(sdate[hibar[1]],stime[hibar[1]],H,"Down Trend↘"); Text_SetColor(TX4,BLUE);#텍스트 색상 PlotPaintBar(H,L,"강조",CYAN); //TL13 = TL_New(date11,time11,Value11,date12,time12,Value11); 직선 추세선 그어지는 함수. 꼴뵈기싫음 // TL14 = TL_New(date12,time12,Value11,date12,time12,Value12); TL_SetColor(TL13,color); TL_SetColor(TL14,color); } 즐거운 하루되세요 > stockric 님이 쓴 글입니다. > 제목 : 질문드립니다. > Input:chRate(1); Var:j(0),upTr(100),dnTr(-100),upRate(0),dnRate(0),trnd(0),TL(0), date11(0),date12(0),time11(0),time12(0),TL1(0), date21(0),date22(0),time21(0),time22(0),TL2(0), date31(0),date32(0),time31(0),time32(0),TL3(0); Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0); //hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점 //hiVal[0]은 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다. //loVal[0]은 반대 개념 var : TL13(0),TL14(0),color(0),Tx1(0),Tx2(0),tx3(0),tx4(0),tx11(0),tx22(0),cnt(0); upRate = 1 + (chRate/100); dnRate = 1 - (chRate/100); for j = 1 to 9 { loBar[j] = loBar[j] + 1; hiBar[j] = hiBar[j] + 1; } if hiVal[0] <= H or hiVal[0] == 0 then { hiVal[0] = H; hiBar[0] = 0; } else { hiBar[0] = hiBar[0] + 1; //현재 고점의 위치 } if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점 loVal[0] = L; loBar[0] = 0; } else { loBar[0] = loBar[0] + 1; } if trnd != dnTr && hiVal[0] > H && hiVal[0] * dnRate > L then trnd = dnTr; else if trnd != upTr && loVal[0] < L && loVal[0] * upRate < H then trnd = upTr; if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면 for j = 8 downto 1 { hiVal[j+1] = hiVal[j]; hiBar[j+1] = hiBar[j]; } hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입 hiBar[1] = hiBar[0]; hiVal[0] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = L; loBar[0] = 0; //전고점이 새로 생긴 것이니까 전저점에서 전고점까지 추세선을 긋는다. date11 = date[loBar[1]]; //추세선 시작일. 전저점의 날짜 time11 = stime[loBar[1]]; //추세선 시작시간 Value11 = loVal[1]; //추세선 시작가격 date12 = date[hiBar[1]]; //추세선 종료일. 전고점의 날짜 time12 = stime[hiBar[1]]; //추세선 종료시간 Value12 = hiVal[1]; //추세선 종료가격 TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); // 추세선 상승 //TL_New는 신규 추세선을 그려주는 함수 } if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데 hiVal[1] < hiVal[0] and //전고점보다 더 높은 고점이 출현했다면 hiVal[0] * dnRate > L then { hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다. hiBar[1] = hiBar[0]; hiVal[0] = H; hiBar[0] = 0; loVal[0] = L; loBar[0] = 0; //전고점이 추가된 게 아니고 바뀐 것이므로 종료일,종료시간,종료가격만 바꿔준다. date12 = date[hiBar[1]]; //추세선 종료일 time12 = stime[hiBar[1]]; Value12 = hiVal[1]; TL_SetEnd(TL1, date12,time12,Value12); //TL_SetEnd는 기존추세선의 종료지점을 변경해주는 추세선 함수이다. //TL_Delete 함수를 써서 직전의 추세선을 지우고 다시 TL_New로 추세선을 추가해도 된다. } if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우 for j = 8 downto 1 { //이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여 loVal[j+1] = loVal[j]; loBar[j+1] = loBar[j]; } loVal[1] = loVal[0]; loBar[1] = loBar[0]; loVal[0] = L; loBar[0] = 0; hiVal[0] = H; hiBar[0] = 0; date11 = date[hiBar[1]]; // time11 = stime[hiBar[1]]; Value11 = hiVal[1]; date12 = date[loBar[1]]; time12 = stime[loBar[1]]; Value12 = loVal[1]; TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); //하락 추세선 생성 } if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데 loVal[1] > loVal[0] and //전저점보다 낮은 저가가 출현했다면 loVal[0] * upRate < H then { loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다. loBar[1] = loBar[0]; loVal[0] = L; loBar[0] = 0; hiVal[0] = H; hiBar[0] = 0; date12 = date[loBar[1]]; time12 = stime[loBar[1]]; Value12 = loVal[1]; TL_SetEnd(TL1, date12,time12,Value12); } if trnd == upTr and loVal[2] > loVal[1] then{ TL_SetColor(TL1,BLUE); color = blue; } else if trnd == dnTr and hiVal[2] < hiVal[1] then{ TL_SetColor(TL1,RED); color = RED; } else{ TL_SetColor(TL1,BLACK); color = BLACK; } TL_SetSize(TL1,2); TL_SetColor(TL2,RED); TL_SetColor(TL3,BLUE); if var1 <= 0 and Trnd == uptr and Trnd != Trnd[1] Then{ var1 = 1; value1 = loval[1]; TL_SetColor(TL,RED); TL_SetSize(TL,2); TX2= Text_New(sdate[lobar[1]],stime[lobar[1]],L,"Up Trend↗"); Text_SetColor(TX2,RED);#텍스트 색상 // TL13 = TL_New(date11,time11,Value11,date12,time12,Value11); 직선 추세선 그어지는 함수. 꼴뵈기싫음 // TL14 = TL_New(date12,time12,Value11,date12,time12,Value12); TL_SetColor(TL13,color); TL_SetColor(TL14,color); } if var1 >= 0 and Trnd == dntr and Trnd != Trnd[1] then{ var1 = -1; value1 = hival[1]; TL_SetColor(TL,BLUE); TL_SetSize(TL,2); TX4= Text_New(sdate[hibar[1]],stime[hibar[1]],H,"Down Trend↘"); Text_SetColor(TX4,BLUE);#텍스트 색상 //TL13 = TL_New(date11,time11,Value11,date12,time12,Value11); 직선 추세선 그어지는 함수. 꼴뵈기싫음 // TL14 = TL_New(date12,time12,Value11,date12,time12,Value12); TL_SetColor(TL13,color); TL_SetColor(TL14,color); } 함수인데요. down trend와 up trend로 시작되는 구간에 페인트바를 넣어 캔들에 표시하고싶은데 아무리해도 안되네요.