답변완료
잘 만들어 주신 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);
2025-08-05
143
글번호 193014
시스템
답변완료
수식작성 질문입니다
안녕하세요, 선생님.
매도 조건이 여러 가지일 경우, 아래와 같은 상황에서 00시 이후부터 매도 조건 평가를 시작하려고 합니다.
예를 들어,
8월 5일 03시에 매수 신호가 발생하였고,
익절 조건도, 손절 조건도 충족되지 않아 포지션을 유지한 채 8월 5일 23시 59분을 넘긴 경우,
8월 6일 00시 이후부터 새로운 매도 조건이 충족되면 즉시 청산되도록 만들고 싶습니다.
즉,익절/손절 조건이 없을 경우 → 자정(00시)을 넘기고 나서부터 매도 조건을 평가하는 로직이 필요합니다.
이와 같은 수식 구조를 어떻게 짜야 좋을지 문의드립니다.
감사합니다.
2025-08-05
120
글번호 193004
시스템
답변완료
부탁드립니다
Input : Period(14) ;
var : DMIv(0),DP(0),DM(0),cnt(-1);
DMIv = DMI(Period);
DP = DIPlus(Period);
DM = DIMinus(Period);
if CrossUp(dp,dm) && v[1]*1.2 <v Then
var1 = c ;
if CrossUp(c,var1) Then
Var2 = c;
if crossup(c,var2) Then
find( c> 1000 && v > 100000) ;
var1=c 라인을 돌파(var2=c) 이 라인을 다시돌파한 자리 검색. var2부터 작동불능.
검토부탁 드립니다.
2025-08-05
171
글번호 192970
종목검색