예스스탁
예스스탁 답변
2025-03-11 12:59:23
안녕하세요
예스스탁입니다.
input : length(7);
input : phase(50);
input : Pwr(2);
var : src(0),phaseRatio(0),beta(0),alpha(0);
var : e0(0),e1(0),e2(0),jma(0),jmaColor(0);
src = close;
phaseRatio = iff(phase < -100 , 0.5 , IFf( phase > 100 , 2.5 , phase / 100 + 1.5));
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2);
alpha = pow(beta, Pwr);
e0 = (1 - alpha) * src + alpha * IFf(IsNan(e0[1])==true,0,e0[1]);
e1 = (src - e0) * (1 - beta) + beta * IFf(IsNan(e1[1])==true,0,e1[1]);
e2 = (e0 + phaseRatio * e1 - IFF(IsNan(jma[1])==true,0,jma[1]))* pow(1 - alpha, 2) + pow(alpha, 2) * IFf(IsNan(jma[1])==true,0,jma[1]);
jma = e2 + IFf(IsNan(jma[1])==true,0,jma[1]);
jmaColor = IFF(jma > jma[1], green , red);
plot1(jma,"JMA",jmaColor);
즐거운 하루되세요
> 고도산 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> TradingView의 다음 소스를 예트로 아래와 같이 변환했는데 아무것도 안보이네요. 고쳐주시면 감사하겠습니다
//@version=3
// Jurik Research and Consulting. All rights reserved.
// Alex Orekhov (everget)
study("Jurik Moving Average", shorttitle="JMA", overlay=true)
length = input(title="Length", type=integer, defval=7)
phase = input(title="Phase", type=integer, defval=50)
power = input(title="Power", type=integer, defval=2)
src = input(title="Source", type=source, defval=close)
highlightMovements = input(title="Highlight Movements ?", type=bool, defval=true)
phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2)
alpha = pow(beta, power)
jma = 0.0
e0 = 0.0
e0 := (1 - alpha) * src + alpha * nz(e0[1])
e1 = 0.0
e1 := (src - e0) * (1 - beta) + beta * nz(e1[1])
e2 = 0.0
e2 := (e0 + phaseRatio * e1 - nz(jma[1])) * pow(1 - alpha, 2) + pow(alpha, 2) * nz(e2[1])
jma := e2 + nz(jma[1])
jmaColor = IFF(jma > jma[1], green : red);
plot(jma, title="JMA", linewidth=2, color=jmaColor, transp=0)
------------------------------------
input:length(7),phase(50),Pwr(2);
var: phaseRatio(0),alpha(0),beta(0),e0(0),e1(0),e2(0),jma(0),jmaColor(0),src(0);
src = C;
phaseRatio = IFF(phase< -100, 0.5,
IFF(phase>100, 2.5, phase / 100 + 1.5));
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2);
alpha = Pow(beta, Pwr);
e0 = (1 - alpha) * src + alpha * e0[1];
e1 = (src - e0) * (1 - beta) + beta * e1[1];
e2 = (e0 + phaseRatio * e1 - jma[1]) * Pow(1 - alpha, 2) + Pow(alpha, 2) * e2[1];
jma = e2 + jma[1];
jmaColor = IFF(jma>jma[1], Red, green);
Plot1(jma, "JMA",jmaColor);
결과가 이상하네요.
GRok.Ai에다 부탁했더니 다음과 같이 응답하네요. 결과가 잘 나왔어요.
------------------
input: length(7), phase(50), Pwr(2);
var: phaseRatio(0), alpha(0), beta(0), e0(0), e1(0), e2(0), jma(0), jmaColor(0), src(0);
var: prevE0(0), prevE1(0), prevE2(0), prevJMA(0), isFirstBar(1);
src = Close; // YesTrader에서 Close로 종가 참조 가정
phaseRatio = IFF(phase < -100, 0.5, IFF(phase > 100, 2.5, phase / 100 + 1.5));
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2);
alpha = Pow(beta, Pwr);
if (isFirstBar == 1) Then {
e0 = src;
e1 = 0;
e2 = src;
jma = src;
prevE0 = e0;
prevE1 = e1;
prevE2 = e2;
prevJMA = jma;
isFirstBar = 0;
} else {
e0 = (1 - alpha) * src + alpha * prevE0;
e1 = (src - e0) * (1 - beta) + beta * prevE1;
e2 = (e0 + phaseRatio * e1 - prevJMA) * Pow(1 - alpha, 2) + Pow(alpha, 2) * prevE2;
jma = e2 + prevJMA;
prevE0 = e0;
prevE1 = e1;
prevE2 = e2;
prevJMA = jma;
}
jmaColor = IFF(jma > prevJMA, 255, 65280); // Red = 255, Green = 65280
Plot1(jma, "JMA");
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 문의 드립니다
>
안녕하세요
예스스탁입니다.
input : length(7);
input : phase(50);
input : Pwr(2);
var : src(0),phaseRatio(0),beta(0),alpha(0);
var : e0(0),e1(0),e2(0),jma(0),jmaColor(0);
src = close;
phaseRatio = iff(phase < -100 , 0.5 , IFf( phase > 100 , 2.5 , phase / 100 + 1.5));
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2);
alpha = pow(beta, Pwr);
e0 = (1 - alpha) * src + alpha * IFf(IsNan(e0[1])==true,0,e0[1]);
e1 = (src - e0) * (1 - beta) + beta * IFf(IsNan(e1[1])==true,0,e1[1]);
e2 = (e0 + phaseRatio * e1 - IFF(IsNan(jma[1])==true,0,jma[1]))* pow(1 - alpha, 2) + pow(alpha, 2) * IFf(IsNan(jma[1])==true,0,jma[1]);
jma = e2 + IFf(IsNan(jma[1])==true,0,jma[1]);
jmaColor = IFF(jma > jma[1], green , red);
plot1(jma,"JMA",jmaColor);
즐거운 하루되세요
> 고도산 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> TradingView의 다음 소스를 예트로 아래와 같이 변환했는데 아무것도 안보이네요. 고쳐주시면 감사하겠습니다
//@version=3
// Jurik Research and Consulting. All rights reserved.
// Alex Orekhov (everget)
study("Jurik Moving Average", shorttitle="JMA", overlay=true)
length = input(title="Length", type=integer, defval=7)
phase = input(title="Phase", type=integer, defval=50)
power = input(title="Power", type=integer, defval=2)
src = input(title="Source", type=source, defval=close)
highlightMovements = input(title="Highlight Movements ?", type=bool, defval=true)
phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2)
alpha = pow(beta, power)
jma = 0.0
e0 = 0.0
e0 := (1 - alpha) * src + alpha * nz(e0[1])
e1 = 0.0
e1 := (src - e0) * (1 - beta) + beta * nz(e1[1])
e2 = 0.0
e2 := (e0 + phaseRatio * e1 - nz(jma[1])) * pow(1 - alpha, 2) + pow(alpha, 2) * nz(e2[1])
jma := e2 + nz(jma[1])
jmaColor = IFF(jma > jma[1], green : red);
plot(jma, title="JMA", linewidth=2, color=jmaColor, transp=0)
------------------------------------
input:length(7),phase(50),Pwr(2);
var: phaseRatio(0),alpha(0),beta(0),e0(0),e1(0),e2(0),jma(0),jmaColor(0),src(0);
src = C;
phaseRatio = IFF(phase< -100, 0.5,
IFF(phase>100, 2.5, phase / 100 + 1.5));
beta = 0.45 * (length - 1) / (0.45 * (length - 1) + 2);
alpha = Pow(beta, Pwr);
e0 = (1 - alpha) * src + alpha * e0[1];
e1 = (src - e0) * (1 - beta) + beta * e1[1];
e2 = (e0 + phaseRatio * e1 - jma[1]) * Pow(1 - alpha, 2) + Pow(alpha, 2) * e2[1];
jma = e2 + jma[1];
jmaColor = IFF(jma>jma[1], Red, green);
Plot1(jma, "JMA",jmaColor);