No need to go through that nightmare, check this :
n = Optimize( "system", 0, 0, 2, 1 );
PositionSize = 10000;
SetOption( "holdminbars", 1 );
Buy = Sell = Short = Cover = 0;
switch( n )
{
case 0 :
Buy = 1;
break ;
case 1 :
Short = Cover = 1;
break;
case 2:
Buy = Sell =1;
break ;
}
SetCustomBacktestProc( "" );
/* Custom-backtest procedure follows */
if( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest(); // run default backtest procedure
StaticVarSet( "system" + n, bo.EquityArray());
}
for( i = 0; i < 3 ; i ++ )
{
e = StaticVarGet( "system" + i ) ;
clr = ColorHSB ( 240 / 3 * i , 200,200);
Plot( e, "\n" + EncodeColor ( clr) + "system" + i , clr );
}
Hello,
so far I've been using this template (from http://www.elitetrader.com/et/index.php?threads/quantshare-vs-amibroker.276245/page-5 ) to clone symbols whenever I want to test more than one system simultaneously.
CloneNameAdd = "_Clone"; watchlist = 10; // choose watchlist to move created symbols to group = 255; // alternative group (instead of group 253) to move created symbols to market = 255; // alternative market (instead of market 253) to move created symbols to nm = Name(); // 1. In Analysis choose "Apply to: Current", "Range: All quotes", // choose "Periodicity" in backtester settings and then click "Scan" to clone symbol(s) // As for giving a composite name don't forget starting with tilde! if ( Status( "action" ) == actionScan ) { atcmode = atcFlagDefaults; for ( i = 1; i < 11; i++ )//number of clones -> 10 { indexname = "~" + nm + CloneNameAdd + i; AddToComposite( Open, indexname, "O", atcmode ); AddToComposite( High, indexname, "H", atcmode ); AddToComposite( Low, indexname, "L", atcmode ); AddToComposite( Close, indexname, "C", atcmode ); AddToComposite( Volume, indexname, "V", atcmode ); AddToComposite( OI, indexname, "I", atcmode ); } } // 2. in Analysis keep previous settings and then click "Explore" if( Status( "action" ) == actionExplore ) { List = CategoryGetSymbols( categoryMarket, 253 ); for ( k = 0; ( symbol = StrExtract( List, k ) ) != ""; k++ ) { if ( StrFind( symbol, nm + CloneNameAdd ) ) { CategoryAddSymbol( symbol, categoryWatchlist, watchlist );// choose watchlist number CategoryAddSymbol( symbol, categoryGroup, group ); CategoryAddSymbol( symbol, categoryMarket, market ); } } } Buy = 0; NumColumns = 1; Filter = Status( "lastbarinrange" ); SetOption( "RefreshWhenCompleted", True );
Then in the systems afl I use this type of condition:
if ( StrFind(Name(), "Clone1" ) )
{system1 here}
if (StrFind(Name(), "Clone2" ) )
{ system2 here}
So far, it seems is the best approach since it can handle multiple positions in the same bar for the same symbol, but I've used it on relatively small watchlists.
I would like to test several systems on a database which contains a lot of symbols, and creating several clones of each symbol would make it a bit heavy.
It would be interesting to hear from other users if you approach multiple system testing differently.
Thanks
Kind Regards,
pm
Attachment(s) from Aron Pipa | View attachments on the web
1 of 1 Photo(s)
Posted by: Aron Pipa <aron@myafl.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon