커뮤니티

수식문의

프로필 이미지
ksks
2026-07-15 23:35:55
77
글번호 232860
답변완료

input : AtrPeriod(14),factor(3);

var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0);

var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0);  

var : haClose(0),haOpen(0),haHigh(0),haLow(0);


#Heiken Ashi 시고저종

haClose = (O+H+L+C)/4;

haOpen = iff(index == 0,open,(haOpen [1] + haClose [1])/2) ;

haHigh = MaxList(High, haOpen, haClose) ;

haLow = MinList(Low, haOpen, haClose) ;


var1 = Ema(haClose,200);


if CurrentBar > 1 Then

{

      src = (haHigh+haLow)/2;


      alpha = 1 / AtrPeriod ;

      source = max(haHigh - haLow, abs(haHigh - haClose[1]), abs(haLow - haClose[1]));

      ATrV = alpha * source + (1 - alpha) * ATrV[1]; //지수가중이평방식

      //ATrV = ma(source,AtrPeriod); //단순이평방식

      upperBand = src + factor * AtrV;

      lowerBand = src - factor * AtrV;

      prevLowerBand = lowerBand[1];

      prevUpperBand = upperBand[1];

      

      if lowerBand > prevLowerBand or haClose[1] < prevLowerBand Then

          lowerBand = lowerBand;

      Else

          lowerBand = prevLowerBand;

      

      if upperBand < prevUpperBand or haClose[1] > prevUpperBand Then

          upperBand = upperBand;

      Else

          upperBand = prevUpperBand;

      

      if haClose > UpperBand Then

          direction = 1;

      if haClose < LowerBand Then

          direction = -1;

      

      if direction == 1 Then

          supertrend = lowerband;

      Else

          supertrend = upperband;

  

  Condition1 = CROSSUP(haClose,supertrend)and haClose<haClose[1]*1.10;


if Condition1[1] == true Then

Find(1);

}     


위 수식은 하이킨아시차트에서 슈퍼트렌드돌파를 검색하는 수식으로 작성해주신 것입니다만,

이용하다보니 아래사항을 넣어 개선하고 싶어 문의드립니다.(하이킨아시차트 기준)

. 1봉전 종가가 200지수이평돌파

. 20봉 ~ 1봉전 사이에 슈퍼트렌드 돌파

. 1봉전 종가는2봉전 대비 10%이하 상승

을 0봉에 검색하는 식으로 변환 요청드립니다.

종목검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-07-16 13:32:17

안녕하세요 예스스탁입니다. input : AtrPeriod(14),factor(3); var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0); var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0); var : haClose(0),haOpen(0),haHigh(0),haLow(0),HaEma(0); #Heiken Ashi 시고저종 haClose = (O+H+L+C)/4; haOpen = iff(index == 0,open,(haOpen [1] + haClose [1])/2) ; haHigh = MaxList(High, haOpen, haClose) ; haLow = MinList(Low, haOpen, haClose) ; HaEma = Ema(haClose,200); if CurrentBar > 1 Then { src = (haHigh+haLow)/2; alpha = 1 / AtrPeriod ; source = max(haHigh - haLow, abs(haHigh - haClose[1]), abs(haLow - haClose[1])); ATrV = alpha * source + (1 - alpha) * ATrV[1]; //지수가중이평방식 //ATrV = ma(source,AtrPeriod); //단순이평방식 upperBand = src + factor * AtrV; lowerBand = src - factor * AtrV; prevLowerBand = lowerBand[1]; prevUpperBand = upperBand[1]; if lowerBand > prevLowerBand or haClose[1] < prevLowerBand Then lowerBand = lowerBand; Else lowerBand = prevLowerBand; if upperBand < prevUpperBand or haClose[1] > prevUpperBand Then upperBand = upperBand; Else upperBand = prevUpperBand; if haClose > UpperBand Then direction = 1; if haClose < LowerBand Then direction = -1; if direction == 1 Then supertrend = lowerband; Else supertrend = upperband; if CROSSUP(haClose[1],HaEma[1]) and CountIf(CROSSUP(haClose,supertrend),20)[1] >= 1 and haClose[1] > haClose[2] and haClose[1] <= haClose[2]*1.10 Then Find(1); } 즐거운 하루되세요