커뮤니티

4개의 ct전략입니다. yt로 바꾸어 주세요

프로필 이미지
rlaxoeh
2012-04-02 15:21:49
351
글번호 49632
답변완료
안녕 하세요.. ct전략 바꾸어 주세요..^^ 1번 전략 Input: s1(2.1), len1(56), len2(2.7) If tdate<>Tdate(1) Then Var1=lrs(close,len1,1) Var2=Stdev(close,len1,s1,1) ' Var2=Stderr(close,len1,1)*S1 '표준오차 적용 Var10=1 Var3=var1*var10+opend End If If tdate=Tdate(1) Then Var10=var10+1 Var3=var1*var10+openD End If Var4=var3+var2 Var5=var3-var2 Cond1= tdate=exitdate(1) And position(1)=1 Cond2= tdate=exitdate(1) And position(1)=-1 If ttime<1500 Then If Cond1=False Then Call buy("매수",Atstop,Def,Var4) End If If Cond2=False Then Call sell("매도",Atstop,Def,Var5) End If End If If position<>0 Then Call exitlong("매수청산",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*len2) Call exitshort("매도청산",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*len2) End if 2번전략 Input: len1(200), ratio(0.382), s1(0.37), s2(2.7) Var1=hhv(1,high,len1)-llv(1,low,len1) Var2=var1*ratio Var3=hhv(1,high,len1)-var2 ' high retracement Var4=llv(1,low,len1)+var2 'low retracement Cond1= tdate=exitdate(1) And position(1)=1 Cond2= tdate=exitdate(1) And position(1)=-1 If tdate<>tdate(1) Then Var50=currententrynum End If If currententrynum-var50=0 Then If ttime<1500 Then Call buy("매수",Atstop,Def,opend+(highd(1)-lowd(1))*s1) Call sell("매도",Atstop,Def,opend-(highd(1)-lowd(1))*s1) If high<var3 And hhb(1,high,len1)<llb(1,low,len1) Then Call buy("매수1",Atstop,Def,Var3) End If If low>var4 And hhb(1,high,len1)>llb(1,low,len1) Then Call sell("매도1",Atstop,Def,Var4) End If End If End If If currententrynum-var50=1 Then If ttime<1500 Then If high<var3 And hhb(1,high,len1)<llb(1,low,len1) Then If Cond1=False Then Call buy("매수2",Atstop,Def,Var3) End If End If If low>var4 And hhb(1,high,len1)>llb(1,low,len1) then If Cond2=False Then Call sell("매도2",Atstop,Def,Var4) End If End If End If End If If position<>0 Then Call exitlong("매수청산",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*s2) Call exitshort("매도청산",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*s2) End If 3번 전략 Input: perl(0.009), perh(0.017), s1(0.37), s2(2.7) If high>=var31*(1+perL) And Var1(1)<>1 Then Var1=1 Var3=high End If If low<=var3*(1-perh) And Var1(1)<>-1 Then Var1=-1 Var31=low End If If low<var31 Then Var31=low End If If high>var3 Then Var3=high End If If tdate<>Tdate(1) Then Var50=currententrynum End If If currententrynum-var50=0 Then If ttime<1500 Then If Var1=-1 And high<var31*(1+perL) Then Call buy("매수",Atstop,Def, Var31*(1+perL)) Call sell("매도1",Atstop,Def,opend-(highd(1)-lowd(1))*S1) End If If Var1=1 And low>var3*(1-perh) Then Call sell("매도",Atstop,Def, Var3*(1-perh)) Call buy("매수1",Atstop,Def,opend+(highd(1)-lowd(1))*S1) End If End If End If If position<>0 Then Call exitlong("매수추적",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*S2) Call exitshort("매도추적",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*S2) End If 4번전략 Input: perl(4.9), perh(10), len1(100), s1(0.37), s2(2.7) Var20=high-low Var21=mov(Var20,len1,S) If high>=var31+var21*Perl And Var1(1)<>1 Then Var1=1 Var3=high End If If low<=var3-var21*Perh And Var1(1)<>-1 Then Var1=-1 Var31=low End If If low<var31 Then Var31=low End If If high>var3 Then Var3=high End If If tdate<>Tdate(1) Then Var50=currententrynum End If If currententrynum-var50=0 Then If ttime<1500 Then If Var1=-1 And high<var31+var21*Perl Then Call buy("매수",Atstop,Def, Var31+var21*Perl) Call sell("매도1",Atstop,Def,opend-(highd(1)-lowd(1))*S1) End If If Var1=1 And low>var3-var21*Perh Then Call sell("매도",Atstop,Def, Var3-var21*Perh) Call buy("매수1",Atstop,Def,opend+(highd(1)-lowd(1))*S1) End If End If End If If currententrynum-var50=1 Then If ttime<1500 Then If Var1=-1 And high<var31+var21*Perl Then Call buy("매수2",Atstop,Def, Var31+var21*Perl) End If If Var1=1 And low>var3-var21*Perh Then Call sell("매도2",Atstop,Def, Var3-var21*Perh) End If End If End If If position<>0 Then Call exitlong("매수추적",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*S2) Call exitshort("매도추적",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*S2) End If 부탁 드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2012-04-02 15:57:52

안녕하세요 예스스탁입니다. 1. Input: s1(2.1), len1(56), len2(2.7); var : cond1(false),cond2(false); if sdate <> sdate[1] then{ Var1=lrs(c,len1)[1]; Var2=Std(c,len1)[1]; Var10=1; Var3=var1*var10+opend(0); } If sdate==sdate[1] then{ Var10=var10+1; Var3=var1*var10+openD(0); } Var4=var3+var2; Var5=var3-var2; Cond1 = sdate==exitdate(1) And MarketPosition(1)==1; Cond2 = sdate==exitdate(1) And MarketPosition(1)==-1; If stime < 150000 then{ If Cond1==False then{ buy("매수",Atstop,Var4); } If Cond2==False then{ sell("매도",Atstop,Var5); } } If MarketPosition<>0 then{ exitlong("매수청산",Atstop,Highest(high,barssinceentry+1)-atr(20)*len2); exitshort("매도청산",Atstop,Lowest(low,BarsSinceEntry+1)+atr(20)*len2); } 2. Input: len1(200), ratio(0.382), s1(0.37), s2(2.7); var : cond1(false),cond2(false); Var1=highest(high,len1)-lowest(low,len1); Var2=var1*ratio; Var3=highest(high,len1)-var2;#' high retracement Var4=Lowest(low,len1)+var2; #'low retracement Cond1= sdate==exitdate(1) And MarketPosition(1)==1; Cond2= sdate==exitdate(1) And MarketPosition(1)==-1; If sdate<>sdate[1] then{ Var50=TotalTrades; } If TotalTrades-var50==0 then{ If stime<150000 then{ buy("매수",Atstop,opend(0)+(highd(1)-lowd(1))*s1); sell("매도",Atstop,opend(0)-(highd(1)-lowd(1))*s1); If high<var3 And NthHighestBar(1,high,len1)<NthLowestBar(1,low,len1) then{ buy("매수1",Atstop,Var3); } If low>var4 And NthHighestBar(1,high,len1) > NthLowestBar(1,low,len1) then{ sell("매도1",Atstop,Var4); } } } If TotalTrades-var50==1 then{ If stime<150000 then{ If high<var3 And NthHighestBar(1,high,len1)<NthLowestBar(1,low,len1) then{ If Cond1==False then{ buy("매수2",Atstop,Var3); } } If low>var4 And NthHighestBar(1,high,len1)>NthLowestBar(1,low,len1) then{ If Cond2==False then{ sell("매도2",Atstop,Var4); } } } } If MarketPosition<>0 then{ exitlong("매수청산",Atstop,highest(high,barssinceentry+1)-atr(20)*s2); exitshort("매도청산",Atstop,lowest(low,barssinceentry+1)+atr(20)*s2); } 3. Input: perl(0.009), perh(0.017), s1(0.37), s2(2.7); If high>=var31*(1+perL) And Var1[1]<>1 then{ Var1=1; Var3=high; } If low<=var3*(1-perh) And Var1[1]<>-1 then{ Var1=-1; Var31=low; } If low<var31 then{ Var31=low; } If high>var3 then{ Var3=high; } If sdate<>sdate[1] then{ Var50=TotalTrades; } If TotalTrades-var50==0 then{ If stime<150000 then{ If Var1==-1 And high<var31*(1+perL) then{ buy("매수",Atstop,Var31*(1+perL)); sell("매도1",Atstop,opend-(highd(1)-lowd(1))*S1); } If Var1==1 And low>var3*(1-perh) then{ sell("매도",Atstop,Def, Var3*(1-perh)); buy("매수1",Atstop,opend+(highd(1)-lowd(1))*S1); } } } If MarketPosition<>0 then{ exitlong("매수추적",Atstop,Highest(high,barssinceentry+1)-atr(20)*S2); exitshort("매도추적",Atstop,Lowest(low,BarsSinceEntry+1)+atr(20)*S2); } 4. Input: perl(4.9), perh(10), len1(100), s1(0.37), s2(2.7); Var20=high-low; Var21=ma(Var20,len1); If high>=var31+var21*Perl And Var1[1]<>1 then{ Var1=1; Var3=high; } If low<=var3-var21*Perh And Var1[1]<>-1 then{ Var1=-1; Var31=low; } If low<var31 then{ Var31=low; } If high>var3 then{ Var3=high; } If sdate<>sdate[1] then{ Var50=totaltrades; } If totaltrades-var50==0 then{ If stime<150000 then{ If Var1==-1 And high<var31+var21*Perl then{ buy("매수",Atstop,Var31+var21*Perl); sell("매도1",Atstop,opend(0)-(highd(1)-lowd(1))*S1); } If Var1==1 And low>var3-var21*Perh then{ sell("매도",Atstop,Var3-var21*Perh); buy("매수1",Atstop,opend(0)+(highd(1)-lowd(1))*S1); } } } If totaltrades-var50==1 then{ If stime<150000 then{ If Var1==-1 And high<var31+var21*Perl then{ buy("매수2",Atstop,Var31+var21*Perl); } If Var1==1 And low>var3-var21*Perh then{ sell("매도2",Atstop,Var3-var21*Perh); } } } If MarketPosition<>0 then{ exitlong("매수추적",Atstop,highest(high,barssinceentry+1)-atr(20)*S2); exitshort("매도추적",Atstop,Lowest(low,BarsSinceEntry+1)+atr(20)*S2); } 즐거운 하루되세요 > rlaxoeh 님이 쓴 글입니다. > 제목 : 4개의 ct전략입니다. yt로 바꾸어 주세요 > 안녕 하세요.. ct전략 바꾸어 주세요..^^ 1번 전략 Input: s1(2.1), len1(56), len2(2.7) If tdate<>Tdate(1) Then Var1=lrs(close,len1,1) Var2=Stdev(close,len1,s1,1) ' Var2=Stderr(close,len1,1)*S1 '표준오차 적용 Var10=1 Var3=var1*var10+opend End If If tdate=Tdate(1) Then Var10=var10+1 Var3=var1*var10+openD End If Var4=var3+var2 Var5=var3-var2 Cond1= tdate=exitdate(1) And position(1)=1 Cond2= tdate=exitdate(1) And position(1)=-1 If ttime<1500 Then If Cond1=False Then Call buy("매수",Atstop,Def,Var4) End If If Cond2=False Then Call sell("매도",Atstop,Def,Var5) End If End If If position<>0 Then Call exitlong("매수청산",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*len2) Call exitshort("매도청산",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*len2) End if 2번전략 Input: len1(200), ratio(0.382), s1(0.37), s2(2.7) Var1=hhv(1,high,len1)-llv(1,low,len1) Var2=var1*ratio Var3=hhv(1,high,len1)-var2 ' high retracement Var4=llv(1,low,len1)+var2 'low retracement Cond1= tdate=exitdate(1) And position(1)=1 Cond2= tdate=exitdate(1) And position(1)=-1 If tdate<>tdate(1) Then Var50=currententrynum End If If currententrynum-var50=0 Then If ttime<1500 Then Call buy("매수",Atstop,Def,opend+(highd(1)-lowd(1))*s1) Call sell("매도",Atstop,Def,opend-(highd(1)-lowd(1))*s1) If high<var3 And hhb(1,high,len1)<llb(1,low,len1) Then Call buy("매수1",Atstop,Def,Var3) End If If low>var4 And hhb(1,high,len1)>llb(1,low,len1) Then Call sell("매도1",Atstop,Def,Var4) End If End If End If If currententrynum-var50=1 Then If ttime<1500 Then If high<var3 And hhb(1,high,len1)<llb(1,low,len1) Then If Cond1=False Then Call buy("매수2",Atstop,Def,Var3) End If End If If low>var4 And hhb(1,high,len1)>llb(1,low,len1) then If Cond2=False Then Call sell("매도2",Atstop,Def,Var4) End If End If End If End If If position<>0 Then Call exitlong("매수청산",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*s2) Call exitshort("매도청산",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*s2) End If 3번 전략 Input: perl(0.009), perh(0.017), s1(0.37), s2(2.7) If high>=var31*(1+perL) And Var1(1)<>1 Then Var1=1 Var3=high End If If low<=var3*(1-perh) And Var1(1)<>-1 Then Var1=-1 Var31=low End If If low<var31 Then Var31=low End If If high>var3 Then Var3=high End If If tdate<>Tdate(1) Then Var50=currententrynum End If If currententrynum-var50=0 Then If ttime<1500 Then If Var1=-1 And high<var31*(1+perL) Then Call buy("매수",Atstop,Def, Var31*(1+perL)) Call sell("매도1",Atstop,Def,opend-(highd(1)-lowd(1))*S1) End If If Var1=1 And low>var3*(1-perh) Then Call sell("매도",Atstop,Def, Var3*(1-perh)) Call buy("매수1",Atstop,Def,opend+(highd(1)-lowd(1))*S1) End If End If End If If position<>0 Then Call exitlong("매수추적",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*S2) Call exitshort("매도추적",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*S2) End If 4번전략 Input: perl(4.9), perh(10), len1(100), s1(0.37), s2(2.7) Var20=high-low Var21=mov(Var20,len1,S) If high>=var31+var21*Perl And Var1(1)<>1 Then Var1=1 Var3=high End If If low<=var3-var21*Perh And Var1(1)<>-1 Then Var1=-1 Var31=low End If If low<var31 Then Var31=low End If If high>var3 Then Var3=high End If If tdate<>Tdate(1) Then Var50=currententrynum End If If currententrynum-var50=0 Then If ttime<1500 Then If Var1=-1 And high<var31+var21*Perl Then Call buy("매수",Atstop,Def, Var31+var21*Perl) Call sell("매도1",Atstop,Def,opend-(highd(1)-lowd(1))*S1) End If If Var1=1 And low>var3-var21*Perh Then Call sell("매도",Atstop,Def, Var3-var21*Perh) Call buy("매수1",Atstop,Def,opend+(highd(1)-lowd(1))*S1) End If End If End If If currententrynum-var50=1 Then If ttime<1500 Then If Var1=-1 And high<var31+var21*Perl Then Call buy("매수2",Atstop,Def, Var31+var21*Perl) End If If Var1=1 And low>var3-var21*Perh Then Call sell("매도2",Atstop,Def, Var3-var21*Perh) End If End If End If If position<>0 Then Call exitlong("매수추적",Atstop,hhv(1,high,barnumsinceentry+1)-atr(20)*S2) Call exitshort("매도추적",Atstop,llv(1,low,barnumsinceentry+1)+atr(20)*S2) End If 부탁 드립니다.