PureBytes Links
Trading Reference Links
|
Dimitris,
This is a neat bit of coding ... but how does one turn this into a
capaibility to run it over a range of dates i.e. coming up with a
different list for every day without having to manually move the
from/to dates ahead one day at a time ?
--- In amibroker@xxxxxxxxxxxxxxx, "Dimitris Tsokakis" <TSOKAKIS@xxxx>
wrote:
> 1. The VHTr transformation
> To Explore N100 for the last RSI, select the top5 and see their
performance to a trading system,
> run first in AA for all stocks, all quotations the
>
> // VHTr, Vertical to horizontal transformation, by D. Tsokakis, Apr
2003
> x=Status("stocknum");
> y=LastValue(RSI());z=LastValue(Cum(1))-x;
> Ry=AddToComposite(IIf(z==Cum(1),y,-1e10),"~RankY","C");
> Buy=0;
> Filter=1;
> AddColumn(Y,"INDICATOR",1.3);
> AddColumn(x,"STOCKNUM",1.0);
>
> An atificial ticker "~RankY" is just created. It is a bit peculiar,
it has values for the last 101 bars only.
> [My N100 database has 101 names, the 100 stocks plus the index ^NDX
itself]
> From left to right, each bar of the new array is equal to the
exploration result. The 1st is YHOO, the last is ^NDX,
> exactly inversed from the alphabetic sorting in my Symbol tree.
But, this ticker is a normal array and accepts any
> array treatment. For example, we may find the top5 values.
> Suppose, for the simplicity, that there are no equal values* and
paste in IB the
>
> H0=Foreign("~RankY","C");
> L1=LastValue(Cum(1));
> n=101;// the population of the database
> H1=LastValue(HHV(H0,n));
> BAR1=LastValue((ValueWhen(H0==H1,Cum(1))));
> H2=LastValue(HHV(IIf(H0<H1 ,H0,0),n));
> BAR2=LastValue((ValueWhen(H0==H2 ,Cum(1))));
> H3=LastValue(HHV(IIf(H0<H1 AND H0<H2,H0,0),n));
> BAR3=LastValue((ValueWhen(H0==H3 ,Cum(1))));
> H4=LastValue(HHV(IIf(H0<H1 AND H0<H2 AND H0<H3,H0,0),n));
> BAR4=LastValue((ValueWhen(H0==H4 ,Cum(1))));
> H5=LastValue(HHV(IIf(H0<H1 AND H0<H2 AND H0<H3 AND H0<H4,H0,0),n));
> BAR5=LastValue((ValueWhen(H0==H5 ,Cum(1))));
> COLOR=IIf(H0==H1 OR H0==H2 OR H0==H3 OR H0==H4 OR H0==H5,7,1);
> Plot(H0,"",COLOR,2);GraphXSpace=3;
> Title= "[ NUM1="+WriteVal(L1-BAR1,1.0)+",H1="+WriteVal(H1,1.2)+"]"+
> "[ NUM2="+WriteVal(L1-BAR2,1.0)+",H2="+WriteVal(H2,1.2)+"]"+
> "[ NUM3="+WriteVal(L1-BAR3,1.0)+",H3="+WriteVal(H3,1.2)+"]"+
> "[ NUM4="+WriteVal(L1-BAR4,1.0)+",H4="+WriteVal(H4,1.2)+"]"+
> "[ NUM5="+WriteVal(L1-BAR5,1.0)+",H5="+WriteVal(H5,1.2)+"]";
>
> The top5 values are paited yellow and, in the title, you read 5
pairs [STOCKNUM,RSI]
> The #14 [ BRCD ] is the champion with RSI=77.43 and the top5 is
> BRCD, ICOS, SPOT, PCAR, BRCM
> We read in IB title the results of the exploration [all stocks, n=1
last quotations] of VHTr.
> 2. The use of the VHTr transformation
> Explore now all stocks, n=1 last quotations with the
>
> X=Status("STOCKNUM");
> H0=Foreign("~RankY","C");L1=LastValue(Cum(1));
> n=101;
> H1=LastValue(HHV(H0,n));
> BAR1=LastValue((ValueWhen(H0==H1,Cum(1))));
> H2=LastValue(HHV(IIf(H0<H1 ,H0,0),n));
> BAR2=LastValue((ValueWhen(H0==H2 ,Cum(1))));
> H3=LastValue(HHV(IIf(H0<H1 AND H0<H2,H0,0),n));
> BAR3=LastValue((ValueWhen(H0==H3 ,Cum(1))));
> H4=LastValue(HHV(IIf(H0<H1 AND H0<H2 AND H0<H3,H0,0),n));
> BAR4=LastValue((ValueWhen(H0==H4 ,Cum(1))));
> H5=LastValue(HHV(IIf(H0<H1 AND H0<H2 AND H0<H3 AND H0<H4,H0,0),n));
> BAR5=LastValue((ValueWhen(H0==H5 ,Cum(1))));
> Cond=X==L1-bar1 OR X==L1-bar2 OR X==L1-bar3 OR X==L1-bar4 OR X==L1-
bar5;
> Buy=Cross(RSI(),35);Sell=Cross(RSI(),65);// THE TRADING SYSTEM
> e=LastValue(Equity());
> Filter=COND;
> AddColumn(X,"STOCKNUM",1.0);
> AddColumn(E,"EQUITY");
>
> You will see the final equity value for the top5 stocks.
> Dimitris Tsokakis
> *another set will be posted to treat the possibility of equal
values in the result list.
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/O10svD/Me7FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->
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 http://docs.yahoo.com/info/terms/
|