답변완료
질문 부탁드립니다
수고가 많으십니다 질문 몇 가지 부탁드립니다
질문1) 수식 해석 관련 질문 부탁합니다
동시에 조건을 만족할때 검색을 하는 식인데요
각 부분에서
else condition=false 를 설정할때와 안할때는 어떤 차이가 나나요?
감사합니다
if tl_getvalue(tl1,sdate,stime) >0 and
tl_getvalue(tl2,sdate,stime) >0 and
tl_getvalue(tl3,sdate,stime)>0 then
{
value1=tl_getvalue(tl1,sdate,stime);
value2=tl_getvalue(tl2,sdate,stime);
value3=tl_Getvalue(tl3,sdate,stime);
if crossup(c,value1) then
condition1= true;
else condition1=false;
if crossup(c,value2) then condition2=true;
else condition2 = false;
if crossup(c,value3) then condition3=true;
else condition3 = false;
if Condition1==true and condition2==true and condition3==true then find(1);
}
질문2)
for cnt= 80 downto 70
if index==cnt and h[cnt] > aa[1] then condition1=true;
이렇게 작성했을때
(if index==80 and h[80]>aa[1]) and (if index==79 and h[79]>aa[1]) ...
and (if index==70 and h[70]>aa[1] ) then condition1= true;
이렇게 되는게 맞나요??
count=0;
for cnt=80 downto 70
{
if index==cnt and h[cnt]>aa[1] then
count=count+1
}
if count==11 then condition1=true;
이거랑 같은 의미가 되는건지 궁금합니다
질문3)
논리형 변수를 생성할때 for 문으로 작성 가능한지 여쭤보고 싶습니다
예를 들어서 아래와 같은 진행되는 조건이 있을때 (id[] 배열에는 조건만족시 index 값을 넣었습니다)
for cnt= id[0] downto id[1]
if index==cnt and h[cnt] > aa[1] then condition1=true;
for cnt= id[1] downto id[2]
if index==cnt and h[cnt] > aa[2] then condition2=true;
...
for cnt= id[8] downto id[9]
if index==cnt and h[cnt] > aa[9] then condition9=true;
이런 수식을
for y=0 to 8
{
for cnt= id[y] downto id[y+1]
{
if index==cnt and h[cnt]>aa[y+1] then condition=true;
}
}
반복문으로 만들었는데요 condition 변수를 혹시
condition(y+1)=true;
이런식으로 만들어서 1부터 9번까지 반복 생성하게 하는 방법이 있을까요?
이런방식이 안된다면 가능한 방식으로 알려주시면 감사하겠습니다
2025-06-16
170
글번호 191728
지표
답변완료
TL 관련
TL의 갯수를 iTL에서 정한 갯수만큼 유지하려고 합니다.
문제는 TL_Delete를 실행시키면 예를 들면 iTL=2일때, TL1[2]가 지워져야 하므로
TL1, TL1[1], 이 2개가 보여야 하는데 첨부된 그림처럼 직전 TL1인 TL1[1], blue 가 아니고 TL1[3], darkRed 가 보이는 문제가 있습니다. (TL1=red, TL1[1]=blue, TL1[3]=darkRed로 표시함)
해결 방법을 알려주세요.
input: iTL(2),per1(5),per2(20),thk2(2);
var : val(0),bUp(0),bDn(0),idxUp(0),idxDn(0),gap(0),TL1(0),TL2(0);
val=C;
var1=ma(val,per1); var2=ma(val,per2);
Plot2(val);
plot1(var2,"ma2");
if crossup(var1,var2) then {
plot3(val,"Rev",red); bUp=val; idxUp=Index; gap=idxUp-idxUp[1];
if iTL>=1 Then {
TL1=TL_New_Self(sDate[gap],sTime[gap],bUp[1],sDate,sTime,bUp);
TL_SetColor(TL1,Red); TL_SetExtRight(TL1,true);
TL_SetSize(TL1,thk2);
TL_SetColor(TL1[1],DarkRed);
if IsNaN(TL1[iTL])==False Then TL_Delete(TL1[iTL]);
}
}
2025-06-15
197
글번호 191726
지표
답변완료
안녕하세요. 시스템트레이딩 코딩 부탁드립니다.
안녕하세요 담당자님 고생많으십니다.
input : lengthMA_MACD(34), lengthSignal(9);
var: src(0), hi(0), lo(0), mi(0);
var: ema1(0), ema2(0), ema_zlema(0);
var: md(0), sb(0), HISTO(0);
// 1) 기준값
src = (High + Low + Close) / 3;
// 2) ZLEMA 계산
ema1 = ema(src, lengthMA_MACD);
ema2 = ema(ema1, lengthMA_MACD);
ema_zlema = ema1 + (ema1 - ema2);
// 3) 고가/저가 평균 (Wilder SMMA)
hi = IFF(IsNaN(hi[1]),
Average(High, lengthMA_MACD),
(hi[1] * (lengthMA_MACD - 1) + High) / lengthMA_MACD);
lo = IFF(IsNaN(lo[1]),
Average(Low, lengthMA_MACD),
(lo[1] * (lengthMA_MACD - 1) + Low) / lengthMA_MACD);
mi = (hi + lo) / 2;
// 4) Kiwoom 스타일 MD 계산
md = IFF(ema_zlema > hi,
ema_zlema - hi,
IFF(ema_zlema < lo,
ema_zlema - lo,
0));
// 5) Signal & Histogram
sb = Average(md, lengthSignal);
HISTO = md - sb;
// 6) 시각화
Plot1(0, "ZeroLine", Gray);
Plot2(md, "PaulMACD", Red);
Plot3(sb, "Signal", Blue);
Plot4(HISTO, "Histogram", IFF(md > sb, Red, Blue));
이렇게 지표는 만드는데 성공을 해서 시각화 까지 잘 되었는데요
그 다음 시스템트레이딩으로 만드는데 어려움이 있어서요 ㅠ
------------------------------------------------------------------------------------
제가 원하는 조건은
입력 변수
MA MACD Length: 34
Signal Length: 9
진입 시 차이 임계치: 1.5
지표 계산 방식
src = (High + Low + Close) / 3
ZLEMA = EMA(src,34) + (EMA(src,34) - EMA(EMA(src,34),34))
고가·저가 SMMA(34)로 hi, lo 구한 뒤 mid = (hi+lo)/2
md = (ZLEMA-mid) 상·하단 밴드 외곽 돌파 시, 아니면 0
sb = SMA(md,9)
HISTO = md - sb
매매 로직
진입(Short):
md < sb(시그널선)로 하향 교차할 때
그리고 (md - sb) ≥ 1.5
청산(Cover):
md > sb로 상향 교차할 때
이렇게입니다. 감사합니다.
2025-06-14
263
글번호 191725
시스템