PureBytes Links
Trading Reference Links
|
Title: Re[2]: [amibroker] How to Port-Backtest many WLs
This code shows my attempt at running a portfolio Backtest over many WatchLists, and get only one BT summary per test. I added the name of the WatchLists to the AA report. The trading system is just dummy code to run the opt - please substitute your own.
let me know if you can improve on it ;-)
herman
function ParamOptimize( description, defaultVal, minv, maxv, step )
{
return Optimize(description, Param(description,defaultVal, minv, maxv, step ), minv, maxv, step );
}
SetTradeDelays(0,0,0,0);
PosQty = 5;
SetOption( "MaxOpenPositions", PosQty );
WLNum = ParamOptimize("WL#",932,0,928,1); // I use PD data
StaticVarSet("WLNum",WLNum);
SetOption ( "UseCustomBacktestProc", True );
if ( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess();
for ( bar = 0; bar < BarCount; bar++ ) bo.ProcessTradeSignals( bar );
WLNum = Nz(StaticVarGet("WLNum"));
WLName = CategoryGetName( categoryWatchlist, WLNum );
bo.PostProcess();
bo.AddCustomMetric( "WL", WLName );
}
QWL = InWatchList( WLNum );
Buy = L < Ref( L, -1 ) AND QWL;
Sell = H > Ref( H, -1 ) AND QWL;
Short = Sell;
Cover = Buy;
BuyPrice= SellPrice = ShortPrice = CoverPrice = C;
PositionSize = -100 / PosQty;
PositionScore = Ref(MA(V*(H-L),10),-1);
Friday, August 28, 2009, 6:29:36 AM, you wrote:
|
found it, it is simple using:
InWatchList( listno )
herman
Thursday, August 27, 2009, 7:57:50 PM, you wrote:
|
Hello,
I would like to use the Optimizer to Backtest a Portfolio trading system on many (~1000) WatchLists, i.e., the Optimizer would select the WL to be tested by number, and the AA results table would show one summary row for each portfolio Backtest.
What is the best way to do this?
Many thanks!
herman
|
|
__._,_.___
**** IMPORTANT PLEASE READ ****
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/
__,_._,___
|