커뮤니티

트렌드 크기

프로필 이미지
고성
2023-05-12 10:04:03
1608
글번호 168900
답변완료
inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } 상승 트렌드가 생기면 트렌드 상단에, 크기를 트렌드를 따라 올라가며 red로 표기. 하락 트렌드로 바뀌면 하단을 따라 내려가며 크기를 blue로 표기. 표기는 마자막 상단 하나, 하단 하나만 남기고 이전은 삭제. 감사합니다.
지표
답변 5
프로필 이미지

예스스탁 예스스탁 답변

2023-05-12 11:42:08

안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0),tx2(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend == 1 Then { if Trend != Trend[1] Then { Text_Delete(tx1); value1 = st; tx1 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } Else { Text_SetLocation(tx1,sdate,sTime,st); Text_SetString(tx1,NumToStr(st-value1,2)); } } if trend == -1 Then { if Trend != Trend[1] Then { Text_Delete(tx2); value1 = st; tx2 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx2,Blue); Text_SetStyle(tx2,2,2); } Else { Text_SetLocation(tx2,sdate,sTime,st); Text_SetString(tx2,NumToStr(st-value1,2)); } } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 트렌드 크기 > inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } 상승 트렌드가 생기면 트렌드 상단에, 크기를 트렌드를 따라 올라가며 red로 표기. 하락 트렌드로 바뀌면 하단을 따라 내려가며 크기를 blue로 표기. 표기는 마자막 상단 하나, 하단 하나만 남기고 이전은 삭제. 감사합니다.
프로필 이미지

고성

2023-05-12 12:56:08

> 예스스탁 님이 쓴 글입니다. > 제목 : Re : 트렌드 크기 > 안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0),tx2(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend == 1 Then { if Trend != Trend[1] Then { Text_Delete(tx1); value1 = st; tx1 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } Else { Text_SetLocation(tx1,sdate,sTime,st); Text_SetString(tx1,NumToStr(st-value1,2)); } } if trend == -1 Then { if Trend != Trend[1] Then { Text_Delete(tx2); value1 = st; tx2 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx2,Blue); Text_SetStyle(tx2,2,2); } Else { Text_SetLocation(tx2,sdate,sTime,st); Text_SetString(tx2,NumToStr(st-value1,2)); } } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 트렌드 크기 > inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } 상승 트렌드가 생기면 트렌드 상단에, 크기를 트렌드를 따라 올라가며 red로 표기. 하락 트렌드로 바뀌면 하단을 따라 내려가며 크기를 blue로 표기. 표기는 마자막 상단 하나, 하단 하나만 남기고 이전은 삭제. 감사합니다. 재문의 설명을 잘못했습니다. 트렌드 크기가 아니고, a,트렌드 내의 주가 최고가와 최저가의 차이입니다. b,표기 위치도 봉의 상하단을 따라가면 좋겠습니다. c,상하 하나씩 두개 표기에서, 마지막 하나만 남기고 삭제로 수정 부탁드립니다.
프로필 이미지

예스스탁 예스스탁 답변

2023-05-12 12:59:28

안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend != trend[1] Then { Text_Delete(tx1); value1 = h; Value2 = l; Value3 = value1-Value2; if trend == 1 Then { tx1 = Text_New(sDate,sTime,value1,NumToStr(value1,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } if trend == -1 Then { tx1 = Text_New(sDate,sTime,value2,NumToStr(value1,2)); Text_SetColor(tx1,Blue); Text_SetStyle(tx1,2,0); } } Else { if h > value1 Then value1 = h; if l < Value2 Then Value2 = l; if trend == 1 Then Text_SetLocation(tx1,sdate,sTime,value1); if trend == -1 Then Text_SetLocation(tx1,sdate,sTime,value1); Text_SetString(tx1,NumToStr(value3,2)); } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : Re : Re : 트렌드 크기 > > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 트렌드 크기 > 안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0),tx2(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend == 1 Then { if Trend != Trend[1] Then { Text_Delete(tx1); value1 = st; tx1 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } Else { Text_SetLocation(tx1,sdate,sTime,st); Text_SetString(tx1,NumToStr(st-value1,2)); } } if trend == -1 Then { if Trend != Trend[1] Then { Text_Delete(tx2); value1 = st; tx2 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx2,Blue); Text_SetStyle(tx2,2,2); } Else { Text_SetLocation(tx2,sdate,sTime,st); Text_SetString(tx2,NumToStr(st-value1,2)); } } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 트렌드 크기 > inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } 상승 트렌드가 생기면 트렌드 상단에, 크기를 트렌드를 따라 올라가며 red로 표기. 하락 트렌드로 바뀌면 하단을 따라 내려가며 크기를 blue로 표기. 표기는 마자막 상단 하나, 하단 하나만 남기고 이전은 삭제. 감사합니다. 재문의 설명을 잘못했습니다. 트렌드 크기가 아니고, a,트렌드 내의 주가 최고가와 최저가의 차이입니다. b,표기 위치도 봉의 상하단을 따라가면 좋겠습니다. c,상하 하나씩 두개 표기에서, 마지막 하나만 남기고 삭제로 수정 부탁드립니다.
프로필 이미지

고성

2023-05-12 14:23:04

> 예스스탁 님이 쓴 글입니다. > 제목 : Re : Re : Re : 트렌드 크기 > 안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend != trend[1] Then { Text_Delete(tx1); value1 = h; Value2 = l; Value3 = value1-Value2; if trend == 1 Then { tx1 = Text_New(sDate,sTime,value1,NumToStr(value1,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } if trend == -1 Then { tx1 = Text_New(sDate,sTime,value2,NumToStr(value1,2)); Text_SetColor(tx1,Blue); Text_SetStyle(tx1,2,0); } } Else { if h > value1 Then value1 = h; if l < Value2 Then Value2 = l; if trend == 1 Then Text_SetLocation(tx1,sdate,sTime,value1); if trend == -1 Then Text_SetLocation(tx1,sdate,sTime,value1); Text_SetString(tx1,NumToStr(value3,2)); } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : Re : Re : 트렌드 크기 > > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 트렌드 크기 > 안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0),tx2(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend == 1 Then { if Trend != Trend[1] Then { Text_Delete(tx1); value1 = st; tx1 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } Else { Text_SetLocation(tx1,sdate,sTime,st); Text_SetString(tx1,NumToStr(st-value1,2)); } } if trend == -1 Then { if Trend != Trend[1] Then { Text_Delete(tx2); value1 = st; tx2 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx2,Blue); Text_SetStyle(tx2,2,2); } Else { Text_SetLocation(tx2,sdate,sTime,st); Text_SetString(tx2,NumToStr(st-value1,2)); } } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 트렌드 크기 > inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } 상승 트렌드가 생기면 트렌드 상단에, 크기를 트렌드를 따라 올라가며 red로 표기. 하락 트렌드로 바뀌면 하단을 따라 내려가며 크기를 blue로 표기. 표기는 마자막 상단 하나, 하단 하나만 남기고 이전은 삭제. 감사합니다. 재문의 설명을 잘못했습니다. 트렌드 크기가 아니고, a,트렌드 내의 주가 최고가와 최저가의 차이입니다. b,표기 위치도 봉의 상하단을 따라가면 좋겠습니다. c,상하 하나씩 두개 표기에서, 마지막 하나만 남기고 삭제로 수정 부탁드립니다. 재문의 전환될 때만, 나올수 없는 크기인 0.05 또는 0.00 나오고 움직임 없이 커지질 않습니다. 전환될 때의 봉을 인식한 듯 합니다. 전환전 최고나 최저점을 인식하면 좋겠습니다. 트렌드 내의 전체 주가 최고가와 최저가 차이, 검토 부탁드립니다.
프로필 이미지

예스스탁 예스스탁 답변

2023-05-12 15:38:03

안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend != trend[1] Then { Text_Delete(tx1); value1 = h; Value2 = l; Value3 = value1-Value2; if trend == 1 Then { tx1 = Text_New(sDate,sTime,value1,NumToStr(Value3,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } if trend == -1 Then { tx1 = Text_New(sDate,sTime,value2,NumToStr(Value3,2)); Text_SetColor(tx1,Blue); Text_SetStyle(tx1,2,0); } } Else { if h > value1 Then value1 = h; if l < Value2 Then Value2 = l; Value3 = value1-Value2; if trend == 1 Then Text_SetLocation(tx1,sdate,sTime,Value1); if trend == -1 Then Text_SetLocation(tx1,sdate,sTime,Value2); Text_SetString(tx1,NumToStr(value3,2)); } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : Re : Re : Re : Re : 트렌드 크기 > > 예스스탁 님이 쓴 글입니다. > 제목 : Re : Re : Re : 트렌드 크기 > 안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend != trend[1] Then { Text_Delete(tx1); value1 = h; Value2 = l; Value3 = value1-Value2; if trend == 1 Then { tx1 = Text_New(sDate,sTime,value1,NumToStr(value1,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } if trend == -1 Then { tx1 = Text_New(sDate,sTime,value2,NumToStr(value1,2)); Text_SetColor(tx1,Blue); Text_SetStyle(tx1,2,0); } } Else { if h > value1 Then value1 = h; if l < Value2 Then Value2 = l; if trend == 1 Then Text_SetLocation(tx1,sdate,sTime,value1); if trend == -1 Then Text_SetLocation(tx1,sdate,sTime,value1); Text_SetString(tx1,NumToStr(value3,2)); } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : Re : Re : 트렌드 크기 > > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 트렌드 크기 > 안녕하세요 예스스탁입니다. inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0),tx1(0),tx2(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } if trend == 1 Then { if Trend != Trend[1] Then { Text_Delete(tx1); value1 = st; tx1 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx1,Red); Text_SetStyle(tx1,2,1); } Else { Text_SetLocation(tx1,sdate,sTime,st); Text_SetString(tx1,NumToStr(st-value1,2)); } } if trend == -1 Then { if Trend != Trend[1] Then { Text_Delete(tx2); value1 = st; tx2 = Text_New(sDate,sTime,st,NumToStr(st-value1,2)); Text_SetColor(tx2,Blue); Text_SetStyle(tx2,2,2); } Else { Text_SetLocation(tx2,sdate,sTime,st); Text_SetString(tx2,NumToStr(st-value1,2)); } } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 트렌드 크기 > inputs: ATRLength(15), Strength(18), 폭(0.2); input : 쌍봉상(1),쌍봉하(2),쌍바닥상(2),쌍바닥하(2); var : STrend(0),ATRv(0), avgv(0), dnv(0), upv(0), trend(1), flag(0), flagh(0), ST(0),hl(0); var : idx(0),hh(0),ll(0),EP1(0),EP2(0); var : ema1(0),ema2(0),ema3(0),h1(0),l1(0),h2(0),h3(0),l2(0),l3(0),h4(0),l4(0); var :tx(0),tl(0); Ep1 = 2/(ATRLength+1); Ep2 = 2/(Strength+1); idx = idx+1; if idx < ATRLength Then { hh = DayHigh; ll = daylow; } Else { hh = Highest(High, ATRLength); ll = Lowest(Low, ATRLength); } if idx < Strength Then { h1 = DayHigh; l1 = daylow; } Else { h1 = Highest(High, Strength); l1 = Lowest(Low, Strength); } hl = hh-ll; if idx == 1 Then { ema1 = hl; ema2 = h; ema3 = l; } Else { ema1 = hl * EP1 + ema1 * (1-EP1); ema2 = h * EP2 + ema2 * (1-EP2); ema3 = l * EP2 + ema3 * (1-EP2); } atrv = ema1; avgv = (ema2+ema3)/2; upv = avgv + ATRv; dnv = avgv - ATRv; if idx >= 2 then { if c > upv[1] and c > h1[1] then trend = 1; else if c < dnv[1] and c < l1[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dnv < dnv[1] then dnv=dnv[1]; if trend < 0 and upv > upv[1] then upv=upv[1]; if flag == 1 then upv = avgv + ATRv; if flagh == 1 then dnv = avgv - ATRv; if trend == 1 then ST = dnv; else ST = upv; STrend = trend; } Plot1(st,"SuperTrend",iff(strend == 1,red,blue)); if Trend != Trend[1] Then { if Trend == 1 Then { var1 = h; var2 = var1[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Red); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var4 > 0 and var3 <= Var4+PriceScale*쌍바닥상 and var3 >= Var4-PriceScale*쌍바닥하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Magenta); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } Else { Var3 = l; Var4 = Var3[1]; tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Blue); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); if Var2 > 0 and var1 <= Var2+PriceScale*쌍봉상 and var1 >= Var2-PriceScale*쌍봉하 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Cyan); Text_SetSize(tx,25); Text_SetStyle(tx,2,2); } } } Else { if Trend == 1 Then { if h > var1 Then var1 = h; } if Trend == -1 Then { if l < var3 Then var3 = l; } } if Trend != Trend[1] Then { if Trend == 1 Then { h2 = h; h3 = h2[1]; h4 = h3[1]; if L4 > 0 and max(L2,l3,l4) <= min(L2,l3,l4)+폭 Then { tx = Text_New_Self(sDate,sTime, st,"●"); Text_SetColor(tx,Black); Text_SetSize(tx,20); Text_SetStyle(tx,2,2); } } Else { L2 = l; l3 = l2[1]; l4 = l3[1]; } } Else { if Trend == 1 Then { if h > h2 Then h2 = h; } if Trend == -1 Then { if l < L2 Then L2 = l; } } 상승 트렌드가 생기면 트렌드 상단에, 크기를 트렌드를 따라 올라가며 red로 표기. 하락 트렌드로 바뀌면 하단을 따라 내려가며 크기를 blue로 표기. 표기는 마자막 상단 하나, 하단 하나만 남기고 이전은 삭제. 감사합니다. 재문의 설명을 잘못했습니다. 트렌드 크기가 아니고, a,트렌드 내의 주가 최고가와 최저가의 차이입니다. b,표기 위치도 봉의 상하단을 따라가면 좋겠습니다. c,상하 하나씩 두개 표기에서, 마지막 하나만 남기고 삭제로 수정 부탁드립니다. 재문의 전환될 때만, 나올수 없는 크기인 0.05 또는 0.00 나오고 움직임 없이 커지질 않습니다. 전환될 때의 봉을 인식한 듯 합니다. 전환전 최고나 최저점을 인식하면 좋겠습니다. 트렌드 내의 전체 주가 최고가와 최저가 차이, 검토 부탁드립니다.