[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Portfolio level testing - my Wish List



PureBytes Links

Trading Reference Links

  Hello amost B52

 Your post sounds very similar to an excell macro i have.
Needs a little more  work though.

At the moment in Ami i run an AA  of  my formula.
The data is exported and saved.
I place this data in Excel.
I run my macro.

The macro does
1: it first sorts the data by ascending order, by the entry date.

2: then the sort second order is by the ticker.(this will change as i 
will be using an Ami exploration code i wrote to emulate the AMI AA 
results (except the profit results), which i need for the dates, the 
entry and exit prices and the volume, and a sort order ranking number 
which will place a high value in the column for a more preferable 
stock, e.g. it may be an MA of money going into the ticker. 

3)After the sort it compares the row of the entry date column to the 
previous row of the exit date column. 
  
   If the entry date is greater than the exit date it places it in a 
new sheet.

   It does this until there are no overlapping entry dates to the 
previous exit date rows.
   so if a tickers entry date was 2001/01/01 and exit date was 
2001/01/05
  Then the next row  contains no other trades when the entry date 
occured before or on 2001/01/05 e.t.c. down the rows.

  So the first sheet is now a list of buys and sells of different 
tickers, from an ami  AA or exploration.

 The first sheet has the first,  possible choice of stock to purchase 
after a sell, this is because of the date order and  the second order 
choice ranking preference number which came from an Ami 
exploration.   

   The second sheet has the second possible choice of  trades to take 
   The 3rd sheet  the 3rd possible choice e.t.c.  
  
   I can choose how many sheets i want created, so if ihad enough 
capital for 5 trades, i would select 5 sheets.

     
4:It then calculates the compounded profit of each sheet.

   I still need to place a formula in the macro so the equity of each 
trade will be a certain percentage of the money (V *C)or an MA of the 
money (V*C) of the previous day.(This is why i need to use an Ami 
exploration, as the AA does not contain volume).
   But if the equity is less than this ,it will use all the equity 
for the next trade. 
  This is needed as the equity can be higher than the value of money 
that went in the stock.
 For an  example  i ran a very basic test on ami, the results were 
reasonable, but it only had a 32% win rate.
 I placed the results into excel and ran the macro by the date order 
then only the alphabetical ticker name.
 
 The profits went of the scale, the macro stopped. So it needs code 
added to be more realistic. 


If youre interested   
  
 
email me at

amiabilityy@xxxxxxxxx  

Peter. 






--- In amibroker@xxxxxxxxxxxxxxx, "b519b" <b519b@xxxx> wrote:
> In a previous post, I outlined some of the problems one has to take 
> into account when using AB to test a basket of stocks with a market 
> timing system. I look forward to the day when AB will have 
portfolio 
> level testing. 
> 
> Here are some ways I can picture portfolio level testing being 
> implemented in AB. Give Tomasz's great ability, I am sure what he 
> finally produces will go far beyond what I outline.
> 
> BASIC PORTFOLIO TESTING:
> 
> The issue here is to make sure AB has a limit for either the number 
> of open trades it has (easy to implement) or the amount of capital 
> committed (easy to imagine but harder to implement). A "sort by" 
> function would need to be added to AB's AFL. AB would then use 
> the "sort by" code to create an array (ticker and sort value) of 50 
> stocks for each date/time bar. Of course, the stocks would be 
sorted 
> with in the array according to the sort by values. 
> 
> Then on a second pass over the data, AB would take the top 10 or 20 
> stocks from the array for every entry signal date. If a stock gets 
> stopped out, AB would replace it using the sort by array for the 
> next trading day. (Of course, one would like to be able to turn 
this 
> replacement feature off for some strategies). 
> 
> Summary resutlts could be similar to the current ones AB gives, 
with 
> a few additions. It would be nice to know what percentage of stocks 
> were winners for each trade period (again I am picturing market 
> timing systems).
> 
> PORTFOLIO TESTING LEVEL TWO
> 
> I would like to be able to test 2 or more portfolios at the same 
> time. Thanks to comments from a trader with a lot of experience, I 
> believe one can get a much smoother equity curve by using two or 
> more strategies at the same time. Although there are many 
> possibilities, let me share just one: would it not be nice to have 
a 
> trend following system and a system that does well in non-trending 
> markets. That way if one is getting whipsawed, the other would be 
> making money big time. I might be expecting too much (a very smooth 
> equity curve) for a modest cost (assuming the out of phase method 
> will not take too much of the profit fo the in phase method). But 
> the point is being able to test such ideas.
> 
> How could this be implemented? In very simple terms, AB would 
> generate 2 distinct arrays of stocks for each data day (one array 
> for each method). Then on the second pass, AB would uses these 
> arrays to trade 2 portfolios. There would need to be an additional 
> line of code to tell AB how often to reallocate capital between the 
> two strategies.
> 
> PORTFOLIO TESTING LEVEL THREE
> 
> For level two I picture testing two strategies that use the same 
> market timing signal. The next step of complexity would be to be 
> able to test 2 methods/portfolios when each has its own timing 
> method. 
> 
> Since this is a wish list, I might as well add that it would be 
> great to be able to test more than 2 at the same time: perhaps 4 or 
> 5. Also it would be nice to be able to specify different weightings 
> to the portfolios: For example, portfolio 1 gets 40% of capital, 
> portfolio 2 gets 30%, portfolio 3 gets 20% and portfolio 4 gets 10%.
> 
> WHAT DO OTHERS THINK? What would you like to see in the way of 
> portfolio testing? 
> 
> b


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/yMx78A/fNtFAA/46VHAA/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/