PureBytes Links
Trading Reference Links
|
Hello, I have always many interest in ranking and stocks selection.
I think you can add in watchlist 0 thousand stocks, and get for each
stock its monthly rank ( with full code below)
so you can Buy = conditions and (Monthly_rank < 101) ;
I have tested the code in AA with status (stocknum) and it works.
stephane
listNum=0 ;//enter watchlist number
list = GetCategorySymbols( categoryWatchlist, listnum );
TimeFrameSet( inMonthly );
for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
SetForeign(sym);
VarSet("MyInd"+i,MFI(14));// Indicator
/*
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);
VarSet("ThisInd"+j,MFI(14));//Indicator
Rank=Rank + IIf( VarGet("MyInd"+i) < VarGet("ThisInd"+j),1,0);
/*
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);
}
TimeFrameRestore();
Filter=1;//Status("lastbarinrange");
Count=Status("stocknum");
Var=IIf(InWatchList(0),VarGet("Rank"+ Count),Null);
AddColumn(TimeFrameExpand(Var , inMonthly),"Monthly Rank");
AddColumn(Var,"Daily Rank");
//Plot(TimeFrameExpand(Var , inMonthly),"",2,1);
>
> Hi Stephane,
>
> Much appreciate your reply, thankyou.
>
> I'll try it out and see how it goes. From what I understand it will
> place the top 100 into a watchlist for the month. This would cut out
> a couple of steps from what I posted before. ie: exporting to Excel
> etc.
>
> Using the code I think I could go through month by month and make a
> chart up for each months top 100 and use that chart in a backtest.
>
> Thanks again.
> Regards Ranga
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Stephane Carrasset"
> <s.carrasset@xxxx> wrote:
> >
> > 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 );
> >
> > TimeFrameSet( inMonthly );
> > 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();
> >
> > Plot(TimeFrameExpand( rank, inMonthly ),"",2,1);
> >
> > >
> > > Hi Tomasz,
> > >
> > > > Of course it is possible to implement it in AFL.
> > > > What is impossible is to write a code for every user on every
> > > request.
> > >
> > > I suppose my request looked like it was directed at you but I
> > thought
> > > anyone on the forum could reply. Thanks.
> > >
> > > Anyway, I'll give up on the idea unless there is easier way (any
> > > gurus?) because ranking them monthly to find the top *** ONE
> > HUNDRED
> > > ONLY *** would need to:
> > >
> > > 1. Run this in AA for each month:
> > >
> > > TimeFrameSet( inMonthly );
> > > PositionScore = C * V;
> > > TimeFrameRestore();
> > > PositionScore = TimeFrameExpand( PositionScore, inMonthly );
> > >
> > > 2. Export the results to Excel.
> > > 3. Find the turnover for the 100th stock
> > > 4. Add the value to a chart (Top100)
> > > 5. AA backtester add a filter (C * V) >= foreign(Top100).
> > >
> > > Regards Rangaroopa
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> > <amibroker@xxxx>
> > > wrote:
> > > > Hello,
> > > >
> > > > Of course it is possible to implement it in AFL.
> > > >
> > > > What is impossible is to write a code for every user on every
> > > request.
> > > >
> > > > As to:
> > > > >> ie: if I run a scan with the timeframe on monthly with C * V
> > and
> > > > > rank
> > > > >> the highest to lowest, I would like the highest 100. Doing
> > this
> > > for
> > > > >> every month for backtesting.
> > > >
> > > > It is easy with time frame functions. It takes 4 lines of code.
> > > >
> > > > TimeFrameSet( inMonthly );
> > > > PositionScore = C * V;
> > > > TimeFrameRestore();
> > > >
> > > > PositionScore = TimeFrameExpand( PositionScore, inMonthly );
> > > >
> > > > Once you feed AmiBroker with correct score for each security,
> it
> > > will rank
> > > > them for you automatically.
> > > >
> > > > Best regards,
> > > > Tomasz Janeczko
> > > > amibroker.com
> > > > ----- Original Message -----
> > > > From: "rangaroopa2000" <rangaroopa2000@xxxx>
> > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > Sent: Thursday, December 16, 2004 9:29 PM
> > > > Subject: [amibroker] Re: Top 100 Backtest
> > > >
> > > >
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > I guess this (Top 100) is not possible with the latest
> > functions
> > > in
> > > > > Amibroker then?
> > > > >
> > > > > Regards
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "rangaroopa2000"
> > > > > <rangaroopa2000@xxxx> wrote:
> > > > >>
> > > > >> Hello Tomasz,
> > > > >>
> > > > >> Thankyou for your reply.
> > > > >>
> > > > >> Maybe I wasn't too clear with my words but what you suggest
> > and
> > > > > from
> > > > >> my understanding, I would be able to backtest only
> > the "latest"
> > > top
> > > > >> 100.
> > > > >>
> > > > >> I would like to find the top 100 for each and every month in
> > the
> > > > > past
> > > > >> five years or so. They would vary as would the actual top
> 100
> > > stock
> > > > >> do.
> > > > >>
> > > > >> ie: if I run a scan with the timeframe on monthly with C * V
> > and
> > > > > rank
> > > > >> the highest to lowest, I would like the highest 100. Doing
> > this
> > > for
> > > > >> every month for backtesting.
> > > > >>
> > > > >> Thanks again.
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> > > > > <amibroker@xxxx>
> > > > >> wrote:
> > > > >> > Hello,
> > > > >> >
> > > > >> > It is easy, run an exploration with average volume:
> > > > >> >
> > > > >> > Filter = BarIndex() == BarCount - 1;
> > > > >> > AddColumn( MA( V, 100 ), "Avg volume" );
> > > > >> >
> > > > >> >
> > > > >> > Then click on "Avg. volume" output column to sort it.
> > > > >> > Then select top N (say top 100) from the list and
> > > > >> > click with right mouse button over the list and
> > > > >> > choose "Add selected results to watch list".
> > > > >> >
> > > > >> > From then on top-100 stocks will be on watch list of your
> > > > >> > choice and you will be able to backtest them.
> > > > >> >
> > > > >> > You can also do this directly from backtest formula
> > > > >> > (without need to run exploration).
> > > > >> > Just use
> > > > >> >
> > > > >> > PositionScore = MA( V, 100 );
> > > > >> >
> > > > >> > and backtester will automatically prefer stocks with
> higher
> > > > > average
> > > > >> volume.
> > > > >> >
> > > > >> > Best regards,
> > > > >> > Tomasz Janeczko
> > > > >> > amibroker.com
> > > > >> > ----- Original Message -----
> > > > >> > From: "rangaroopa2000" <rangaroopa2000@xxxx>
> > > > >> > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > >> > Sent: Tuesday, December 14, 2004 10:46 AM
> > > > >> > Subject: [amibroker] Re: Top 100 Backtest
> > > > >> >
> > > > >> >
> > > > >> > >
> > > > >> > >
> > > > >> > > Hi Ron,
> > > > >> > >
> > > > >> > > Thanks for replying.
> > > > >> > >
> > > > >> > > It's difficult if not impossible to find a list of the
> top
> > > 100
> > > > >> stocks
> > > > >> > > over the past 5 years or so and I think using turnover
> > would
> > > be
> > > > >> good
> > > > >> > > anyway.
> > > > >> > >
> > > > >> > > I suppose I could go through each month and export the
> > > turnover
> > > > >> and
> > > > >> > > pick out the top 100 and create a chart of the results.
> I
> > > just
> > > > >> thought
> > > > >> > > there maybe an easy way with all the fantastic functions
> > AB
> > > has
> > > > >> now!
> > > > >> > >
> > > > >> > > BTW sorry about the double post.
> > > > >> > >
> > > > >> > > Regards
> > > > >> > >
> > > > >> > > --- In amibroker@xxxxxxxxxxxxxxx, "mrdavis9"
> > <mrdavis9@xxxx>
> > > > >> wrote:
> > > > >> > >> There was some coding done here on this board very
> > recently
> > > In
> > > > >> > > (November??) regarding Float turnover.
> > > > >> > >>
> > > > >> > >> Steve Woods wrote a book about Float turnover as well.
> > > > >> > >>
> > > > >> > >> One of the posters (Herman ) on this board was involved
> in
> > > > >> > > developing the recently developed code, and I think (but
> > am
> > > not
> > > > >> sure)
> > > > >> > > that someone also developed a way to retrieve the float
> > > amounts
> > > > >> from
> > > > >> > > Yahoo. Hope this helps. Ron D
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> click here
> <http://us.ard.yahoo.com/SIG=129j56na9/M=295196.4901138.6071305.3001176/D=groups/S=1705632198:HM/EXP=1103575877/A=2128215/R=0/SIG=10se96mf6/*http://companion.yahoo.com>
>
>
>
> ------------------------------------------------------------------------
> *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
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
>
>
> __________ Information NOD32 1.940 (20041205) __________
>
> Ce message a ete verifie par NOD32 Antivirus System.
> http://www.nod32.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|