예스스탁
예스스탁 답변
2025-08-06 09:48:46
안녕하세요
예스스탁입니다.
해당식이 전략실행차트에는 수정없이 적용이 됩니다.
시뮬레이션 차트의 경우 시스템은 변수최적화 기능이 있어
모두 숫자형이어야 합니다.
retest_sig, candle_color 변수를 숫자형으로 변경해 드립니다.
0: true, 1: false 입니다.
input : short_len(50);
input : long_len(150);
input : retest_sig(1);//0: true, 1: false
input : candle_color(0); //0: true, 1: false
input : upper_col(Green);
input : lower_col(Maroon);
var : alpha(0),AR(0),A(0);
var : R(0.01),Q(0.1);
var : short_estimate(Nan),short_error_est(1.0),short_error_meas(R * (short_len));
var : short_kalman_gain(0),short_prediction(Nan),short_kalman(0);
var : Long_estimate(Nan),Long_error_est(1.0),Long_error_meas(R * (Long_len));
var : Long_kalman_gain(0),Long_prediction(Nan),Long_kalman(0);
var : trend_up(False);
var : trend_col(0),trend_col1(0),candle_col(0);
var : tx1(0),tx2(0),box1(0),box2(0);
alpha = 1 / 200 ;
A = iff(IsNan(A[1]) == true , ma(TrueRange, 200) , alpha * TrueRange + (1 - alpha) * iff(IsNan(A[1]) == true,0,A[1]));
AR = A*0.5;
if isnan(short_estimate) == true Then
short_estimate = C[1];
short_prediction = short_estimate;
short_kalman_gain = short_error_est / (short_error_est + short_error_meas);
short_estimate = short_prediction + short_kalman_gain * (C - short_prediction);
short_error_est = (1 - short_kalman_gain) * short_error_est + Q / (short_len);
short_kalman = short_estimate;
if isnan(Long_estimate) == true Then
Long_estimate = C[1];
Long_prediction = Long_estimate;
Long_kalman_gain = Long_error_est / (Long_error_est + Long_error_meas);
Long_estimate = Long_prediction + Long_kalman_gain * (C - Long_prediction);
Long_error_est = (1 - Long_kalman_gain) * Long_error_est + Q / (Long_len);
Long_kalman = Long_estimate;
trend_up = short_kalman > long_kalman;
trend_col = iff(trend_up , upper_col , lower_col);
trend_col1 = iff(short_kalman > short_kalman[2] , upper_col , lower_col);
if (short_kalman > short_kalman[2]) Then
{
Buy();
}
if (short_kalman < short_kalman[2]) Then
{
Sell();
}
candle_col = iff(candle_color == 0 ,
IFf(trend_up == true and short_kalman > short_kalman[2] , upper_col ,
iff(trend_up == False and short_kalman < short_kalman[2] , lower_col , gray)) , Black);
if Crossup(short_kalman,long_kalman) Then
{
Buy();
}
Else
Box_SetEnd(box1,sDate,stime,var2);
if CrossDown(short_kalman,long_kalman) Then
{
Sell();
}
Else
Box_SetEnd(box2,sDate,stime,var4);
즐거운 하루되세요
> jhs0713 님이 쓴 글입니다.
> 제목 : 잘 만들어 주신 Kalman지표를 시스템으로 변환하는 과정에서 오류
> 검증 과정은 잘 거쳤는데, 적용하는 과정에서 오류가 발생합니다.
"논리값이나 논리표현식이 와야 합니다"
저가 변경한 식은 다음과 같습니다.
input : short_len(50);
input : long_len(150);
input : retest_sig(false);
input : candle_color(true);
input : upper_col(Green);
input : lower_col(Maroon);
var : alpha(0),AR(0),A(0);
var : R(0.01),Q(0.1);
var : short_estimate(Nan),short_error_est(1.0),short_error_meas(R * (short_len));
var : short_kalman_gain(0),short_prediction(Nan),short_kalman(0);
var : Long_estimate(Nan),Long_error_est(1.0),Long_error_meas(R * (Long_len));
var : Long_kalman_gain(0),Long_prediction(Nan),Long_kalman(0);
var : trend_up(False);
var : trend_col(0),trend_col1(0),candle_col(0);
var : tx1(0),tx2(0),box1(0),box2(0);
alpha = 1 / 200 ;
A = iff(IsNan(A[1]) == true , ma(TrueRange, 200) , alpha * TrueRange + (1 - alpha) * iff(IsNan(A[1]) == true,0,A[1]));
AR = A*0.5;
if isnan(short_estimate) == true Then
short_estimate = C[1];
short_prediction = short_estimate;
short_kalman_gain = short_error_est / (short_error_est + short_error_meas);
short_estimate = short_prediction + short_kalman_gain * (C - short_prediction);
short_error_est = (1 - short_kalman_gain) * short_error_est + Q / (short_len);
short_kalman = short_estimate;
if isnan(Long_estimate) == true Then
Long_estimate = C[1];
Long_prediction = Long_estimate;
Long_kalman_gain = Long_error_est / (Long_error_est + Long_error_meas);
Long_estimate = Long_prediction + Long_kalman_gain * (C - Long_prediction);
Long_error_est = (1 - Long_kalman_gain) * Long_error_est + Q / (Long_len);
Long_kalman = Long_estimate;
trend_up = short_kalman > long_kalman;
trend_col = iff(trend_up , upper_col , lower_col);
trend_col1 = iff(short_kalman > short_kalman[2] , upper_col , lower_col);
if (short_kalman > short_kalman[2]) Then
{
Buy();
}
if (short_kalman < short_kalman[2]) Then
{
Sell();
}
candle_col = iff(candle_color ,
IFf(trend_up == true and short_kalman > short_kalman[2] , upper_col ,
iff(trend_up == False and short_kalman < short_kalman[2] , lower_col , gray)) , Black);
if Crossup(short_kalman,long_kalman) Then
{
Buy();
}
Else
Box_SetEnd(box1,sDate,stime,var2);
if CrossDown(short_kalman,long_kalman) Then
{
Sell();
}
Else
Box_SetEnd(box2,sDate,stime,var4);
jhs0713
2025-08-06 10:10:00
감사합니다~~
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 잘 만들어 주신 Kalman지표를 시스템으로 변환하는 과정에서 오류
>
안녕하세요
예스스탁입니다.
해당식이 전략실행차트에는 수정없이 적용이 됩니다.
시뮬레이션 차트의 경우 시스템은 변수최적화 기능이 있어
모두 숫자형이어야 합니다.
retest_sig, candle_color 변수를 숫자형으로 변경해 드립니다.
0: true, 1: false 입니다.
input : short_len(50);
input : long_len(150);
input : retest_sig(1);//0: true, 1: false
input : candle_color(0); //0: true, 1: false
input : upper_col(Green);
input : lower_col(Maroon);
var : alpha(0),AR(0),A(0);
var : R(0.01),Q(0.1);
var : short_estimate(Nan),short_error_est(1.0),short_error_meas(R * (short_len));
var : short_kalman_gain(0),short_prediction(Nan),short_kalman(0);
var : Long_estimate(Nan),Long_error_est(1.0),Long_error_meas(R * (Long_len));
var : Long_kalman_gain(0),Long_prediction(Nan),Long_kalman(0);
var : trend_up(False);
var : trend_col(0),trend_col1(0),candle_col(0);
var : tx1(0),tx2(0),box1(0),box2(0);
alpha = 1 / 200 ;
A = iff(IsNan(A[1]) == true , ma(TrueRange, 200) , alpha * TrueRange + (1 - alpha) * iff(IsNan(A[1]) == true,0,A[1]));
AR = A*0.5;
if isnan(short_estimate) == true Then
short_estimate = C[1];
short_prediction = short_estimate;
short_kalman_gain = short_error_est / (short_error_est + short_error_meas);
short_estimate = short_prediction + short_kalman_gain * (C - short_prediction);
short_error_est = (1 - short_kalman_gain) * short_error_est + Q / (short_len);
short_kalman = short_estimate;
if isnan(Long_estimate) == true Then
Long_estimate = C[1];
Long_prediction = Long_estimate;
Long_kalman_gain = Long_error_est / (Long_error_est + Long_error_meas);
Long_estimate = Long_prediction + Long_kalman_gain * (C - Long_prediction);
Long_error_est = (1 - Long_kalman_gain) * Long_error_est + Q / (Long_len);
Long_kalman = Long_estimate;
trend_up = short_kalman > long_kalman;
trend_col = iff(trend_up , upper_col , lower_col);
trend_col1 = iff(short_kalman > short_kalman[2] , upper_col , lower_col);
if (short_kalman > short_kalman[2]) Then
{
Buy();
}
if (short_kalman < short_kalman[2]) Then
{
Sell();
}
candle_col = iff(candle_color == 0 ,
IFf(trend_up == true and short_kalman > short_kalman[2] , upper_col ,
iff(trend_up == False and short_kalman < short_kalman[2] , lower_col , gray)) , Black);
if Crossup(short_kalman,long_kalman) Then
{
Buy();
}
Else
Box_SetEnd(box1,sDate,stime,var2);
if CrossDown(short_kalman,long_kalman) Then
{
Sell();
}
Else
Box_SetEnd(box2,sDate,stime,var4);
즐거운 하루되세요
> jhs0713 님이 쓴 글입니다.
> 제목 : 잘 만들어 주신 Kalman지표를 시스템으로 변환하는 과정에서 오류
> 검증 과정은 잘 거쳤는데, 적용하는 과정에서 오류가 발생합니다.
"논리값이나 논리표현식이 와야 합니다"
저가 변경한 식은 다음과 같습니다.
input : short_len(50);
input : long_len(150);
input : retest_sig(false);
input : candle_color(true);
input : upper_col(Green);
input : lower_col(Maroon);
var : alpha(0),AR(0),A(0);
var : R(0.01),Q(0.1);
var : short_estimate(Nan),short_error_est(1.0),short_error_meas(R * (short_len));
var : short_kalman_gain(0),short_prediction(Nan),short_kalman(0);
var : Long_estimate(Nan),Long_error_est(1.0),Long_error_meas(R * (Long_len));
var : Long_kalman_gain(0),Long_prediction(Nan),Long_kalman(0);
var : trend_up(False);
var : trend_col(0),trend_col1(0),candle_col(0);
var : tx1(0),tx2(0),box1(0),box2(0);
alpha = 1 / 200 ;
A = iff(IsNan(A[1]) == true , ma(TrueRange, 200) , alpha * TrueRange + (1 - alpha) * iff(IsNan(A[1]) == true,0,A[1]));
AR = A*0.5;
if isnan(short_estimate) == true Then
short_estimate = C[1];
short_prediction = short_estimate;
short_kalman_gain = short_error_est / (short_error_est + short_error_meas);
short_estimate = short_prediction + short_kalman_gain * (C - short_prediction);
short_error_est = (1 - short_kalman_gain) * short_error_est + Q / (short_len);
short_kalman = short_estimate;
if isnan(Long_estimate) == true Then
Long_estimate = C[1];
Long_prediction = Long_estimate;
Long_kalman_gain = Long_error_est / (Long_error_est + Long_error_meas);
Long_estimate = Long_prediction + Long_kalman_gain * (C - Long_prediction);
Long_error_est = (1 - Long_kalman_gain) * Long_error_est + Q / (Long_len);
Long_kalman = Long_estimate;
trend_up = short_kalman > long_kalman;
trend_col = iff(trend_up , upper_col , lower_col);
trend_col1 = iff(short_kalman > short_kalman[2] , upper_col , lower_col);
if (short_kalman > short_kalman[2]) Then
{
Buy();
}
if (short_kalman < short_kalman[2]) Then
{
Sell();
}
candle_col = iff(candle_color ,
IFf(trend_up == true and short_kalman > short_kalman[2] , upper_col ,
iff(trend_up == False and short_kalman < short_kalman[2] , lower_col , gray)) , Black);
if Crossup(short_kalman,long_kalman) Then
{
Buy();
}
Else
Box_SetEnd(box1,sDate,stime,var2);
if CrossDown(short_kalman,long_kalman) Then
{
Sell();
}
Else
Box_SetEnd(box2,sDate,stime,var4);