커뮤니티

추세전환 일정 크기 이상

프로필 이미지
고성
2024-10-24 14:44:56
750
글번호 184561
답변완료
input : Period(100); Var:j(0),T(0),txx(0); Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0), date21(0),date22(0),time21(0),time22(0), date31(0),date32(0),time31(0),time32(0),tx(0); Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0); Plot1(value12); For j = 0 To 19 { HiBar[j] = HiBar[j] + 1; LoBar[j] = LoBar[j] + 1; } if crossup(c,highest(H,Period)[1]) Then T = 1; if CrossDown(c,Lowest(L,Period)[1]) Then T = -1; If T == -1 Then { If T[1] != -1 Then { For j = 18 DownTo 0 { LoVal[j+1] = LoVal[j]; LoBar[j+1] = LoBar[j]; } LoVal[0] = L; LoBar[0] = 0; date11 = date[HiBar[0]]; time11 = stime[HiBar[0]]; Value11 = HiVal[0]; date12 = date[LoBar[0]]; time12 = stime[LoBar[0]]; Value12 = LoVal[0]; TL_Delete(TL); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetColor(TL1,Blue); date21 = date[HiBar[0]]; time21 = stime[HiBar[0]]; date22 = date[0]; time22 = stime[0]; if abs(value12[1]-value11[1]) < 0.5 Then Text_Delete(tx); tx = Text_New(sDate,stime,value12,NumToStr(value11-value12,2)); Text_SetColor(Tx,Blue); Text_SetStyle(tx,1,0); Text_SetSize(tx,25); Text_SetBold(tx,1); } If LoVal[0] > L Then { LoVal[0] = L; LoBar[0] = 0; date12 = date[LoBar[0]]; time12 = stime[LoBar[0]]; Value12 = LoVal[0]; TL_SetEnd(TL1, date12,time12,Value12); date22 = date[0]; time22 = stime[0]; Text_SetString(tx,NumToStr(value11-value12,2)); Text_SetLocation(tx,sDate,sTime,value12); } } If T == 1 Then { If T[1] != 1 Then { For j = 18 DownTo 0 { HiVal[j+1] = HiVal[j]; HiBar[j+1] = HiBar[j]; } HiVal[0] = H; HiBar[0] = 0; date11 = date[LoBar[0]]; time11 = stime[LoBar[0]]; Value11 = LoVal[0]; date12 = date[HiBar[0]]; time12 = stime[HiBar[0]]; Value12 = HiVal[0]; TL_Delete(TL); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetColor(TL1,Red); date31 = date[LoBar[0]]; time31 = stime[LoBar[0]]; date32 = date[0]; time32 = stime[0]; if abs(value12[1]-value11[1]) < 0.5 Then Text_Delete(tx); tx = Text_New(sDate,stime,value12,NumToStr(value12-value11,2)); Text_SetColor(Tx,Red); Text_SetStyle(tx,1,1); Text_SetSize(tx,25); Text_SetBold(tx,1); } If HiVal[0] < H Then { HiVal[0] = H; HiBar[0] = 0; date12 = date[HiBar[0]]; time12 = stime[HiBar[0]]; Value12 = HiVal[0]; TL_SetEnd(TL1, date12,time12,Value12); date32 = date[0]; time32 = stime[0]; Text_SetString(tx,NumToStr(value12-value11,2)); Text_SetLocation(tx,sDate,sTime,value12); } } TL_SetSize(TL1,1); 0.5보다 작아도 조건만 맞으면 바뀌는 추세 전환을, 조건이 맞아도 강제로 보류하고 있다가, 새 추세선의 크기가 0.5 이상이 될 때, 추세 전환으로 변경. 즉 전환 조건에 새 추세선 크기가 0.5 이상일 때 추가. 감사합니다.
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2024-10-25 10:31:04

안녕하세요 예스스탁입니다. input : Period(100); Var:j(0),T(0),txx(0); Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0), date21(0),date22(0),time21(0),time22(0), date31(0),date32(0),time31(0),time32(0),tx(0); Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0); Plot1(value12); For j = 0 To 19 { HiBar[j] = HiBar[j] + 1; LoBar[j] = LoBar[j] + 1; } if crossup(c,highest(H,Period)[1]) and (T == 0 or (T==-1 and C >= Loval[0]+0.5)) Then T = 1; if CrossDown(c,Lowest(L,Period)[1]) and (T == 0 or (T==1 and C <= Hival[0]-0.5)) Then T = -1; If T == -1 Then { If T[1] != -1 Then { For j = 18 DownTo 0 { LoVal[j+1] = LoVal[j]; LoBar[j+1] = LoBar[j]; } LoVal[0] = L; LoBar[0] = 0; date11 = date[HiBar[0]]; time11 = stime[HiBar[0]]; Value11 = HiVal[0]; date12 = date[LoBar[0]]; time12 = stime[LoBar[0]]; Value12 = LoVal[0]; TL_Delete(TL); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetColor(TL1,Blue); date21 = date[HiBar[0]]; time21 = stime[HiBar[0]]; date22 = date[0]; time22 = stime[0]; if abs(value12[1]-value11[1]) < 0.5 Then Text_Delete(tx); tx = Text_New(sDate,stime,value12,NumToStr(value11-value12,2)); Text_SetColor(Tx,Blue); Text_SetStyle(tx,1,0); Text_SetSize(tx,25); Text_SetBold(tx,1); } If LoVal[0] > L Then { LoVal[0] = L; LoBar[0] = 0; date12 = date[LoBar[0]]; time12 = stime[LoBar[0]]; Value12 = LoVal[0]; TL_SetEnd(TL1, date12,time12,Value12); date22 = date[0]; time22 = stime[0]; Text_SetString(tx,NumToStr(value11-value12,2)); Text_SetLocation(tx,sDate,sTime,value12); } } If T == 1 Then { If T[1] != 1 Then { For j = 18 DownTo 0 { HiVal[j+1] = HiVal[j]; HiBar[j+1] = HiBar[j]; } HiVal[0] = H; HiBar[0] = 0; date11 = date[LoBar[0]]; time11 = stime[LoBar[0]]; Value11 = LoVal[0]; date12 = date[HiBar[0]]; time12 = stime[HiBar[0]]; Value12 = HiVal[0]; TL_Delete(TL); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetColor(TL1,Red); date31 = date[LoBar[0]]; time31 = stime[LoBar[0]]; date32 = date[0]; time32 = stime[0]; if abs(value12[1]-value11[1]) < 0.5 Then Text_Delete(tx); tx = Text_New(sDate,stime,value12,NumToStr(value12-value11,2)); Text_SetColor(Tx,Red); Text_SetStyle(tx,1,1); Text_SetSize(tx,25); Text_SetBold(tx,1); } If HiVal[0] < H Then { HiVal[0] = H; HiBar[0] = 0; date12 = date[HiBar[0]]; time12 = stime[HiBar[0]]; Value12 = HiVal[0]; TL_SetEnd(TL1, date12,time12,Value12); date32 = date[0]; time32 = stime[0]; Text_SetString(tx,NumToStr(value12-value11,2)); Text_SetLocation(tx,sDate,sTime,value12); } } TL_SetSize(TL1,1); 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 추세전환 일정 크기 이상 > input : Period(100); Var:j(0),T(0),txx(0); Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0), date21(0),date22(0),time21(0),time22(0), date31(0),date32(0),time31(0),time32(0),tx(0); Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0); Plot1(value12); For j = 0 To 19 { HiBar[j] = HiBar[j] + 1; LoBar[j] = LoBar[j] + 1; } if crossup(c,highest(H,Period)[1]) Then T = 1; if CrossDown(c,Lowest(L,Period)[1]) Then T = -1; If T == -1 Then { If T[1] != -1 Then { For j = 18 DownTo 0 { LoVal[j+1] = LoVal[j]; LoBar[j+1] = LoBar[j]; } LoVal[0] = L; LoBar[0] = 0; date11 = date[HiBar[0]]; time11 = stime[HiBar[0]]; Value11 = HiVal[0]; date12 = date[LoBar[0]]; time12 = stime[LoBar[0]]; Value12 = LoVal[0]; TL_Delete(TL); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetColor(TL1,Blue); date21 = date[HiBar[0]]; time21 = stime[HiBar[0]]; date22 = date[0]; time22 = stime[0]; if abs(value12[1]-value11[1]) < 0.5 Then Text_Delete(tx); tx = Text_New(sDate,stime,value12,NumToStr(value11-value12,2)); Text_SetColor(Tx,Blue); Text_SetStyle(tx,1,0); Text_SetSize(tx,25); Text_SetBold(tx,1); } If LoVal[0] > L Then { LoVal[0] = L; LoBar[0] = 0; date12 = date[LoBar[0]]; time12 = stime[LoBar[0]]; Value12 = LoVal[0]; TL_SetEnd(TL1, date12,time12,Value12); date22 = date[0]; time22 = stime[0]; Text_SetString(tx,NumToStr(value11-value12,2)); Text_SetLocation(tx,sDate,sTime,value12); } } If T == 1 Then { If T[1] != 1 Then { For j = 18 DownTo 0 { HiVal[j+1] = HiVal[j]; HiBar[j+1] = HiBar[j]; } HiVal[0] = H; HiBar[0] = 0; date11 = date[LoBar[0]]; time11 = stime[LoBar[0]]; Value11 = LoVal[0]; date12 = date[HiBar[0]]; time12 = stime[HiBar[0]]; Value12 = HiVal[0]; TL_Delete(TL); TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen); TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetColor(TL1,Red); date31 = date[LoBar[0]]; time31 = stime[LoBar[0]]; date32 = date[0]; time32 = stime[0]; if abs(value12[1]-value11[1]) < 0.5 Then Text_Delete(tx); tx = Text_New(sDate,stime,value12,NumToStr(value12-value11,2)); Text_SetColor(Tx,Red); Text_SetStyle(tx,1,1); Text_SetSize(tx,25); Text_SetBold(tx,1); } If HiVal[0] < H Then { HiVal[0] = H; HiBar[0] = 0; date12 = date[HiBar[0]]; time12 = stime[HiBar[0]]; Value12 = HiVal[0]; TL_SetEnd(TL1, date12,time12,Value12); date32 = date[0]; time32 = stime[0]; Text_SetString(tx,NumToStr(value12-value11,2)); Text_SetLocation(tx,sDate,sTime,value12); } } TL_SetSize(TL1,1); 0.5보다 작아도 조건만 맞으면 바뀌는 추세 전환을, 조건이 맞아도 강제로 보류하고 있다가, 새 추세선의 크기가 0.5 이상이 될 때, 추세 전환으로 변경. 즉 전환 조건에 새 추세선 크기가 0.5 이상일 때 추가. 감사합니다.