답변완료
문의 드립니다.
안녕하세요
현재 종가가 아래의 2 조건을 돌파 또는 우상향 하는 종목 검색식 부탁 드립니다.
1. A라인 ;
S = sar(af,maxAf);
조건 = CrossUp(C, S);
시작가 = Valuewhen(1, 조건, O);
bs = BarsSince(조건);
라인2 = if(조건, 시작가, 시작가 + 시작가 * (비율2 / 100) * bs);
if(S < C && S < 라인2, 라인2, S)
지표조건
af 0.01
maxAf 0.2
비율2 1
2. B라인 ;
A=avg(c,17);
ATR=avg(max(max(h-L,abs(c(1)-h)),abs(c(1)-L)),17);
B=ATR*2;
D=A+B;
E=Bbandsup(17,2);
e1=crossup(E,D);
e2=crossdown(E,D);
e3=crossdown(c,E);
valuewhen(1,e1 or e2 or e3,o)
감사합니다.
2025-06-15
240
글번호 191733
검색
답변완료
수식 문의 드립니다
항상 감사 드리니다.
아래 수식작성 요청식이 즉시 매수나 즉시매도식이 불가능할 시에는 봉 완성후 매입 매도 하는식으로 부탁 드립니다.
1. 일반식
1). Input : Period(5) ;
var : DMIv(0),DP(0),DM(0);
DMIv = DMI(Period);
DP = DIPlus(Period);
DM = DIMinus(Period);
2). volumn ratio(10)
1) 매수: DMIv가 20 이상 이고 volume ratio가 90 상향시 에서 즉시 매수
2) 매수: volume ratio가 90 이상 이고 DMIv가 20 상향시 즉시 매수
2) 매도: Volume ratio가 90 이하로 하락시 즉시매도
3) 매도: DMIv가 20 이하로 하락시 즉시 매도
2 data2를 이용항식
1). Input : Period(5) ;
var : DMIv(0),DP(0),DM(0);
DMIv = DMI(Period);
DP = DIPlus(Period);
DM = DIMinus(Period);
2). volumn ratio(10)
1) 매수: data2(DMIv)가 20 이상이고 DMIv가 20 이상 이고 volume ratio가 90 상향시 에서 즉시 매수
2) 매수: data2(Volume Ratio)가 20 이상이고, volume ratio가 90 이상 이고 DMIv가 20 상향시 즉시 매수
2) 매도: Volume ratio가 90 이하로 하락시 즉시매도
3) 매도: DMIv가 20 이하로 하락시 즉시 매도
2025-06-15
231
글번호 191732
시스템
답변완료
전환부탁드립니다.
수식전환부탁드립니다
수식1
m1=ma(C,이평기간);
m2=Highest(M1,봉수);
m3=Lowest(M1,봉수);
EU=M1;
EC=(M2+M3)/2;
ED=M3;
EH=EC(2)<=EC(1) &&EC(1)>EC;
EL=EC(2)>=EC(1) &&EC(1)<EC;
EU;
Valuewhen(1,M2>M2(1),M2);
이평기간 20/ 봉수 20
수식2
a=bbandsup(period1,d1);
b=bbandsup(period2,d2);
(a+b)/2;
period1/20 d1/2 period2/30 d2/2
수식3
m1=ma(C,이평기간);
m2=Highest(M1,봉수);
m3=Lowest(M1,봉수);
EU=M1;
EC=(M2+M3)/2;
ED=M3;
EH=EC(2)<=EC(1) &&EC(1)>EC;
EL=EC(2)>=EC(1) &&EC(1)<EC;
ED;
이평기간 20/ 봉수 20
수식4
(highest(high,period1)+lowest(low,period1))/2;
period1/20
2025-06-15
224
글번호 191731
지표
답변완료
질문 부탁드립니다
수고가 많으십니다 질문 몇 가지 부탁드립니다
질문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
188
글번호 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
212
글번호 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
308
글번호 191725
시스템