커뮤니티

검색식 부탁합니다

프로필 이미지
행복만땅
2024-10-10 23:57:12
773
글번호 183634
답변완료
색상이 변하는 지점(적석에서 녹색으로 바뀌는 변곡점)에서 종목검색식 부탁드립니다. SuperTrend input : factor(3), AtrPeriod(10); var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0); var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0); if CurrentBar > 1 Then { src = (H+L)/2; // ATR계산(ATR 계산시 지수가중이동평균(rma)이용) alpha = 1 / AtrPeriod ; source = max(high - low, abs(high - close[1]), abs(low - close[1])); ATrV = alpha * source + (1 - alpha) * ATrV[1]; upperBand = src + factor * AtrV; lowerBand = src - factor * AtrV; prevLowerBand = lowerBand[1]; prevUpperBand = upperBand[1]; if lowerBand > prevLowerBand or close[1] < prevLowerBand Then lowerBand = lowerBand; Else lowerBand = prevLowerBand; if upperBand < prevUpperBand or close[1] > prevUpperBand Then upperBand = upperBand; Else upperBand = prevUpperBand; if C > UpperBand Then direction = 1; if C < LowerBand Then direction = -1; if direction == 1 Then supertrend = lowerband; Else supertrend = upperband; } if C > superTrend Then { Plot1(superTrend,"UpTrend", GREEN, 0, 1); NoPlot(2); } Else { Plot2(superTrend,"DnTrend", RED, 0, 1); NoPlot(1); } if direction == 1 and direction[1] == -1 Then plot3(superTrend,"BuyStart",green,0,8); if direction == -1 and direction[1] == 1 Then plot4(superTrend,"SellStart",RED,0,8);
종목검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2024-09-23 15:01:40

안녕하세요 예스스탁입니다. input : factor(3), AtrPeriod(10); var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0); var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0); if CurrentBar > 1 Then { src = (H+L)/2; // ATR계산(ATR 계산시 지수가중이동평균(rma)이용) alpha = 1 / AtrPeriod ; source = max(high - low, abs(high - close[1]), abs(low - close[1])); ATrV = alpha * source + (1 - alpha) * ATrV[1]; upperBand = src + factor * AtrV; lowerBand = src - factor * AtrV; prevLowerBand = lowerBand[1]; prevUpperBand = upperBand[1]; if lowerBand > prevLowerBand or close[1] < prevLowerBand Then lowerBand = lowerBand; Else lowerBand = prevLowerBand; if upperBand < prevUpperBand or close[1] > prevUpperBand Then upperBand = upperBand; Else upperBand = prevUpperBand; if C > UpperBand Then direction = 1; if C < LowerBand Then direction = -1; if direction == 1 Then supertrend = lowerband; Else supertrend = upperband; } if CrossUp(C,supertrend) Then Find(1); 즐거운 하루되세요 > 행복만땅 님이 쓴 글입니다. > 제목 : 검색식 부탁합니다 > 색상이 변하는 지점(적석에서 녹색으로 바뀌는 변곡점)에서 종목검색식 부탁드립니다. input : factor(3), AtrPeriod(10); var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0); var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0); if CurrentBar > 1 Then { src = (H+L)/2; // ATR계산(ATR 계산시 지수가중이동평균(rma)이용) alpha = 1 / AtrPeriod ; source = max(high - low, abs(high - close[1]), abs(low - close[1])); ATrV = alpha * source + (1 - alpha) * ATrV[1]; upperBand = src + factor * AtrV; lowerBand = src - factor * AtrV; prevLowerBand = lowerBand[1]; prevUpperBand = upperBand[1]; if lowerBand > prevLowerBand or close[1] < prevLowerBand Then lowerBand = lowerBand; Else lowerBand = prevLowerBand; if upperBand < prevUpperBand or close[1] > prevUpperBand Then upperBand = upperBand; Else upperBand = prevUpperBand; if C > UpperBand Then direction = 1; if C < LowerBand Then direction = -1; if direction == 1 Then supertrend = lowerband; Else supertrend = upperband; } if C > superTrend Then { Plot1(superTrend,"UpTrend", GREEN, 0, 1); NoPlot(2); } Else { Plot2(superTrend,"DnTrend", RED, 0, 1); NoPlot(1); } if direction == 1 and direction[1] == -1 Then plot3(superTrend,"BuyStart",green,0,8); if direction == -1 and direction[1] == 1 Then plot4(superTrend,"SellStart",RED,0,8);