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

Re: [amibroker] portfolio backtest



PureBytes Links

Trading Reference Links

hi

I actually found your previous reply. I looked at a wrong message before, sorry about that. Your previous reply to this question was:




***"If you want to "keep" buy over those 4 days use rotational mode. As for regular mode - trading practice shows that entering delayed signal (2nd, 3rd or 4th day from initial singal) is not profitable.
 
There are also other reasons why regular mode works as it works currently:
1. matching portfolio trades with individual trades (the same entry/exit dates)
2. memory limitation. If you wanted to keep all trade signal and price arrays for all symbols and pass them to the backtester then you will need for 10 years of EOD data and 1000 stocks: 9 (arrays) * 4 (bytes per array item) * 2600 (ten years of EOD data) * 1000 (stocks) = 94 MB of RAM. This could be eventually working but people are testing on 10000 stocks and even more Then 940MB to store signals would be needed. And how about intraday data ? People testing on 6 months of 1-minute data have 50000 data bars per stock. So it would require 1.8GB of RAM. Not acceptable.
 
You may ask why 9 arrays: buy, sell,short,cover, buyprice, sellprice,shortprice,coverprice, positionscore (in fact additional storage is needed for auxiliary data such as margin deposit, tick size, round lot size, etc, etc)"***





I still don't really understand why this would take up so much extra memory. Basicly the number of arrays to feed the backtester are the same. It only needs additional information which Buy corresponds to which Sell and which short corresponds to which cover.

For instance I have the following arrays A: index position, B: Buy, C: Sell, then you could feed the portfolio backtester an additional array D which carries the index position of a sell at the index of the buy.

A: 0123456789
B: 0011100000
C: 0000011100

D: 0056700000

So D has at index position 2 the index position it needs to sell. If the portfolio backtest now doesn't take the buy position at index 2 then the next bar the buy position at index 3 is open for evaluation. 

Does this really require so much more memory? Not sure if my thinking is right but I do not see the problem. For sure I do not want to use rotational trading.

I agree that it is difficult because exit signals may fall at the same index position and if they are exited at a different price then there is a problem but this could be avoided.

rgds, Ed


  ----- Original Message ----- 
  From: ed nl 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, November 20, 2004 10:31 AM
  Subject: [amibroker] portfolio backtest


  sorry about this second try but it seemed my Email did not get through ... at least it was not forwarded by Yahoo


  hi Tomasz,

  I think I addressed this before but I hope you can find time to read this.

  I believe the portfolio backtester needs additional functions. How it works now: the portfolio backtester   receives buy and sell arrays where each buy position has already a predetermined sell position.

  What happens in practice in for instance a retracement system: in an oversold situation it is very well possible that the buy criteria are met 3 days in a row. The way the backtester is setup currently it will only find the first buy signal because the others will most likely have been removed BEFORE they enter the portfolio backtester due to Exrem or whatever method one uses to remove excess signals.

  But if one uses portfolio trading then it might be that this stock with 3 buy signals is a row is not chosen for the first buy signal because there are other stocks that have a favourable PositionScore. Now the second or the third buy signals might be chosen but because these signals are removed they are ignored (the portfolio backtester does not know they are there). This is what I see happening with my current system I use for real trading. Stocks that are better positioned are not chosen because the signal was removed because it was an "excess" signal.

  I used to program my backtests in IDL and I adressed this problem by "linking" entry and exit signals. So all the entry signals were still there. For each entry one has to tell the backtester at which index position it should exit. You therefor can not simply feed a buy and a sell array to the backtester. It should be a buy array + an array that on the index position of the buy contains information where it needs to sell.

  I understand that you are working on pyramiding now. I guess that you had to address the situation I described above. When pyramiding is implemented will it be possible to use all entry signals in a portfolio backtest. I do NOT want to take multiple positions in one stock however but only want all signals to be evaluated in a portfolio backtest,

  regards, Ed

  [Non-text portions of this message have been removed]



  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
             
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/
      
    b.. To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/