PureBytes Links
Trading Reference Links
|
Actually, it is largely based on Stephane C.'s formula, from december
2004:
for( i = 0; ( sym = StrExtract( list, i ) ) != "" ; i++ )
{
SetForeign(sym,True);
VarSet("MyInd"+i,RSI()); // Indicator: MAKE SURE YOU KEEP THIS
WITHIN "SETFOREIGN()" !!!!
/*
VarSet stores the Value of MFI
ticker 0 has its value of MFI stored in MyInd + 0
ticker 1 has its value of MFI stored in MyInf + 1 ...
*/
Rank =1;// Initialize the Rank
for (j = 0;( item = StrExtract( list, j ) ) != "" ; j++ )
{
SetForeign(item,True);
VarSet("ThisInd"+j,RSI()); // Indicator: MAKE SURE YOU KEEP THIS
WITHIN "SETFOREIGN()" !!!!
Rank=Rank + IIf( VarGet("MyInd"+i) < VarGet("ThisInd"+j),1,0);//
Lowest score gets higher rank (i.e. bottom of list for buy).
/*
VarGet returns the value of VarSet
Every value of MyInd + i is compared to every Value of ThisInd + j
and the Rank in incremented of + 1 every time the Ind is < to others.
*/
RestorePriceArrays();// to get out the influence of SetForeign
}
VarSet("Rank"+i,Rank);
//AddColumn(VarGet("Rank"+i),"Rank"+sym);
}
//The result is unique AND independent of the selected stock.
//Note here that the WL should be aligned, no missing/extra quotes.
Filter=1;//Status("lastbarinrange");
Count=Status("stocknum");
Var=IIf(InWatchList(ChoiceWL),VarGet("Rank"+ Count),Null);
Def=DefaultSetOptions(1000000,1,0,2*TopBottom);
Buy=Cover=C>0 AND Var>i-TopBottom;
Sell=Short=C>0 AND Var<=TopBottom;
PositionSize=-100/(2*TopBottom);
. . . . .
which in turn is based on a formula you provided earlier:
Hello,
a solution ( if I understand you) would be to rank Tickers in a
Watchlist on a monthly basis, and use this monthly rank on daily
signal.
Filtering your buy signal with
Buy= something and Rank<101 // top 100
example below with MFI
list = GetCategorySymbols( categoryWatchlist, 0 );
StockNb=0;
for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
SetForeign(sym);
VarSet("MyInd"+i,MFI(14));// Indicator
StockNb++;
RestorePriceArrays();
}
Rank=1;
for(i=0;i<stockNb;i++)
{
Rank=Rank + IIf(MFI(14)< VarGet("MyInd"+i),1,0);
}
TimeFrameRestore();
I've tried to
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
> VarSet/VarGet speed is approximately the same as using
variables 'normal' way,
> so it is definitely not slow (single VarSet() call takes 2
microseconds = 0.000002 sec, on Athlon XP running at 1.8GHz)
>
> Check your formula - it must be written in inefficient way.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "vlanschot" <ecbu@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, August 29, 2005 1:33 PM
> Subject: [amibroker] VarSet&-Get
>
>
> > Tomasz,
> >
> > Also, using VarSet/VarGet to rank stocks for Buy/Sells is very
slow on
> > a large number of stocks. Any improvement possible / suggestion?
> >
> > Thanks,
> >
> > PS
> >
> >
> >
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|