PureBytes Links
Trading Reference Links
|
The
systemBuy=Cross(StochD(),K);Sell=Cross(50,StochD());has 5 equity
lines for k=30, 35, 40, 45 and 50.[colorTan].An event occurred some time ago
[red cycle].We mark the equity values for that day [black horizontal lines]
for further use.The decision is to follow the leader for further trading
[blue dotted line]Is this decision always the best ?The title is
informative :You may see the partial gains per parameter, the Hi-pass K
value, the Hi-pass Equity and compare the relative %Gain.It is a first
attempt to investigate the excellent question of <A
href="">http://groups.yahoo.com/group/amibroker/message/49236
The distance up to the final project is
long.
// A Hi-pass
filterEVENT=DateNum()==1030617;PlotShapes(shapeCircle*EVENT,colorRed);G=0;CountER=0;Title=Name(); for(K=30;K<=50;K=K+5){Buy=Cross(StochD(),K);Sell=Cross(50,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);T11=ValueWhen(EVENT,Cum(1));G=IIf(G>E11,G,E11);CountER=CountER+1;Plot(E1,"\nE1["+WriteVal(K,1.0)+"]",colorTan,1);Plot(E11,"E11["+WriteVal(K,1.0)+"]",1,1);PG=100*(-1+E1/E11);Title=Title+"\n"+"Gain["+WriteVal(K,1.0)+"]="+WriteVal(PG,1.2)+"%";}Plot(G,"\nG",colorBlue,8);CountER=0;Kpass=0;HIPASS=0;for(K=30;K<50;K=K+5){Buy=Cross(StochD(),K);Sell=Cross(50,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);CountER=CountER+1;PASS=IIf(E11==G,E1,0);HIPASS=HIPASS+PASS;GAIN=100*(-1+HIPASS/G);K1=IIf(E11==G,K,0);Kpass=Kpass+K1;}Plot(HIPASS,"\nHI-PASS
[k="+WriteVal(kpass,1.0)+"]",colorBlue,8);Title=Title+"\n"+"Hi-pass
K="+WriteVal(kpass,1.0)+", Hi-pass E="+WriteVal(HIPASS)+",
Gain="+WriteVal(GAIN,1.2)+"%";
Note1 : The G-level, the HIGHPASS line
and the Kpass value are out of the loop and are available for futher
use.Comment all the inside plots, ie// A Hi-pass
filterEVENT=DateNum()==1030617;PlotShapes(shapeCircle*EVENT,colorRed);G=0;CountER=0; Title=Name(); for(K=30;K<=50;K=K+5){Buy=Cross(StochD(),K);Sell=Cross(50,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);T11=ValueWhen(EVENT,Cum(1));G=IIf(G>E11,G,E11);CountER=CountER+1;//Plot(E1,"\nE1["+WriteVal(K,1.0)+"]",colorTan,1);//Plot(E11,"E11["+WriteVal(K,1.0)+"]",1,1);PG=100*(-1+E1/E11); Title=Title+"\n"+"Gain["+WriteVal(K,1.0)+"]="+WriteVal(PG,1.2)+"%";}Plot(G,"\nG",colorBlue,8);CountER=0;Kpass=0;HIPASS=0;for(K=30;K<50;K=K+5){Buy=Cross(StochD(),K);Sell=Cross(50,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);CountER=CountER+1;PASS=IIf(E11==G,E1,0);HIPASS=HIPASS+PASS;GAIN=100*(-1+HIPASS/G);K1=IIf(E11==G,K,0);Kpass=Kpass+K1;}Plot(HIPASS,"\nHI-PASS
[k="+WriteVal(kpass,1.0)+"]",colorBlue,8); Title=Title+"\n"+"Hi-pass
K="+WriteVal(kpass,1.0)+", Hi-pass E="+WriteVal(HIPASS)+",
Gain="+WriteVal(GAIN,1.2)+"%";
to see the Hi-pass filter action. The only actual lines after
the red cycle are the G-level and the HI-PASS equity.
Note2 :If you comment all the
title statements, ie// A Hi-pass
filterEVENT=DateNum()==1030617;PlotShapes(shapeCircle*EVENT,colorRed);G=0;CountER=0;//
Title=Name(); for(K=30;K<=50;K=K+5){Buy=Cross(StochD(),K);Sell=Cross(50,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);T11=ValueWhen(EVENT,Cum(1));G=IIf(G>E11,G,E11);CountER=CountER+1;Plot(E1,"\nE1["+WriteVal(K,1.0)+"]",colorTan,1);Plot(E11,"E11["+WriteVal(K,1.0)+"]",1,1);PG=100*(-1+E1/E11);//
Title=Title+"\n"+"Gain["+WriteVal(K,1.0)+"]="+WriteVal(PG,1.2)+"%";}Plot(G,"\nG",colorBlue,8);CountER=0;Kpass=0;HIPASS=0;for(K=30;K<50;K=K+5){Buy=Cross(StochD(),K);Sell=Cross(50,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);CountER=CountER+1;PASS=IIf(E11==G,E1,0);HIPASS=HIPASS+PASS;GAIN=100*(-1+HIPASS/G);K1=IIf(E11==G,K,0);Kpass=Kpass+K1;}Plot(HIPASS,"\nHI-PASS
[k="+WriteVal(kpass,1.0)+"]",colorBlue,8);// Title=Title+"\n"+"Hi-pass
K="+WriteVal(kpass,1.0)+", Hi-pass E="+WriteVal(HIPASS)+",
Gain="+WriteVal(GAIN,1.2)+"%";
you may see more details for the partial
equities.
The credits go to Steve, we should discuss his question long
time ago...
Dimitris Tsokakis
Yahoo! Groups Sponsor
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:
hipass.gif
Attachment:
Description: "Description: GIF image"
|