Hi Abbie -- I wrote a paper, "Use of Fundamental Data in Active Investing", that discusses some the issues that arise when using fundamental data. You can download it for free from this site: http://www.blueowlpress.com/activities.html
Thanks, Howard On Fri, Jun 18, 2010 at 1:44 AM, Paolo <pcavat...@gmail.com> wrote: > > > Abbie, > > as far as I know yahoo doesn't provide historical fundamental data which > you need for proper historical backtesting. > > Regarding the for cycle it looks fine. > > > Paolo > > --- In amibroker@yahoogroups.com <amibroker%40yahoogroups.com>, > "sendfreetest" <sendfreet...@...> wrote: > > > > > > Thank you for getting back to me with some information on > > how to tackle the Percentile Rank of P/S Ratio code. > > > > I was thinking of using Yahoo! historical data but > > your comments make me think their data may not be > > accurate enough? Any thoughts on good data? > > > > I will think over and try to implement your idea > > about using PositionScore. > > > > What I was working on is a for a cycle to calculate > > the percentile. (Most of the code I found in back > > posts of this group. ) > > > > Right now the code seems to work in an exploration. > > I've pasted it below. (As I am new to coding it may > > not be the prettiest.) > > > > I'll continue to work on the code to try to make it > > useful for actually testing the idea. > > > > --- > > > > Var = C / GetFnData("SalesPerShare"); > > > > > > /* PERCENTILE RANK */ > > /* set watchlist , and indicator twice */ > > > > //Adapted From Count tickers in watchlist function - Anthony Faragasso > > > > listNum=1; // DEFINE WATCHLIST > > > > function CountTickersInWatchList( Listnum ) > > { > > // retrive comma-separated list of symbols in watch list > > list = GetCategorySymbols( categoryWatchlist, listnum ); > > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ ) > > { > > if( i == 0 ) i = 0; > > else i = i ; > > } > > return i; > > } > > // Adapted from Ranking Ticker List - Nenapacwanfr > > list = GetCategorySymbols( categoryWatchlist, listnum ); > > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ ) > > { > > SetForeign(sym); > > VarSet("MyInd"+i, (C / GetFnData("SalesPerShare"))); //INDICATOR - DEFINE > > Rank =1; > > > > for( j = 0; ( item = StrExtract( list, j ) ) != ""; j++ ) > > { > > SetForeign(item); > > VarSet("ThisInd"+j, (C / GetFnData("SalesPerShare"))); //INDICATOR - > DEFINE > > Rank=Rank + IIf( VarGet("MyInd"+i) < VarGet("ThisInd"+j),1,0); > > RestorePriceArrays(); > > } > > VarSet("Rank"+i,Rank); > > } > > Count=0; > > BreakLoop = False; > > for( k = 0; NOT(BreakLoop) &&( ticker = StrExtract( list, k ) ) != ""; > k++ ) > > { > > if(Name()==ticker) > > Breakloop=True; > > else > > Count=Count+1; > > } > > Rank = VarGet("Rank"+ Count); > > PercentRank = (1 - rank/CountTickersInWatchList(Listnum))*100; > > > > Filter = PercentRank > 17 AND PercentRank < 42; > > > > AddColumn(RANK,"Rank"); > > AddColumn(CountTickersInWatchList(Listnum),"Total"); > > AddColumn(Close,"Close"); > > AddColumn(PercentRank,"Percentile Rank"); > > AddColumn(C / GetFnData("SalesPerShare"), "P/S Ratio"); > > > > > > --- > > > > Thanks again for your help, > > > > Abbie > > > > > > --- In amibroker@yahoogroups.com <amibroker%40yahoogroups.com>, "Paolo" > <pcavatore@> wrote: > > > > > > First of all you need P/S data (or Sales per share and calculate the > ratio) with enough historical range and clean data. A rare combination > especially when talking about fundamentals. > > > > > > Secondly you can use Rotational backtesting with PositionScore being > equal to the inverse of the P/S (the higher the better). > > > > > > Otherwise I would recommend using a for cycle calculating the > percentile for each stock in your universe and use it to both rank your > stocks for proper buy/sell rules and plot also the ranking as an indicator. > Be careful 'cause for large number of stocks (>500) it tends to be very > slow. > > > > > > I hope it helps, > > > > > > Paolo > > > > > > --- In amibroker@yahoogroups.com <amibroker%40yahoogroups.com>, > "sendfreetest" <sendfreetest@> wrote: > > > > > > > > Hi, > > > > > > > > I really need coding assistance. > > > > > > > > I am attempting to code into AmiBroker Charles Kirkpatrick's > > > > trading methodology for testing. > > > > > > > > Kirkpatrick creates a percentile rank of stocks' price-to-sales > > > > ratio and uses it as a filter. He purchases only stocks > > > > with a percentile rank between the 17th and 42nd level. > > > > > > > > When a stocks price-to-sales percentile rank goes above 67 > > > > he sells. > > > > > > > > With AmiBroker's PERCENTILE function it seems to evaluate > > > > only one market's array to determine the percentile. > > > > > > > > Is their an AmiBroker funtion to evaluate say 100+ > > > > stocks P/S Ratio and give each a percentile rank. > > > > > > > > Thanks in advance for any help. > > > > > > > > Abbie > > > > > > > > > > > >