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

[amibroker] Exit Study - A conceptual question



PureBytes Links

Trading Reference Links

In order to test a simple high Beta strategy with the new portfolio tester
for the S&P100 equities I used the following code:

SetForeign(".OEX");

EMA1=EMA(C,40);

Buy1=Cross(C,EMA1);
Sell1=Cross(EMA1,C);

RestorePriceArrays();


Periods1=optimize("perioden",28,20,50,1);//Set the period of Observation

//****Beta***********************/

Beta=(( Periods1 * Sum(ROC( C,1) * ROC(P,1),Periods1 )) -
(Sum(ROC(C,1),Periods1) * Sum(ROC( P,1),Periods1))) / ((Periods1 *
Sum((ROC(P,1)^2 ),Periods1)) - (Sum(ROC(P,1 ),Periods1)^2 ));


SetOption("initialequity",100000);
SetOption("MaxOpenPositions", 10 );
PositionSize=-100/10;

Buy=Buy1;
Sell=Sell1;
PositionScore=beta;

It's really a very simple strategy that's based on weekly prices: Buy the
10 S&P100 equities with the highest beta over 28 weeks if the OEX crosses
its 40-week EMA, sell them if the OEX falls below its EMA. Over the past 10
years that strategy worked very well and outperformed the OEX by far. But I
ran into some problems/questions:

1. The Backtest Report shows me under "Trades" only 9 equities bought at
every buy date and not 10 as specified above. How come? I applied the test
to my market the contains the S&P100 equities but not the OEX itself. But
it seems as if AB includes also the equity/index introduced with
SetForeign(). How can I prevent that?
2. According to the test the 100,000 bucks invested on April 1, 1993 stood
at 802,727 as of Dec, 15, 2003, thereof Cash was at 60,120 - see the green
line in the attached picture. That seems extremely high given that the
system should be fully invested after every buy signal which was not the
case - see the 1994, 1998-2000 and 2003 periods. Has this to do with
problem no. 1? I noticed that on the first buy date the sum of all position
values of the bought 9 equities was several thousand dollars below 100,000.
This supports my suspect that Amibroker included the OEX in the number of
positions (reducing them to 9 instead of 10) but interpreted it at the same
time as cash (that gained an annual interest rate of 2% as specified in my
settings). So it seems that the system was not fully invested when in a
long position.
3. The Backtest Report doesn't show me how the portolio performed against
the OEX. Of course, I can run the test for the OEX alone (and setting
PositionSize to -100/1) and I have done that indeed. But is there a simpler
way how to do that?
4. I don't understand how exactly turning on "Pad and align to reference
symbol" influences the test results.

Thank you for your comments.

Regards, Thomas

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 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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/ 


Attachment:
OEX High Beta Test.PNG

Attachment: Description: "Description: Attached file: OEX High Beta Test.PNG"