예스스탁
예스스탁 답변
2022-04-12 11:02:16
> 목포댁 님이 쓴 글입니다.
> 제목 : CT를 YT로 변환
> 수고하십니다.
공부목적으로 대신 CT 수식을 예트로 처음 변환하여 보았습니다.
pdf 파일인지라 복사붙이기가 깨끗하게 안나오는군요
무엇이 잘못되었는지 ,
변환된 예트 시스템식이 CT식과는 진입/청산이 틀리게 작동을 합니다
var1, var2를 장단기지표로 보고, CT지표로 나온 그림과 비교하였는데,
차트 세팅을 잘못한것인지(수정주가 on|off 둘 다 해봄) 차이가 좀 많이 나네요??!!!
아마도 CT함수와 YT함수 매칭이 잘못된 것 같은데, 체크 부탁 드립니다.
수정하신 부분에 기존소스 주석처리와 함께 설명도 부탁드리겠습니다.
그리고, 매수|매도와 매수1|매도1의 차이가 무엇인지요?
시간이 되면 원격접속 부탁 드리겠습니다.
#======================================================#
# CT <수식 0-11> DD_CongestionBreak(방법1)
#======================================================#
Input: len(10), len1(70), len2(0.37), s1(2.7), method(1), delay(8)
If method=1 Then
Var1=atr(len)
Var2=atr(len1)
Elseif method=2 Then
Var20=high-low
Var1=mov(Var20,len,s)
Var2=mov(Var20,len1,s)
End If
Cond1=tdate=exitdate(1) And position(1)=1
Cond2=tdate=exitdate(1) And position(1)=-1
If Var1<var2 Then
Var10=1
Else
Var10=0
EndIf
If hhv(1,Var10,delay)=1 Then
If ttime<1500 Then
If Cond1=False And high<opend+(highd(1)-lowd(1))*len2 Then
Call buy("매수",Atstop,Def,opend+(highd(1)-lowd(1))*len2)
End If
IfCond2=False And low>opend-(highd(1)-lowd(1))*len2 Then
Call sell("매도",Atstop,Def,opend-(highd(1)-lowd(1))*len2)
End If
If Cond1=False And high>opend+(highd(1)-lowd(1))*len2 Then
Call buy("매수1",Atstop,Def,hhv(1,high,delay))
End If
If Cond2=False And low<opend-(highd(1)-lowd(1))*len2 Then
Callsell("매도1",Atstop,Def,llv(1,low,delay))
End If
End if
End If
If position<>0then
Call exitlong("매수청산",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*s1)
Call exitshort("매도청산",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*s1)
EndIf
#======================================================#
# YT <수식 0-11> DD_CongestionBreak(방법1)
#======================================================#
Input: len(10), len1(70), len2(0.37), s1(2.7), method(1), delay(8);
If method == 1 Then {
Var1=atr(len);
Var2=atr(len1) ;
}
Else if method == 2 Then {
Var20 = high - low;
Var1 = ma(Var20,len);
Var2 = ma(Var20,len1) ;
}
condition1 = date == exitdate(1) And MarketPosition(1)== 1 ;
condition2 = date == exitdate(1) And MarketPosition(1)== -1 ;
If Var1<var2 Then
Var10=1 ;
Else
Var10=0 ;
If NthHighest(1,Var10,delay)==1 Then {
If time<150000 Then {
If condition1==False And high < dayopen + (dayhigh(1)-daylow(1))*len2 Then
buy("매수",Atstop,dayopen + (dayhigh(1)-daylow(1))*len2);
If condition2==False And low>dayopen-(dayhigh(1)-daylow(1))*len2 Then
sell("매도",Atstop,dayopen-(dayhigh(1)-daylow(1))*len2);
If condition1==False And high > dayopen + (dayhigh(1)-daylow(1))*len2 Then
buy("매수1",Atstop,NthHighest(1,high,delay));
If condition2==False And low < dayopen - (dayhigh(1)-daylow(1))*len2 Then
sell("매도1",Atstop,NthLowest(1,low,delay));
}
}
If MarketPosition <> 0 then {
exitlong("매수청산",Atstop,NthHighest(1,high, BarsSinceEntry+1)-atr(20)*s1);
exitshort("매도청산",Atstop,NthLowest(1,low, BarsSinceEntry+1)+atr(20)*s1) ;
}