예스스탁
예스스탁 답변
2025-09-12 13:20:31.0
안녕하세요
예스스탁입니다.
사용자함수명 : SuperTrend
반환값형 : 숫자형
input : AtrPeriod(Numeric),multiplier(Numeric);
var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0);
var : prevSuperTrend(0), ST(C), direction(0),alpha(0),source(0);
if CurrentBar > 1 Then
{
src = (H+L)/2;
alpha = 1 / AtrPeriod ;
ATRV = IFf(IsNan(ATRV[1]) == true, ma(TrueRange,AtrPeriod) , alpha * TrueRange + (1 - alpha) * IFf(isnan(ATRV[1])==true,0,ATRV[1]));
upperBand = src + multiplier * AtrV;
lowerBand = src - multiplier * AtrV;
if lowerBand > lowerBand[1] or close[1] < lowerBand[1] Then
lowerBand = lowerBand;
Else
lowerBand = lowerBand[1];
if upperBand < upperBand[1] or close[1] > upperBand[1] Then
upperBand = upperBand;
Else
upperBand = upperBand[1];
if C > UpperBand Then
direction = 1;
if C < LowerBand Then
direction = -1;
if direction == 1 Then
SuperTrend = lowerband;
Else
SuperTrend = upperband;
}
즐거운 하루되세요
> 시우아빠 님이 쓴 글입니다.
> 제목 : 슈퍼트렌드
> 사용자 함수로 가능한가요?