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

Re: [amibroker] Question for Howard Bandy



PureBytes Links

Trading Reference Links

Hi Rich --

Thanks for the kind words about my book.

There is an errata file that lists all of the mistakes and typos.  It can be found on this web page:
http://www.quantitativetradingsystems.com/book.html

This system uses a Watchlist that has the tickers of the stocks (or, better, sector funds) that you want to rotate among.  I like to use the nine S&P Sector ETFs.  XLB, XLE, XLF, XLI, XLK, XLP, XLU, XLV, and XLY.  First create a watchlist containing these.  Then tell AmiBroker to use it when you are running: Automatic Analysis > Use Filter > Define.

As the system is written in the book and in the download of the code, the Optimize statements are commented out.  They need to be enabled.  Since you got optimization results, it sounds like you did that.

The date range tested should be long enough so that there is some rotation.  Since this system holds about 5 trading days, anything more than a month or so should show rotation.

Whenever an afl program has the statement "EnableRotationalTrading", it will not have Buy or Sell statements.  Rotational trading is a subset of AmiBroker's much more general (and much more powerful) portfolio trading.  You are correct -- the system is evaluated at the close of every bar and positions changed as necessary.  In AmiBroker, Help > AFL Language Reference.  Enter "enablerotationaltrading" and read the description.

And to answer a question that you have not asked, the automatic walk forward tools within AmiBroker do work as you would hope they do with rotational trading models.

The results you get will depend on several things --
1.  The tickers in the watchlist.
2.  The date range.
3.  The Automatic Analysis > Settings > Trades.  Usually the choice is between Close with a delay of 0, or Open with a delay of 1.
4.  The specific price data which will be different from different vendors -- Yahoo versus Quotes Plus, for example.

Here is what the code looks like when it is ready to start an optimization run.  Note that I have left some of the Optimize statements commented out, some enabled. 


//    SectorRotation.afl
//
//    Compute a score based on the recent Rate Of Change
//    of the closing price.
//
//    Rotate among the nine S&P sector ETFs
//
//    Program options include allowing short positions or not
//    and interpreting the ROC as a mean reverting indicator
//    by turning it "upside down".

EnableRotationalTrading();

//    The number of issues to hold at a time
NumberHeld = 2; //Optimize("NumberHeld",1,1,4,1);

//    Allocate funds equally among all issues
PositionSize = -100/NumberHeld;

//    Set WorstRankHeld to be some number greater
//    than the number of positions held.
NumberExtras = 3; //Optimize("NumberExtras",0,0,4,1);
WorstRank = NumberHeld + NumberExtras;
SetOption("WorstRankHeld", WorstRank);

//    The LookBack period for the Rate of Change indicator
LookBack = Optimize("LookBack",6,2,20,1);

//    UpDown allows the ROC to be inverted
//    to treat a rising ROC as a "sell" signal
UpDown = Optimize("UpDown",2,1,2,1);

//    Value of 1 allows short positions
//    Value of 2 blocks short positions
AllowShort = Optimize("AllowShort",1,1,2,1);

Multiplier = IIf(UpDown==1,1,-1);
Score = Multiplier*ROC(C,LookBack);
Score = IIf(AllowShort==1,Score,Max(Score,0));
PositionScore = Score;
//Figure 15.1 Sector Rotation

Thanks, and I hope this helps,
Howard
www.quantitativetradingsystems.com



On Thu, Jun 5, 2008 at 2:36 PM, foxblade2000invest <foxblade@xxxxxxxxxxxx> wrote:

Howard,

If you read this - first can I say thanks for the book (QTS) which
I'm glued to and really enjoying.

I'm an inexperienced AB user so pardon any silliness.

I'm trying to optimise / backtest your rotational trading model
(listed at fig 17.1 but actually 15.1) and in doing so, I get the
same result for every optimisation step - a RAR of about 10.5%.

Clearly something's wrong - can you make any suiggestions?

Also, with this type of model - there are no buy and sell signals
(are there?) - If so, does the system rebase itself on a daily
basis - ie buy / sell the highest / lowest ranking issues each day
(and keep them if there's no change in the order)?

Thanks for any help.

Rich


__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___