[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Inspection Points and trading systems



PureBytes Links

Trading Reference Links




from <A 
href="">http://groups.yahoo.com/group/amibroker/message/50739
"For more sophisticated techniques, the Inspection Points are 
already exposed in detail."
 
Michael,I have the time now to explain the 
above:
Inspection points may be used not only to select optimal 
parameters but also to pick up trading systems.Since you are familiar with 
the MeanRSIt variations, let us see a complete example:Create first the 
composites
 
/*MEAN RSIT ~10a TO 
~40a*/for(n=10;n<45;n=n+5){Var=MA(MACD(),n);R10SIt10=MA(RSIa(Var,30),10);AddToComposite(R10SIt10,"~"+WriteVal(n,1.0)+"a","V");Buy=0;}Scan 
for all N100 [recent] stocks [^NDX included], all quotations.[Enjoy the few 
lines code compared to <A 
href="">http://www.amibroker.com/library/detail.php?id=173, 
comment III ]Let us begin with the first 4 artificial tickers to optimize in 
AA 
from Jan3, 2000 
till*2/1/2001*7/8/2001*19/3/2002*21/10/2002*28/5/2003respectively, 
with// AA 
optimizationF10=Foreign("~10a","V");F20=Foreign("~15a","V");F30=Foreign("~20a","V");F40=Foreign("~25a","v");b=Foreign("~count","v");T10=F10/b;T20=F20/b;T30=F30/b;T40=F40/b;B1=Cross(T10,T20);B2=Cross(T10,T30);B3=Cross(T10,T40);B4=Cross(T20,T30);B5=Cross(T20,T40);B6=Cross(T30,T40);S1=Cross(T20,T10);S2=Cross(T30,T10);S3=Cross(T40,T10);S4=Cross(T30,T20);S5=Cross(T40,T20);S6=Cross(T40,T30);b=Optimize("b",1,1,6,1);s=Optimize("s",1,1,6,1);Buy=IIf(B==1,B1,IIf(B==2,B2,IIf(B==3,B3,IIf(B==4,B4,IIf(B==5,B5,B6)))));Sell=IIf(S==1,S1,IIf(S==2,S2,IIf(S==3,S3,IIf(S==4,S4,IIf(S==5,S5,S6)))));Short=Sell;Cover=Buy;<FONT 
size=2>
This procedure may be automatically executed in a single IB window 
with
  // Inspection Points for a 36 trading systems 
selectionSTART=DateNum()==1010102 
;per=Param("per",150,25,100,25);EVENT=BarsSince(START)%per==0;EXIT=Ref(EVENT,1);Plot(10000,"",Cum(1)%2,1);Plot(0,"",1,styleNoLine);Counter=Cum(EVENT)%10;shape=IIf(Counter==1,shapeDigit0,IIf(Counter==2 
,shapeDigit1,IIf(Counter==3 ,shapeDigit2,IIf(Counter==4 
,shapeDigit3,IIf(Counter==5 ,shapeDigit4,IIf(Counter==6 
,shapeDigit5,IIf(Counter==7 ,shapeDigit6,IIf(Counter==8 
,shapeDigit7,IIf(Counter==9 
,shapeDigit8,shapeDigit9)))))))));PlotShapes(shape*EVENT,colorIndigo);G=0;// 
the 36 
systemsF10=Foreign("~10a","V");F20=Foreign("~15a","V");F30=Foreign("~20a","V");F40=Foreign("~25a","v");b=Foreign("~count","v");T10=F10/b;T20=F20/b;T30=F30/b;T40=F40/b;B1=Cross(T10,T20);B2=Cross(T10,T30);B3=Cross(T10,T40);B4=Cross(T20,T30);B5=Cross(T20,T40);B6=Cross(T30,T40);S1=Cross(T20,T10);S2=Cross(T30,T10);S3=Cross(T40,T10);S4=Cross(T30,T20);S5=Cross(T40,T20);S6=Cross(T40,T30);SetForeign("^NDX",True,True);for(b=1;b<7;b++){for(s=1;s<7;s++){Buy=IIf(B==1,B1,IIf(B==2,B2,IIf(B==3,B3,IIf(B==4,B4,IIf(B==5,B5,B6)))));Sell=IIf(S==1,S1,IIf(S==2,S2,IIf(S==3,S3,IIf(S==4,S4,IIf(S==5,S5,S6)))));Short=Sell;Cover=Buy;E1=Equity(1,0);E11=ValueWhen(EVENT,E1);G=IIf(G>E11,G,E11);
 
// if(s==6) 
{Plot(e1,"\n["+WriteVal(b,1.0)+"]",b,1);}
 
<FONT 
size=2>}}GraphXSpace=1;fpass=0;bpass=0;spass=0;for(b=1;b<7;b++){for(s=1;s<7;s++){Buy=IIf(B==1,B1,IIf(B==2,B2,IIf(B==3,B3,IIf(B==4,B4,IIf(B==5,B5,B6)))));Sell=IIf(S==1,S1,IIf(S==2,S2,IIf(S==3,S3,IIf(S==4,S4,IIf(S==5,S5,S6)))));Short=Sell;Cover=Buy;E1=Equity(1,0);E11=ValueWhen(EVENT,E1);fpass=IIf(e11==g,e1,0)+fpass;bpass=IIf(e11==g,b,0)+bpass;spass=IIf(e11==g,s,0)+spass;G=IIf(E11==G,0,G);}}STEP=IIf(EVENT,fpass-Ref(fpass,-1),0);T=Cum(STEP);FINAL=(fpass-T);Plot(FINAL,WriteIf(event,"*","")+"[Buy 
Rule is B"+WriteVal(bpass,1.0)+", Sell rule is 
S"+WriteVal(spass,1.0)+"]",IIf(event,colorRed,colorBlack),8);
 
For the simlpicity of the example, the IP logic is applied to 
^NDX *Uncomment the// if(s==6) 
{Plot(e1,"\n["+WriteVal(b,1.0)+"]",b,1);}line to see 6 of the equity curves 
[B=1 to 6, S=6]The system was working with the [1,6]  from 2/1/2001 
till 21/10/2002 and then followed the [3,6] till now.At the next IP, [1,6] 
is a serious candidate to win the elections, the last month is on the top again 
!!
I hope you find this study  useful for 
further analysis.
Dimitris Tsokakis
____________________________________
*the procedure may be extended to pick up a favorite 
stock at each IP.







Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



Attachment:
systems1.gif

Attachment: Description: "Description: GIF image"