예스스탁
예스스탁 답변
2025-04-11 12:55:34
안녕하세요
예스스탁입니다.
input : Periods(10);
input : Multiplier(3.0);
input : changeATR(true);
input : showsignals(true);
input : highlighting(true);
var : src(0),alpha(0),atr1(0),atr2(0),atrv(0);
var : up(0),up1(0),dn(0),dn1(0);
var : trend(0),tx(0);
src = (h+l)/2;
alpha = 1/Periods;
atr1 = iff(IsNan(atr1[1]) == true,ma(TrueRange, Periods), alpha * TrueRange + (1 - alpha) * iff(IsNan(atr1[1])==true,0,atr1[1]));
atr2 = ma(TrueRange, Periods);
atrv = iff(changeATR ==true,atr1, atr2);
up = src-(Multiplier*atrv);
up1 = iff(isnan(up[1])==true,up,up[1]);
up = iff(close[1] > up1 , max(up,up1), up);
dn = src+(Multiplier*atrv);
dn1 = iff(isnan(dn[1])==true,dn,dn[1]);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = iff(isnan(trend[1])==true,trend,trend[1]);
trend = iff(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
plot1(up,"Trend",Yellow);
Else
plot1(dn,"Trend",Yellow);
if trend == 1 and trend[1] == -1 Then
{
tx = Text_New(sDate,sTime,up,"●");
Text_SetColor(tx,Green);
Text_SetStyle(tx,2,2);
}
if trend == -1 and trend[1] == 1 Then
{
tx = Text_New(sDate,sTime,dn,"●");
Text_SetColor(tx,Red);
Text_SetStyle(tx,2,2);
}
즐거운 하루되세요
> 해암 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 다음수식은 슈퍼트렌드 지표 수식인데
첨부된 그림처럼 선과선 사이에 점이아닌 선으로 위아래가 연결되게 하려면 수식을 어떻게
수정해야 하는지요?
======================
input : Periods(10);
input : Multiplier(3.0);
input : changeATR(true);
input : showsignals(true);
input : highlighting(true);
var : src(0),alpha(0),atr1(0),atr2(0),atrv(0);
var : up(0),up1(0),dn(0),dn1(0);
var : trend(0),tx(0);
src = (h+l)/2;
alpha = 1/Periods;
atr1 = iff(IsNan(atr1[1]) == true,ma(TrueRange, Periods), alpha * TrueRange + (1 - alpha) * iff(IsNan(atr1[1])==true,0,atr1[1]));
atr2 = ma(TrueRange, Periods);
atrv = iff(changeATR ==true,atr1, atr2);
up = src-(Multiplier*atrv);
up1 = iff(isnan(up[1])==true,up,up[1]);
up = iff(close[1] > up1 , max(up,up1), up);
dn = src+(Multiplier*atrv);
dn1 = iff(isnan(dn[1])==true,dn,dn[1]);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = iff(isnan(trend[1])==true,trend,trend[1]);
trend = iff(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
{
plot1(up,"Up Trend",Yellow);
NoPlot(2);
}
Else
{
NoPlot(1);
plot2(dn,"Down Trend",Yellow);
}
if trend == 1 and trend[1] == -1 Then
{
tx = Text_New(sDate,sTime,up,"●");
Text_SetColor(tx,Green);
Text_SetStyle(tx,2,2);
}
if trend == -1 and trend[1] == 1 Then
{
tx = Text_New(sDate,sTime,dn,"●");
Text_SetColor(tx,Red);
Text_SetStyle(tx,2,2);