PureBytes Links
Trading Reference Links
|
Dimitris: this is very exciting (and
a good teaching tool as are many of your messages).
Recalling my objective to control the
buying and selling of a new watchlist created between Inspection Points, may I
conclude that eventually this code can be placed into the AA window for a
backtest.
It appears that If I write new Watchlists WL40
to WL44, that then the code may continue and first trade against WL40 until a
new IP arrives, then trade against WL41 until the next IP arrives, etc. and all
the while continuing to create a composite equity line for all WL backtests
over the full range.
I hope this is the goal and I hope it is
possible. With your excellent information I will myself attempt to
achieve this, but the odds are low of my success, so I await yours.
Ken
-----Original Message-----
From: Dimitris Tsokakis
[mailto:TSOKAKIS@xxxxxxxxx]
Sent: Saturday, November 08, 2003
7:05 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Conditional
WatchLists per Inspection Point
The
START=DateNum()==1000530 ;
per=200;
EVENT=BarsSince(START)%per==0;Plot(event,"",2,2);
defines 5 Inspection Points from 30/5/2000 till now.
At each IP we shall create a WatchList with the top10 StochD stocks.
A date will be printed on the pane for each IP for the verification.
[My checks were fine]
I have a database of the N100 stocks+the index ^NDX in Group254 from
Jan3, 2000 till now.
The Group254 does not include any other stock or index.
In an empty Indicator Builder window paste the
<span
>// Conditional WatchList creation, by D. Tsokakis,
Nov2003
START=DateNum()==1000530 ;
per=200;
EVENT=BarsSince(START)%per==0;Plot(event,"",colorWhite,2);
u=LastValue(Cum(event));
No=254;
Title="The top10 StochD are";
for(q=u;q>0;q--)
{
list = GetCategorySymbols( categoryGroup, No );
R = 0;
Count1=0;
for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
SetForeign(sym);
f=StochD();
R[BarCount-1-i] = LastValue(ValueWhen(event,f,q));
Count1=Count1+1;
}
G=0;L1=LastValue(Cum(1));TOP=10;W="";
Counter=0;
for(K=1;K<=TOP;K++)
{
H1=LastValue(HHV(R,Count1));
BAR1=LastValue((ValueWhen(R==H1,Cum(1)-1)));
R[BAR1]=-100000;
Counter=Counter+1;
G[L1-CountER]=-H1;
w=w+StrExtract(List,L1-bar1-1)+WriteIf(k<top,",","");
}
Title=Title+"\nW"+WriteVal(u-q,1.0)+" : "+w;
}
Title=Title+"\n"+WriteIf(event,Date(),"");
To check the top10, explore for the specific EVENT dates with
x=StochD();
Filter=1;
AddColumn(x,"StochD");
as in the att. gif.
These WatchLists do not belong to the symbol tree, they are created for
in-code use.
The next step is to see what we can do with these W0 to W4.
Dimitris Tsokakis
<span
>PS:
We may send W0 to W4 to 5 empty WatchLists of the symbol tree, say
WL40, WL41, WL42, WL43, WL44
with the
START=DateNum()==1000530 ;
per=200;
EVENT=BarsSince(START)%per==0;Plot(event,"",colorWhite,2);
u=LastValue(Cum(event));
// Conditional WatchList creation
No=254;
Title="The top10 StochD are";
for(q=u;q>0;q--)
{
list = GetCategorySymbols( categoryGroup, No );
R = 0;
Count1=0;
for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
SetForeign(sym);
f=StochD();
R[BarCount-1-i] = LastValue(ValueWhen(event,f,q));
Count1=Count1+1;
}
G=0;L1=LastValue(Cum(1));TOP=10;W="";
Counter=0;//Title="Top10 StochD"+"\n";
for(K=1;K<=TOP;K++)
{
H1=LastValue(HHV(R,Count1));
BAR1=LastValue((ValueWhen(R==H1,Cum(1)-1)));
R[BAR1]=-100000;
Counter=Counter+1;
G[L1-CountER]=-H1;
w=w+StrExtract(List,L1-bar1-1)+WriteIf(k<top,",","");
}
Title=Title+"\nW"+WriteVal(u-q,1.0)+" : "+w;
for(K=0;K<TOP;K++)<font
color=red>
{
CategoryAddSymbol(StrExtract(W,K),categoryWatchlist,40+u-q);
}
}
Title=Title+"\n"+WriteIf(event,Date(),"");
Hit Apply and then View->RefreshAll
<span
>Note1<span
>. I tried a direct use of <font color=red
face="Times New Roman">CategoryAddSymbol(w,categoryWatchlist,40+u-q);
but it
does not work
Note2. Each
w is a string like
"LNCR,TLAB,FHCC,ESRX,PAYX,GNTX,SIAL,ADCT,XLNX,PDCO"
I
do not know if it is technically possible in CategoryAddSymbols() to use a
string like this instead of a single Name()
in
some future upgrade, I think it would be interesting...
<span
>Note3<span
>. I do not know, yet, how to remove ALL symbols from a
WL at once in Ind. Builder, where the "" [current stock] is
only
the selected stock
<span
>Note4<span
>. I do not know also how can I give the
"RefreshAll" order from the IB code.
<span
>Last [optimistic] note<font
size=2>. At least I know my name and it is not
bad at all !!
Dimitris Tsokakis
<font size=2
face="Courier New">Send BUG REPORTS to
bugs@xxxxxxxxxxxxx<span
>
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of
Yahoo! Groups is subject to the Yahoo!
Terms of Service.
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.
|