PureBytes Links
Trading Reference Links
|
<SPAN
class=050222701-31122003>Hello,
<SPAN
class=050222701-31122003>
It appears
that the removal of a single
stock in your composite can make a big difference in system
performance. The program below shows that profits can vary from 82% to 575%
by just removing one single stock from the composite. I have found similar
results in other trading systems.
<SPAN
class=050222701-31122003>
You should replace
the demo system's code, found in the SystemUnderTest(), with your own
composite-using system. You may also have to modify the type of composites
created; for this example I used simple price composites while you may be
using MeanRSI type of composites.
<SPAN
class=050222701-31122003>
You can open your
WorkSpace, select Candle or Bar style, and step through the composites to see in
detail how the removal of single stocks effect the composite. The Symbol
attached to the "~Comp" indentifies the ticker that is ommitted from the
composite.
<SPAN
class=050222701-31122003>
While this effect
will vary for different systems it could, in some case, explain the
"demise" of systems when ticker lists are changed. If nothing else it shows that
nothing should be taken for granted in systems design.
<SPAN
class=050222701-31122003>
<SPAN
class=050222701-31122003>herman.
<SPAN
class=050222701-31122003>
/*
Composite stock-sensitivity analysis - Herman van den Bergen
1) Set filter to the watchlist used to create composite 2) Set
WatchlistNum in first line of code below to the same watchlist number 3) Set
All Quotations and run Scan 4) For a normal test (full composite) set Range
and run the Old-Backtester 5) To see how a single stock effects group
performance set Filter to Watchlist selected earlier and run the Old-Optimizer
6) To see how the removal of one stock effects individual equities run an
Eploration */
WatchListNum = <FONT
color=#ff00ff>0<FONT
color=#000000>; Scan = <FONT
color=#0000ff>Status(<FONT
color=#ff00ff>"Action")==<FONT
color=#ff00ff>3<FONT
color=#000000>; BackTest = <FONT
color=#0000ff>Status(<FONT
color=#ff00ff>"Action")==<FONT
color=#ff00ff>5<FONT
color=#000000>; Explore = <FONT
color=#0000ff>Status(<FONT
color=#ff00ff>"Action")==<FONT
color=#ff00ff>4<FONT
color=#000000>; List = <FONT
color=#0000ff>GetCategorySymbols( <FONT
color=#ff0000>categoryWatchlist<FONT
face=Arial>, WatchListNum);
InitialEquity = <FONT
color=#ff00ff>100000<FONT
color=#000000>; Filter<FONT
color=#000000> = Status<FONT
color=#000000>(<FONT
color=#ff00ff>"LastBarInTest"<FONT
face=Arial>); <FONT
color=#0000ff>SetOption(<FONT
color=#ff00ff>"InitialEquity"<FONT
face=Arial>,InitialEquity); <FONT
color=#0000ff>SetOption(<FONT
color=#ff00ff>"NoDefaultColumns",<FONT
color=#ff0000>True<FONT
face=Arial>); <FONT
color=#ff0000>Buy=<FONT
color=#ff0000>Sell=<FONT
color=#ff0000>Short=<FONT
color=#ff0000>Cover=<FONT
color=#ff00ff>0<FONT
color=#000000>; <FONT
color=#ff0000>function<FONT
face=Arial> SystemUnderTest( RemovedTicker )
{ Comp = <FONT
color=#ff00ff>"~Comp"<FONT
color=#000000>+RemovedTicker; <FONT
color=#000000>// Create your own type of composites
below
V<FONT
color=#000000>=Foreign<FONT
color=#000000>(Comp,"V"<FONT
size=2>);
O<FONT
color=#000000>=Foreign<FONT
color=#000000>(Comp,"O"<FONT
color=#000000>)/V<FONT
size=2>; <FONT
color=#ff0000>H=<FONT
color=#0000ff>Foreign(Comp,<FONT
color=#ff00ff>"H")/<FONT
color=#ff0000>V<FONT
color=#000000>; <FONT
color=#ff0000>L=<FONT
color=#0000ff>Foreign(Comp,<FONT
color=#ff00ff>"L")/<FONT
color=#ff0000>V<FONT
color=#000000>; <FONT
color=#ff0000>C=<FONT
color=#0000ff>Foreign(Comp,<FONT
color=#ff00ff>"C")/<FONT
color=#ff0000>V<FONT
color=#000000>; //
Substitute your own composite-based system for the one
below
Sell<FONT
color=#000000>=Cross(
MACD(), <FONT
color=#0000ff>Signal<FONT
color=#000000>() ); <FONT
color=#ff0000>Buy = <FONT
color=#0000ff>Cross( <FONT
color=#0000ff>Signal(), <FONT
color=#0000ff>MACD<FONT
color=#000000>() ); <FONT
color=#ff0000>Short=<FONT
color=#ff0000>Sell<FONT
face=Arial>; <FONT
color=#ff0000>Cover=<FONT
color=#ff0000>Buy<FONT
color=#000000>; // End
trading system <FONT face=Arial
size=2> <FONT
color=#ff0000>return <FONT
color=#0000ff>Equity(<FONT
color=#ff00ff>0<FONT
color=#000000>); } <FONT
color=#ff0000>if<FONT
color=#000000>(Scan) { <FONT
color=#000000>// Create normal composite<FONT
size=2> <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff00ff>1,<FONT
color=#ff00ff>"~Comp",<FONT
color=#ff00ff>"V"<FONT
color=#000000>); <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff0000>O,<FONT
color=#ff00ff>"~Comp",<FONT
color=#ff00ff>"O"<FONT
color=#000000>); <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff0000>H,<FONT
color=#ff00ff>"~Comp",<FONT
color=#ff00ff>"H"<FONT
color=#000000>); <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff0000>L,<FONT
color=#ff00ff>"~Comp",<FONT
color=#ff00ff>"L"<FONT
color=#000000>); <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff0000>C,<FONT
color=#ff00ff>"~Comp",<FONT
color=#ff00ff>"C"<FONT
color=#000000>); //
Create composites with one stock removed<FONT
size=2> <FONT
color=#ff0000>for( n=<FONT
color=#ff00ff>0; (RemovedTicker=<FONT
color=#0000ff>StrExtract( List, n))!= <FONT
color=#ff00ff>""<FONT
color=#000000>; n++) {
<FONT
color=#ff0000>if( RemovedTicker!= <FONT
color=#0000ff>Name<FONT
color=#000000>() ) {
<FONT
color=#0000ff>AddToComposite(<FONT
color=#ff00ff>1,<FONT
color=#ff00ff>"~Comp"+RemovedTicker,<FONT
color=#ff00ff>"V"<FONT
color=#000000>); <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff0000>O,<FONT
color=#ff00ff>"~Comp"+RemovedTicker,<FONT
color=#ff00ff>"O"<FONT
color=#000000>); <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff0000>H,<FONT
color=#ff00ff>"~Comp"+RemovedTicker,<FONT
color=#ff00ff>"H"<FONT
color=#000000>); <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff0000>L,<FONT
color=#ff00ff>"~Comp"+RemovedTicker,<FONT
color=#ff00ff>"L"<FONT
color=#000000>); <FONT
color=#0000ff>AddToComposite(<FONT
color=#ff0000>C,<FONT
color=#ff00ff>"~Comp"+RemovedTicker,<FONT
color=#ff00ff>"C"<FONT
color=#000000>); }
} } // End
Scan
if<FONT
size=2>(explore) { <FONT
color=#0000ff>AddTextColumn(<FONT
color=#0000ff>Name(),<FONT
color=#ff00ff>"TradedTicker",<FONT
color=#ff00ff>1.0<FONT
color=#000000>); RefEquity = SystemUnderTest( <FONT
color=#ff00ff>""<FONT
color=#000000> ); AddColumn<FONT
color=#000000>(RefEquity,"NormalEquity"<FONT
color=#000000>,1.2<FONT
size=2>); <FONT
color=#0000ff>AddColumn(<FONT
color=#ff0000>Null,<FONT
color=#ff00ff>"Removed->",<FONT
color=#ff00ff>1.0<FONT
color=#000000>); for<FONT
color=#000000>( n=0;
(RemovedTicker=StrExtract(
List, n))!= ""<FONT
face=Arial>; n++) {
NewEquity = SystemUnderTest( <FONT
color=#ff00ff>"~Comp"<FONT
color=#000000>+RemovedTicker ); <FONT
color=#0000ff>AddColumn<FONT
color=#000000>(NewEquity,RemovedTicker,<FONT
color=#ff00ff>1.2<FONT
color=#000000>); } } //
End Explore<FONT
color=#000000> <FONT
color=#ff0000>if<FONT
color=#000000>( BackTest ) { <FONT
color=#ff0000>for( n=<FONT
color=#ff00ff>0; (RemovedTicker=<FONT
color=#0000ff>StrExtract( List, n))!= <FONT
color=#ff00ff>""<FONT
color=#000000>; n++); RemovedTickerNum = <FONT
color=#0000ff>Optimize(<FONT
color=#ff00ff>"RemovedStockNum",<FONT
color=#ff00ff>9999,<FONT
color=#ff00ff>0,n-<FONT
color=#ff00ff>1,<FONT
color=#ff00ff>1<FONT
color=#000000>); RemovedTicker=<FONT
color=#0000ff>StrExtract<FONT
color=#000000>( List, RemovedTickerNum ); <FONT
color=#ff0000>if<FONT
color=#000000>(RemovedTickerNum==9999<FONT
color=#000000>) RemovedTicker = <FONT
color=#ff00ff>""<FONT
color=#000000>; SystemUnderTest( RemovedTicker ); }
// End backtes
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 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 the Yahoo! Terms of Service.
|